From 79f048fe0c0de4ba36440fa90e76d776b48de349 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 26 Dec 2020 17:01:27 +0800 Subject: [PATCH] Implement new metadata for /wp disableteleport --- .../main/java/net/citizensnpcs/commands/WaypointCommands.java | 1 + .../main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java b/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java index 3a1c84425..5dce3c4cc 100644 --- a/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java @@ -59,6 +59,7 @@ public class WaypointCommands { permission = "citizens.waypoints.disableteleport") public void disableTeleporting(CommandContext args, CommandSender sender, NPC npc) throws CommandException { npc.getNavigator().getDefaultParameters().stuckAction(null); + npc.data().setPersistent(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, true); Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED); } diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java b/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java index d49371c40..7ab6432d7 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -56,6 +56,9 @@ public class CitizensNavigator implements Navigator, Runnable { public CitizensNavigator(NPC npc) { this.npc = npc; + if (npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false)) { + defaultParams.stuckAction(null); + } defaultParams.examiner(new SwimmingExaminer(npc)); }