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 |
|
|
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 |
} |
} |
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 { |
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) { |
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 ); |