Implement fix better

This commit is contained in:
fullwall 2012-10-12 21:40:38 +08:00
parent 3d91f0d01b
commit a5253da44e
1 changed files with 7 additions and 5 deletions

View File

@ -728,11 +728,13 @@ public class NPCCommands {
flags = "t",
permission = "npc.vulnerable")
public void vulnerable(CommandContext args, CommandSender sender, NPC npc) {
boolean vulnerable = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (args.hasFlag('t'))
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
else
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
boolean vulnerable = !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
if (args.hasFlag('t')) {
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, vulnerable);
} else {
vulnerable = !npc.data().getPersistent(NPC.DEFAULT_PROTECTED_METADATA, true);
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, vulnerable);
}
String key = vulnerable ? Messages.VULNERABLE_SET : Messages.VULNERABLE_STOPPED;
Messaging.sendTr(sender, key, npc.getName());
}