--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java 2012/06/03 20:16:40 1808 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java 2012/06/05 09:30:32 1811 @@ -216,6 +216,7 @@ } else { event.setCancelled(true); event.getPlayer().sendMessage("You can't destroy that chest"); + server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried breaking a chest owned by " + chest.getOwner() ); } } } @@ -365,6 +366,7 @@ for (Block b : event.blockList() ) { ChestBean chest = chestMap.get( b.getLocation() ); if (chest != null) { + server.getLogger().info( "[AdvancedChest] Prevented an explosion from destroying chest owned by " + chest.getOwner() ); event.setCancelled( true ); return; } @@ -395,16 +397,13 @@ return; //chest is opened by it's owner } - if (chest.getModifyPlayers() != null && chest.getModifyPlayers().length()>0) { - String modplayers[] = chest.getModifyPlayers().split(","); - for (String p : modplayers) { - if ( player.getName().equals(p) ) { - return; //this player is on the whitelist so he may open - } - } + Set players = Util.stringToSet( chest.getModifyPlayers() ); + if ( players.contains(player.getName()) ) { + return; //this player is on the whitelist so he may open } - + + server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried opening a chest owned by " + chest.getOwner() ); player.sendMessage( ChatColor.BLUE + "Sorry but this chest is locked !"); event.setCancelled(true); } @@ -437,7 +436,12 @@ Player player = (Player) event.getPlayer(); if (player.getName().equals(chest.getOwner() )) { return; //chest is owned by it's own player - } + } + + Set players = Util.stringToSet( chest.getModifyPlayers() ); + if ( players.contains(player.getName()) ) { + return; //this player is on the whitelist so he may open + } ItemCount contents = countItems( event.getInventory().getContents() );