I'm using this code to put a restriction on items:
Code:
public class Commands implements PacketType {
private int[] restrictedItems = { 13531, 0, 1, 2};
with the spawn code
Code:
if(playerCommand.startsWith("item"))
{
try
{
if (c.playerRights < 3)
{
return;
}
String[] args = playerCommand.split(" ");
if (args.length == 3)
{
int newItemID = Integer.parseInt(args[1]);
for(int i : restrictedItems) {
if(i == newItemID) {
c.sendMessage("Spawning that item is restricted!");
return;
}
}
int newItemAmount = Integer.parseInt(args[2]);
if ((newItemID <= 20000) && (newItemID >= 0))
{
c.getItems().addItem(newItemID, newItemAmount);
} else
{
c.sendMessage("That item ID does not exist.");
}
} else
{
c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
}
} catch (Exception e)
{
}
}
How would I make it so owners and admins (rights = 2 & 3) are not effected by these restrictions?