/[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 1813 by torben, Thu Jun 28 10:19:26 2012 UTC revision 1854 by torben, Tue Oct 2 18:39:29 2012 UTC
# Line 76  public class AdvancedChest  implements L Line 76  public class AdvancedChest  implements L
76                                    
77                  if (args.length == 0) {                  if (args.length == 0) {
78                          player.sendMessage("Usage:");                          player.sendMessage("Usage:");
79                          player.sendMessage("/chest (status|lock|snitch|remove|addplayer|removeplayer) [player]");                          player.sendMessage("/chest (status|lock|snitch|remove|addplayer|removeplayer|setowner) [player]");
80                          return true;                          return true;
81                  }                  }
82                                    
# 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;
156                    }
157    
158                    if (cmd.equals("setowner")) {
159                            if (chest == null) {
160                                    player.sendMessage("This chest is not protected");
161                                    return true;
162                            }
163                            if (! chest.getOwner().equals( player.getName() ) ) {
164                                    player.sendMessage("You can not set new owner of a chest you dont own");
165                                    return true;
166                            }
167                            if (args.length != 2) {
168                                    player.sendMessage("You need to specify which player should own this chest");
169                                    return true;
170                            }
171                            OfflinePlayer p2 = server.getOfflinePlayer(args[1]);
172                            if ( p2.hasPlayedBefore() == false && p2.isOnline() == false) {
173                                    player.sendMessage("Unknown user: " + args[1] );
174                                    return true;
175                          }                          }
176                            chest.setOwner( p2.getName() );
177                            plugin.getDatabase().save( chest );
178                            player.sendMessage("ok");
179                          return true;                          return true;
180                  }                  }
181                                    
# Line 154  public class AdvancedChest  implements L Line 184  public class AdvancedChest  implements L
184                                  player.sendMessage("This chest is not protected");                                  player.sendMessage("This chest is not protected");
185                                  return true;                                  return true;
186                          }                          }
187                            if (! chest.getOwner().equals( player.getName() ) ) {
188                                    player.sendMessage("You can not add/remove players from a chest you don't own");
189                                    return true;
190                            }
191                          if (args.length != 2) {                          if (args.length != 2) {
192                                  player.sendMessage("You need to specify which player to add or remove");                                  player.sendMessage("You need to specify which player to add or remove");
193                                  return true;                                  return true;

Legend:
Removed from v.1813  
changed lines
  Added in v.1854

  ViewVC Help
Powered by ViewVC 1.1.20