/[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 1871 by torben, Thu Nov 8 19:47:51 2012 UTC revision 1915 by torben, Fri Jan 18 09:41:46 2013 UTC
# Line 137  public class AdvancedChest  implements L Line 137  public class AdvancedChest  implements L
137                                  addChest(loc, chest);                                  addChest(loc, chest);
138                                  player.sendMessage("Chest is now " + modeStr);                                  player.sendMessage("Chest is now " + modeStr);
139                          } else {                          } else {
140                                    server.getLogger().info( player.getName() + " tried to protect a chest owned by " + chest.getOwner() );
141                                  player.sendMessage("This chest is already protected");                                  player.sendMessage("This chest is already protected");
142                          }                          }
143                          return true;                          return true;
# Line 147  public class AdvancedChest  implements L Line 148  public class AdvancedChest  implements L
148                                  player.sendMessage("This chest is not protected");                                  player.sendMessage("This chest is not protected");
149                                  return true;                                  return true;
150                          }                          }
151                          if (! chest.getOwner().equals( player.getName() ) ) {                          if ( chest.getOwner().equals( player.getName() ) || player.isOp() ) {
152                                    //do nothing
153                            } else {
154                                  player.sendMessage("You can not remove lock from a chest you don't own");                                  player.sendMessage("You can not remove lock from a chest you don't own");
155                                    server.getLogger().info( player.getName() + " tried to remove protection froma chest owned by " + chest.getOwner() );
156                                  return true;                                  return true;
157                          }                          }
158    
# Line 163  public class AdvancedChest  implements L Line 167  public class AdvancedChest  implements L
167                                  player.sendMessage("This chest is not protected");                                  player.sendMessage("This chest is not protected");
168                                  return true;                                  return true;
169                          }                          }
170                          if (! chest.getOwner().equals( player.getName() ) ) {                          if ( chest.getOwner().equals( player.getName() ) || player.isOp() ) {
171                                    //do nothing
172                            } else {
173                                  player.sendMessage("You can not set new owner of a chest you dont own");                                  player.sendMessage("You can not set new owner of a chest you dont own");
174                                    server.getLogger().info( player.getName() + " tried to set owner on a chest owned by " + chest.getOwner() );
175                                  return true;                                  return true;
176                          }                          }
177                          if (args.length != 2) {                          if (args.length != 2) {
# Line 189  public class AdvancedChest  implements L Line 196  public class AdvancedChest  implements L
196                          }                          }
197                          if (! chest.getOwner().equals( player.getName() ) ) {                          if (! chest.getOwner().equals( player.getName() ) ) {
198                                  player.sendMessage("You can not add/remove players from a chest you don't own");                                  player.sendMessage("You can not add/remove players from a chest you don't own");
199                                    server.getLogger().info( player.getName() + " tried to add/remove player on a chest owned by " + chest.getOwner() );
200                                  return true;                                  return true;
201                          }                          }
202                          if (args.length != 2) {                          if (args.length != 2) {
# Line 218  public class AdvancedChest  implements L Line 226  public class AdvancedChest  implements L
226                                  player.sendMessage("This chest is not protected");                                  player.sendMessage("This chest is not protected");
227                                  return true;                                  return true;
228                          }                          }
229                          if (! chest.getOwner().equals( player.getName() ) ) {                          if (! chest.getOwner().equals( player.getName() ) ) {                          
230                                  player.sendMessage("You can not comment a chest you don't own");                                  player.sendMessage("You can not comment a chest you don't own");
231                                    server.getLogger().info( player.getName() + " tried to comment on a chest owned by " + chest.getOwner() );
232                                  return true;                                  return true;
233                          }                          }
234    
# Line 465  public class AdvancedChest  implements L Line 474  public class AdvancedChest  implements L
474                                          return; //chest is opened by it's owner                                          return; //chest is opened by it's owner
475                                  }                                  }
476                                                                    
477                                  Set<String> players = Util.stringToSet( chest.getModifyPlayers() );                                  Set<String> players = chest.getModifyPlayersSet() ;
478                                  if ( players.contains(player.getName()) ) {                                  if ( players.contains(player.getName()) ) {
479                                          return; //this player is on the whitelist so he may open                                          return; //this player is on the whitelist so he may open
480                                  }                                  }
# Line 506  public class AdvancedChest  implements L Line 515  public class AdvancedChest  implements L
515                                  return; //chest is owned by it's own player                                  return; //chest is owned by it's own player
516                          }                          }
517                                                    
518                          Set<String> players = Util.stringToSet( chest.getModifyPlayers() );                          Set<String> players = chest.getModifyPlayersSet();
519                          if ( players.contains(player.getName()) ) {                          if ( players.contains(player.getName()) ) {
520                                  return; //this player is on the whitelist so he may open                                  return; //this player is on the whitelist so he may open
521                          }                          }

Legend:
Removed from v.1871  
changed lines
  Added in v.1915

  ViewVC Help
Powered by ViewVC 1.1.20