/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1808 by torben, Sun Jun 3 20:16:40 2012 UTC revision 1809 by torben, Sun Jun 3 20:34:42 2012 UTC
# Line 395  public class AdvancedChest  implements L Line 395  public class AdvancedChest  implements L
395                                          return; //chest is opened by it's owner                                          return; //chest is opened by it's owner
396                                  }                                  }
397                                                                    
398                                  if (chest.getModifyPlayers() != null && chest.getModifyPlayers().length()>0) {                                  Set<String> players = Util.stringToSet( chest.getModifyPlayers() );
399                                          String modplayers[] = chest.getModifyPlayers().split(",");                                  if ( players.contains(player.getName()) ) {
400                                          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  
                                                 }  
                                         }  
401                                  }                                  }
402    
403    
404                                                    
405                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");
406                                  event.setCancelled(true);                                  event.setCancelled(true);
# Line 437  public class AdvancedChest  implements L Line 434  public class AdvancedChest  implements L
434                          Player player = (Player) event.getPlayer();                          Player player = (Player) event.getPlayer();
435                          if (player.getName().equals(chest.getOwner() )) {                          if (player.getName().equals(chest.getOwner() )) {
436                                  return; //chest is owned by it's own player                                  return; //chest is owned by it's own player
437                          }                                                }
438                            
439                            Set<String> players = Util.stringToSet( chest.getModifyPlayers() );
440                            if ( players.contains(player.getName()) ) {
441                                    return; //this player is on the whitelist so he may open
442                            }
443                                                    
444                                                    
445                          ItemCount contents = countItems( event.getInventory().getContents() );                                            ItemCount contents = countItems( event.getInventory().getContents() );                  

Legend:
Removed from v.1808  
changed lines
  Added in v.1809

  ViewVC Help
Powered by ViewVC 1.1.20