Thread: Admins cannot spawn restricted items

Results 1 to 3 of 3
  1. #1 Admins cannot spawn restricted items 
    Registered Member
    Join Date
    Aug 2014
    Posts
    63
    Thanks given
    6
    Thanks received
    2
    Rep Power
    0
    heres my item code in commands.java

    Code:
    if(playerCommand.startsWith("item")||playerCommand.startsWith("pickup")) {
    						if (c.inWild() && c.inFFA()) {
    						c.sendMessage("Can't do this here bud");
    							return;
    				}
    				try
    				{
    					if (c.playerRights == 7 || c.playerRights == 6 || c.playerRights == 5)
    					{
    						return;
    					}
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3)
    					{
    						int newItemID = Integer.parseInt(args[1]);
    						for(int i : restrictedItems) {
    							if(i == newItemID) {
    								c.sendMessage("This item can only be recieved via PKP Shop or Donator Shop.");
    								return;
    							}
    						}
    						int newItemAmount = Integer.parseInt(args[2]);
    						if(newItemAmount >= 2147483647) {
    							c.sendMessage("Please try spawning a lower amount of items.");
    							return;
    						}
    						if ((newItemID <= 21000) && (newItemID >= 0))
    						{
    							c.getItems().addItem(newItemID, newItemAmount);
    							 c.sendMessage("You succesfully spawned @blu@" + newItemAmount +" @bla@of the item @red@" + newItemID + "@bla@.");
    						} else
    						{
    							c.sendMessage("That item ID does not exist.");
    						}
    					} else
    					{
    						c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
    					}
    				} catch (Exception e)
    				{
    
    				}
    			}
    if i try spawn torva helm for example it says "his item can only be recieved via PKP Shop or Donator Shop.""
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Sep 2011
    Posts
    812
    Thanks given
    195
    Thanks received
    60
    Rep Power
    129
    Code:
    if(i == newItemID && c.playerRights != <idk what admin playerRights is>) {
    								c.sendMessage("This item can only be recieved via PKP Shop or Donator Shop.");
    								return;
    							}
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2014
    Posts
    63
    Thanks given
    6
    Thanks received
    2
    Rep Power
    0
    Quote Originally Posted by Pirates View Post
    Code:
    if(i == newItemID && c.playerRights != <idk what admin playerRights is>) {
    								c.sendMessage("This item can only be recieved via PKP Shop or Donator Shop.");
    								return;
    							}


    fixed thankyou!
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. 718 Item Spawning Restrictions?
    By Artificial in forum Help
    Replies: 5
    Last Post: 04-01-2014, 12:55 AM
  2. Replies: 1
    Last Post: 02-01-2013, 07:43 PM
  3. Replies: 2
    Last Post: 11-24-2011, 01:32 AM
  4. Spawn with item Restrictions command
    By Linus in forum Configuration
    Replies: 10
    Last Post: 05-02-2011, 09:21 AM
  5. Making it so you cannot spawn the PvP Items.
    By Discardedx2 in forum Snippets
    Replies: 16
    Last Post: 02-17-2010, 03:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •