put it in the commands.java were the normal players commands are...
|
|
How would I enable ::item for everyone?
Code:if (playerCommand.startsWith("item")) { try { String[] args = playerCommand.split(" "); if (args.length == 3) { int newItemID = Integer.parseInt(args[1]); int newItemAmount = Integer.parseInt(args[2]); if ((newItemID <= 20500) && (newItemID >= 0)) { c.getItems().addItem(newItemID, newItemAmount); } else { c.sendMessage("That item ID does not exist."); } } else { c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))"); } } catch(Exception e) {

Use this instead, it meets your requirements.
Just stick it anywhere in your commands.java and it should workCode:if (playerCommand.startsWith("item") && c.playerRights >= 0) { if (c.inWild()) return; try { String[] args = playerCommand.split(" "); int[] unspawnable = {995,}; if (args.length == 3) { int newItemID = Integer.parseInt(args[1]); int newItemAmount = Integer.parseInt(args[2]); int itemID = Integer.parseInt(args[1]); for(int i : unspawnable) { if(c.playerRights <= 2) { if(itemID == i) { c.sendMessage("You cannot spawn this item."); return; } } } if ((newItemID <= 30000) && (newItemID >= 0)) { c.getItems().addItem(newItemID, newItemAmount); //System.out.println("Spawned: " + newItemID + " by: " + c.playerName); c.sendMessage("Spawned: " + newItemID + ""); } else { c.sendMessage("That item ID does not exist."); } } else { c.sendMessage("Wrong command or doesn't exist"); } } catch (Exception e) { } }

Tiggy, put the command outside of the if (c.playerRights >= 2) { statement.
| « [HELP][PI] Major glitch with talking. | PI intergration error » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |