mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-05 19:07:32 +02:00
Implement fix better
This commit is contained in:
parent
042a0b5ba6
commit
c0f61381b7
@ -728,11 +728,13 @@ public class NPCCommands {
|
|||||||
flags = "t",
|
flags = "t",
|
||||||
permission = "npc.vulnerable")
|
permission = "npc.vulnerable")
|
||||||
public void vulnerable(CommandContext args, CommandSender sender, NPC npc) {
|
public void vulnerable(CommandContext args, CommandSender sender, NPC npc) {
|
||||||
boolean vulnerable = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
boolean vulnerable = !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||||
if (args.hasFlag('t'))
|
if (args.hasFlag('t')) {
|
||||||
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
|
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, vulnerable);
|
||||||
else
|
} else {
|
||||||
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, !vulnerable);
|
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;
|
String key = vulnerable ? Messages.VULNERABLE_SET : Messages.VULNERABLE_STOPPED;
|
||||||
Messaging.sendTr(sender, key, npc.getName());
|
Messaging.sendTr(sender, key, npc.getName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user