/[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 1868 by torben, Mon Nov 5 21:46:57 2012 UTC revision 1869 by torben, Tue Nov 6 16:49:06 2012 UTC
# Line 77  public class AdvancedChest  implements L Line 77  public class AdvancedChest  implements L
77                                    
78                  if (args.length == 0) {                  if (args.length == 0) {
79                          player.sendMessage("Usage:");                          player.sendMessage("Usage:");
80                          player.sendMessage("/chest (status|lock|snitch|remove|addplayer|removeplayer|setowner) [player]");                          player.sendMessage("/chest (status|lock|snitch|remove|addplayer|removeplayer|setowner|comment) [player]");
81                          return true;                          return true;
82                  }                  }
83                                    
# Line 111  public class AdvancedChest  implements L Line 111  public class AdvancedChest  implements L
111                                                                    
112                                  player.sendMessage(ChatColor.GREEN + "Chest is  a " + mode + " chest owned by " + chest.getOwner());                                  player.sendMessage(ChatColor.GREEN + "Chest is  a " + mode + " chest owned by " + chest.getOwner());
113                                  player.sendMessage(ChatColor.GREEN + "Allowed players: " + chest.getModifyPlayers() );                                  player.sendMessage(ChatColor.GREEN + "Allowed players: " + chest.getModifyPlayers() );
114                                    player.sendMessage(ChatColor.GREEN + "Comment: " + chest.getComment() );
115                          } else {                          } else {
116                                  player.sendMessage(ChatColor.GREEN + "The chest is not protected");                                  player.sendMessage(ChatColor.GREEN + "The chest is not protected");
117                          }                          }
# Line 132  public class AdvancedChest  implements L Line 133  public class AdvancedChest  implements L
133                                          modeStr = "snitching";                                          modeStr = "snitching";
134                                  }                                  }
135                                  chest.setModifyPlayers("");                                  chest.setModifyPlayers("");
136                                    chest.setComment("");
137                                  addChest(loc, chest);                                  addChest(loc, chest);
138                                  player.sendMessage("Chest is now " + modeStr);                                  player.sendMessage("Chest is now " + modeStr);
139                          } else {                          } else {
# Line 211  public class AdvancedChest  implements L Line 213  public class AdvancedChest  implements L
213                          player.sendMessage("ok");                          player.sendMessage("ok");
214                          return true;                          return true;
215                  }                  }
216                    if (cmd.equals("comment")) {    
217                            if (chest == null) {
218                                    player.sendMessage("This chest is not protected");
219                                    return true;
220                            }
221                            if (! chest.getOwner().equals( player.getName() ) ) {
222                                    player.sendMessage("You can not comment a chest you don't own");
223                                    return true;
224                            }
225    
226                            StringBuilder sb = new StringBuilder();
227                            for (int i=1; i<args.length; i++) {
228                                    sb.append(args[i]).append(" ");
229                            }
230                            String comment = sb.toString().trim();
231    
232                            chest.setComment( comment );
233                            plugin.getDatabase().save( chest );
234                            player.sendMessage("Comment set");
235    
236                            return true;
237                    }
238                                    
239                  /*                  /*
240                  if (chest != null) {                  if (chest != null) {
# Line 488  public class AdvancedChest  implements L Line 512  public class AdvancedChest  implements L
512                          }                          }
513                                                    
514                                                    
515                            //server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " opened a snitching chest owned by " + chest.getOwner() );
516    
517                          ItemCount contents = countItems( event.getInventory().getContents() );                                            ItemCount contents = countItems( event.getInventory().getContents() );                  
518                                                    
519                          contentMap.put(player.getName(), contents );                          contentMap.put(player.getName(), contents );

Legend:
Removed from v.1868  
changed lines
  Added in v.1869

  ViewVC Help
Powered by ViewVC 1.1.20