/[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 1809 by torben, Sun Jun 3 20:34:42 2012 UTC revision 1853 by torben, Tue Oct 2 16:40:56 2012 UTC
# Line 140  public class AdvancedChest  implements L Line 140  public class AdvancedChest  implements L
140                  }                  }
141                                    
142                  if (cmd.equals("remove")) {                  if (cmd.equals("remove")) {
143                          if (chest != null) {                          if (chest == null) {
144                                  player.sendMessage("[LockedChest] Removing protection from chest");                                  player.sendMessage("This chest is not protected");
145                                  removeChest(loc);                                                                return true;
146                          } else {                          }
147                                  player.sendMessage("This chest is not protected");                                if (! chest.getOwner().equals( player.getName() ) ) {
148                                    player.sendMessage("You can not remove lock from a chest you don't own");
149                                    return true;
150                          }                          }
151    
152                            player.sendMessage("[LockedChest] Removing protection from chest");
153                            removeChest(loc);                              
154    
155                          return true;                          return true;
156                  }                  }
157                                    
# Line 154  public class AdvancedChest  implements L Line 160  public class AdvancedChest  implements L
160                                  player.sendMessage("This chest is not protected");                                  player.sendMessage("This chest is not protected");
161                                  return true;                                  return true;
162                          }                          }
163                            if (! chest.getOwner().equals( player.getName() ) ) {
164                                    player.sendMessage("You can not add/remove players from a chest you don't own");
165                                    return true;
166                            }
167                          if (args.length != 2) {                          if (args.length != 2) {
168                                  player.sendMessage("You need to specify which player to add or remove");                                  player.sendMessage("You need to specify which player to add or remove");
169                                  return true;                                  return true;
# Line 216  public class AdvancedChest  implements L Line 226  public class AdvancedChest  implements L
226                          } else {                          } else {
227                                  event.setCancelled(true);                                  event.setCancelled(true);
228                                  event.getPlayer().sendMessage("You can't destroy that chest");                                  event.getPlayer().sendMessage("You can't destroy that chest");
229                                    server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried breaking a chest owned by " + chest.getOwner() );
230                          }                          }
231                  }                  }
232          }          }
# Line 264  public class AdvancedChest  implements L Line 275  public class AdvancedChest  implements L
275                    
276          void loadChests() {                      void loadChests() {            
277                  int count = loadChestsWorker();                  int count = loadChestsWorker();
278                  plugin.getLogger().info("[AdvancedChest] loaded " + count + " chests");                  server.getLogger().info("[AdvancedChest] loaded " + count + " chests");
279          }          }
280                    
281                    
# Line 365  public class AdvancedChest  implements L Line 376  public class AdvancedChest  implements L
376                  for (Block b : event.blockList() ) {                  for (Block b : event.blockList() ) {
377                          ChestBean chest = chestMap.get( b.getLocation() );                          ChestBean chest = chestMap.get( b.getLocation() );
378                          if (chest != null) {                          if (chest != null) {
379                                    server.getLogger().info( "[AdvancedChest] Prevented an explosion from destroying chest owned by " + chest.getOwner() );
380                                  event.setCancelled( true );                                  event.setCancelled( true );
381                                  return;                                  return;
382                          }                          }
# Line 401  public class AdvancedChest  implements L Line 413  public class AdvancedChest  implements L
413                                  }                                  }
414    
415    
416                                                            server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried opening a chest owned by " + chest.getOwner() );
417                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");
418                                  event.setCancelled(true);                                  event.setCancelled(true);
419                          }                          }
# Line 511  public class AdvancedChest  implements L Line 523  public class AdvancedChest  implements L
523                                          }                                          }
524                                                                    
525                                                                    
526                                          plugin.getLogger().info(msg);                                          server.getLogger().info( "[AdvancedChest]" + msg);
527                                          plugin.getMessageWrapper().sendMessage("system", owner, msg);                                          plugin.getMessageWrapper().sendMessage("system", owner, msg);
528                                  }                                  }
529                                                                    

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

  ViewVC Help
Powered by ViewVC 1.1.20