Added additional worldguard.stack.damaged permissions to allow stacking of tools with a different damage value

This commit is contained in:
zml2008 2011-12-07 22:27:00 -08:00
parent b1256eedcf
commit aa306a8df7

View File

@ -238,6 +238,7 @@ public void stack(CommandContext args, CommandSender sender) throws CommandExcep
Player player = plugin.checkPlayer(sender); Player player = plugin.checkPlayer(sender);
boolean ignoreMax = plugin.hasPermission(player, "worldguard.stack.illegitimate"); boolean ignoreMax = plugin.hasPermission(player, "worldguard.stack.illegitimate");
boolean ignoreDamaged = plugin.hasPermission(player, "worldguard.stack.damaged");
ItemStack[] items = player.getInventory().getContents(); ItemStack[] items = player.getInventory().getContents();
int len = items.length; int len = items.length;
@ -271,7 +272,7 @@ public void stack(CommandContext args, CommandSender sender) throws CommandExcep
// Same type? // Same type?
// Blocks store their color in the damage value // Blocks store their color in the damage value
if (item2.getTypeId() == item.getTypeId() && if (item2.getTypeId() == item.getTypeId() &&
(!ItemType.usesDamageValue(item.getTypeId()) ((!ItemType.usesDamageValue(item.getTypeId()) && ignoreDamaged)
|| item.getDurability() == item2.getDurability()) && || item.getDurability() == item2.getDurability()) &&
item.getEnchantments().equals(item2.getEnchantments())) { item.getEnchantments().equals(item2.getEnchantments())) {
// This stack won't fit in the parent stack // This stack won't fit in the parent stack