diff options
-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(); + } + } +} |