Try to avoid a Bukkit bug modifying the item after giving it to a player

This commit is contained in:
filoghost 2015-08-08 21:07:41 +02:00
parent fb129c4173
commit c0ca5d195b

View File

@ -18,7 +18,7 @@ public class GiveIconCommand extends IconCommand {
try { try {
ItemStackReader reader = new ItemStackReader(command, true); ItemStackReader reader = new ItemStackReader(command, true);
itemToGive = reader.createStack(); itemToGive = reader.createStack();
} catch (FormatException e) { } catch (FormatException e) {
errorMessage = ChatColor.RED + "Invalid item to give: " + e.getMessage(); errorMessage = ChatColor.RED + "Invalid item to give: " + e.getMessage();
@ -32,7 +32,7 @@ public class GiveIconCommand extends IconCommand {
return; return;
} }
player.getInventory().addItem(itemToGive); player.getInventory().addItem(itemToGive.clone());
} }
} }