Unspawnable Items Not Fully Working
So i got this source i got off my friend. (Idk what the base is) The rev is 667 btw
and i decided to fix it up and see if i could host it its a spawn/eco but for somereason the "::item" command only prevents the first word of the unspawnabled from being spawned if this dosnt make sence keep reading i'll be more detailed.
So Here is my "Item" Command Code P.S Thiers two..?:
Code:
if (cmd[0].equalsIgnoreCase("item") && (player.getRights() == 7)) {
try {
int itemId = Integer.valueOf(cmd[1]);
ItemDefinitions defs = ItemDefinitions
.getItemDefinitions(itemId);
if (defs.isLended())
return false;
String name = defs == null ? "" : defs.getName()
.toLowerCase();
player.getInventory().addItem(itemId,
cmd.length >= 3 ? Integer.valueOf(cmd[2]) : 1);
} catch (NumberFormatException e) {
player.getPackets().sendGameMessage("Use: ::item id (optional:amount)");
}
return true;
}
Code:
if (cmd[0].equalsIgnoreCase("item")) {
try {
int itemId = Integer.valueOf(cmd[1]);
ItemDefinitions defs = ItemDefinitions
.getItemDefinitions(itemId);
if (defs.isLended())
return false;
String itemName = defs == null ? "" : defs.getName()
.toLowerCase();
for (String strings : Settings.UNSPAWNABLE_ITEMS) {
if (itemName.contains(strings)) {
player.getPackets().sendGameMessage("<col=ff0000><img=1>That item isn't spawnable!");
return false;
} else if (player.getControlerManager().getControler() instanceof Wilderness) {
player.getPackets().sendGameMessage("<img=1><col=ff0000>You cannot spawn in the Wilderness!");
return false;
} else {
player.getInventory().addItem(itemId,
cmd.length >= 3 ? Integer.valueOf(cmd[2]) : 1);
return false;
}
}
} catch (NumberFormatException e) {
player.getPackets().sendGameMessage("Use: ::item id (optional:amount)");
}
return true;
}
And here is my Unspawnable items:
Code:
public static String[] UNSPAWNABLE_ITEMS = { "coins", "virtus", "pernix", "promethium" };
See how the first unspawnable item is "coins"? if i go in-game and try to spawn "::item 995" (coins)
it dose NOT spawn coins wich means it works.
BUT see the second item being "Virtus"? when i spawn the item "20159" (Virtus Mask)
DOSE spawn and it shouldn't. and i'v played it it many times and ONLY the first "item" thats being put on the list works nothing after it.
So can someone help me out with this?
(I'm not a noob at coding nor a leecher i am fairly experienced so please dont Flame/Hate.)