diff options
author | Kristofer Henriksson <kthenriksson@gmail.com> | 2013-03-24 13:27:11 -0400 |
---|---|---|
committer | riking <rikingcoding@gmail.com> | 2013-03-25 15:56:15 -0700 |
commit | 3c02fb02a1d76c97743917a029c2495a42fb3bc7 (patch) | |
tree | 5a22fe4fb08312ef675b6f3bbf10222cef048da6 /src/main/java/net | |
parent | 02a5d09ddf030d299f9ad9298b02fdee0821957c (diff) | |
download | craftbukkit-3c02fb02a1d76c97743917a029c2495a42fb3bc7.tar craftbukkit-3c02fb02a1d76c97743917a029c2495a42fb3bc7.tar.gz craftbukkit-3c02fb02a1d76c97743917a029c2495a42fb3bc7.tar.lz craftbukkit-3c02fb02a1d76c97743917a029c2495a42fb3bc7.tar.xz craftbukkit-3c02fb02a1d76c97743917a029c2495a42fb3bc7.zip |
Allow plugins to enchant already enchanted items. Fixes BUKKIT-1956
This causes the server to generate PrepareItemEnchantEvent even in the
case that an item is already enchanted or otherwise would normally not
be enchantable.
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/ContainerEnchantTable.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java index 02d861e0..c36ce7d9 100644 --- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java +++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java @@ -79,7 +79,7 @@ public class ContainerEnchantTable extends Container { ItemStack itemstack = iinventory.getItem(0); int i; - if (itemstack != null && itemstack.w()) { + if (itemstack != null) { // CraftBukkit - relax condition this.f = this.l.nextLong(); if (!this.world.isStatic) { i = 0; @@ -125,6 +125,7 @@ public class ContainerEnchantTable extends Container { // CraftBukkit start CraftItemStack item = CraftItemStack.asCraftMirror(itemstack); PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i); + event.setCancelled(!itemstack.w()) this.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { |