166 |
|
|
167 |
Set<String> players = Util.stringToSet( chest.getModifyPlayers() ); |
Set<String> players = Util.stringToSet( chest.getModifyPlayers() ); |
168 |
if (cmd.equals("addplayer")) { |
if (cmd.equals("addplayer")) { |
169 |
players.add(args[1]); |
players.add(p2.getName()); |
170 |
} else { |
} else { |
171 |
players.remove(args[1]); |
players.remove(p2.getName()); |
172 |
} |
} |
173 |
|
|
174 |
chest.setModifyPlayers( Util.setToString(players) ); |
chest.setModifyPlayers( Util.setToString(players) ); |
216 |
} else { |
} else { |
217 |
event.setCancelled(true); |
event.setCancelled(true); |
218 |
event.getPlayer().sendMessage("You can't destroy that chest"); |
event.getPlayer().sendMessage("You can't destroy that chest"); |
219 |
|
server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried breaking a chest owned by " + chest.getOwner() ); |
220 |
} |
} |
221 |
} |
} |
222 |
} |
} |
366 |
for (Block b : event.blockList() ) { |
for (Block b : event.blockList() ) { |
367 |
ChestBean chest = chestMap.get( b.getLocation() ); |
ChestBean chest = chestMap.get( b.getLocation() ); |
368 |
if (chest != null) { |
if (chest != null) { |
369 |
|
server.getLogger().info( "[AdvancedChest] Prevented an explosion from destroying chest owned by " + chest.getOwner() ); |
370 |
event.setCancelled( true ); |
event.setCancelled( true ); |
371 |
return; |
return; |
372 |
} |
} |
397 |
return; //chest is opened by it's owner |
return; //chest is opened by it's owner |
398 |
} |
} |
399 |
|
|
400 |
if (chest.getModifyPlayers() != null && chest.getModifyPlayers().length()>0) { |
Set<String> players = Util.stringToSet( chest.getModifyPlayers() ); |
401 |
String modplayers[] = chest.getModifyPlayers().split(","); |
if ( players.contains(player.getName()) ) { |
402 |
for (String p : modplayers) { |
return; //this player is on the whitelist so he may open |
|
if ( player.getName().equals(p) ) { |
|
|
return; //this player is on the whitelist so he may open |
|
|
} |
|
|
} |
|
403 |
} |
} |
404 |
|
|
405 |
|
|
406 |
|
server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried opening a chest owned by " + chest.getOwner() ); |
407 |
player.sendMessage( ChatColor.BLUE + "Sorry but this chest is locked !"); |
player.sendMessage( ChatColor.BLUE + "Sorry but this chest is locked !"); |
408 |
event.setCancelled(true); |
event.setCancelled(true); |
409 |
} |
} |
436 |
Player player = (Player) event.getPlayer(); |
Player player = (Player) event.getPlayer(); |
437 |
if (player.getName().equals(chest.getOwner() )) { |
if (player.getName().equals(chest.getOwner() )) { |
438 |
return; //chest is owned by it's own player |
return; //chest is owned by it's own player |
439 |
} |
} |
440 |
|
|
441 |
|
Set<String> players = Util.stringToSet( chest.getModifyPlayers() ); |
442 |
|
if ( players.contains(player.getName()) ) { |
443 |
|
return; //this player is on the whitelist so he may open |
444 |
|
} |
445 |
|
|
446 |
|
|
447 |
ItemCount contents = countItems( event.getInventory().getContents() ); |
ItemCount contents = countItems( event.getInventory().getContents() ); |