Optimization and conflict resolution.

This commit is contained in:
lishd 2011-09-24 00:45:29 -04:00
parent 24f1081f5a
commit 493f9b7e2e
2 changed files with 4 additions and 6 deletions

View file

@ -48,9 +48,9 @@ public class OpenInv extends JavaPlugin {
config = this.getConfiguration();
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Highest, this);
//pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Highest, this);
//pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Event.Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.Highest, this);
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.Monitor, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.Lowest, this);
//pm.registerEvent(Event.Type.INVENTORY_CLOSE, inventoryListener, Event.Priority.Normal, this);
setupPermissions();

View file

@ -13,6 +13,7 @@ import org.bukkit.block.Chest;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Result;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
@ -40,7 +41,7 @@ public class OpenInvPlayerListener extends PlayerListener{
@Override
public void onPlayerInteract(PlayerInteractEvent event)
{
if(event.isCancelled())
if(event.useInteractedBlock() == Result.DENY)
return;
if(event.getAction() == Action.RIGHT_CLICK_BLOCK &&
@ -87,9 +88,6 @@ public class OpenInvPlayerListener extends PlayerListener{
//Send a notification
event.getPlayer().sendMessage("You are opening a blocked chest.");
//Cancel chest open event
event.setCancelled(true);
}
/*
Chest chest = (Chest)event.getClickedBlock().getState();