Fix ItemDupe bug in bukkit

This commit is contained in:
snowleo 2011-11-25 22:26:06 +01:00
parent fa73394113
commit d4685d1d10
2 changed files with 27 additions and 0 deletions

View File

@ -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);

View File

@ -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();
}
}
}