diff options
author | snowleo <schneeleo@gmail.com> | 2011-11-25 22:26:06 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-11-25 22:26:06 +0100 |
commit | d4685d1d10c077ec6edcd2901276152a403b91c1 (patch) | |
tree | 2eb198ee726cca3d35a97c3b2fad188b001f1fe4 | |
parent | fa733941138393a610625266dca52350e1fe4666 (diff) | |
download | Essentials-d4685d1d10c077ec6edcd2901276152a403b91c1.tar Essentials-d4685d1d10c077ec6edcd2901276152a403b91c1.tar.gz Essentials-d4685d1d10c077ec6edcd2901276152a403b91c1.tar.lz Essentials-d4685d1d10c077ec6edcd2901276152a403b91c1.tar.xz Essentials-d4685d1d10c077ec6edcd2901276152a403b91c1.zip |
Fix ItemDupe bug in bukkit
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Essentials.java | 2 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 9679aa64e..7c728b0b4 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -23,6 +23,7 @@ import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import com.earth2me.essentials.craftbukkit.ItemDupeFix; import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import com.earth2me.essentials.signs.SignBlockListener; @@ -182,6 +183,7 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this); pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this); + pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this); final EssentialsBlockListener blockListener = new EssentialsBlockListener(this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this); diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java new file mode 100644 index 000000000..243049e0a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.craftbukkit; + +import net.minecraft.server.EntityPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.event.player.PlayerListener; +import org.bukkit.event.player.PlayerTeleportEvent; + + +public class ItemDupeFix extends PlayerListener +{ + @Override + public void onPlayerTeleport(final PlayerTeleportEvent event) + { + if (event.isCancelled()) + { + return; + } + final CraftPlayer player = (CraftPlayer)event.getPlayer(); + final EntityPlayer entity = player.getHandle(); + if (entity.activeContainer != entity.defaultContainer) + { + entity.closeInventory(); + } + } +} |