[RSPS TUT] Make Objects Unspawnable

.Judgement

Onyx user!
Reputation
0
In commands.java add


Code:
private static final int unspawnables[] = {};

And your ::item command should look like this when your done


Code:
		if (command[0].equals("item")) {
			int itemId = Integer.parseInt(command[1]);
			for (int id : unspawnables) {
				if (id == itemId) {
					player.sendMessage("You can't spawn this item.");
					return;
				}
			}
			if (command.length == 3) {
				player.getInventory().addItem(Integer.parseInt(command[1]),
						Integer.parseInt(command[2]));
			} else {
				player.getInventory().addItem(Integer.parseInt(command[1]), 1);
			}
			player.getInventory().refresh();
		}

Very easy to use,

To make an item unspawnable just put the item id example


Code:
private static final int unspawnables[] = {11694, 1234, 4732};
 
Wow, I am liking all the tutorials you are putting up! Going to help get this section started!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…