diff --git a/main/src/main/java/net/citizensnpcs/Settings.java b/main/src/main/java/net/citizensnpcs/Settings.java index f1edb299f..358454db5 100644 --- a/main/src/main/java/net/citizensnpcs/Settings.java +++ b/main/src/main/java/net/citizensnpcs/Settings.java @@ -241,7 +241,7 @@ public class Settings { STORAGE_FILE("storage.file", "saves.yml"), STORAGE_TYPE("Although technically Citizens can use NBT storage, it is not well tested and YAML is recommended", "storage.type", "yaml"), - STUCK_ACTION( + DEFAULT_STUCK_ACTION( "The default action to perform when NPCs are unable to find a path or are stuck in the same block for too long. Supported options are: 'teleport to destination' or 'none'", "npc.pathfinding.default-stuck-action", "teleport to destination"), TABLIST_REMOVE_PACKET_DELAY("How long to wait before sending the tablist remove packet", diff --git a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java index a28d82466..60b3f0ad7 100644 --- a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -1566,12 +1566,16 @@ public class NPCCommands { npc.data().setPersistent(key, metadata); } } - Messaging.sendTr(sender, Messages.METADATA_SET, key, args.getString(3)); + Messaging.sendTr(sender, Messages.METADATA_SET, enumKey != null ? enumKey : key, args.getString(3)); } else if (command.equals("get")) { if (args.argsLength() != 3) { throw new CommandException(); } - sender.sendMessage(enumKey != null ? npc.data().get(enumKey, "null") : npc.data().get(key, "null")); + Object data = enumKey != null ? npc.data().get(enumKey) : npc.data().get(key); + if (data == null) { + data = "null"; + } + sender.sendMessage(data.toString()); } else if (command.equals("remove")) { if (args.argsLength() != 3) { throw new CommandException(); @@ -1581,7 +1585,7 @@ public class NPCCommands { } else { npc.data().remove(key); } - Messaging.sendTr(sender, Messages.METADATA_UNSET, key, npc.getName()); + Messaging.sendTr(sender, Messages.METADATA_UNSET, enumKey != null ? enumKey : key, npc.getName()); } else { throw new CommandUsageException(); } diff --git a/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java b/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java index 16be66f47..0b6543699 100644 --- a/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java @@ -66,9 +66,9 @@ public class WaypointCommands { permission = "citizens.waypoints.disableteleport") public void disableTeleporting(CommandContext args, CommandSender sender, NPC npc) throws CommandException { npc.data().setPersistent(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, !npc.data() - .get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, !Setting.STUCK_ACTION.asString().contains("teleport"))); + .get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, !Setting.DEFAULT_STUCK_ACTION.asString().contains("teleport"))); if (npc.data().get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, - !Setting.STUCK_ACTION.asString().contains("teleport"))) { + !Setting.DEFAULT_STUCK_ACTION.asString().contains("teleport"))) { npc.getNavigator().getDefaultParameters().stuckAction(null); Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED, npc.getName()); } else { 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 31f4daa93..99ba576ba 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -68,7 +68,7 @@ public class CitizensNavigator implements Navigator, Runnable { public CitizensNavigator(NPC npc) { this.npc = npc; if (npc.data().get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, - !Setting.STUCK_ACTION.asString().contains("teleport"))) { + !Setting.DEFAULT_STUCK_ACTION.asString().contains("teleport"))) { defaultParams.stuckAction(null); } defaultParams.examiner(new SwimmingExaminer(npc)); diff --git a/main/src/main/java/net/citizensnpcs/trait/LookClose.java b/main/src/main/java/net/citizensnpcs/trait/LookClose.java index 7a2a2f0f9..05ae49c0c 100644 --- a/main/src/main/java/net/citizensnpcs/trait/LookClose.java +++ b/main/src/main/java/net/citizensnpcs/trait/LookClose.java @@ -267,8 +267,10 @@ public class LookClose extends Trait implements Toggleable { @Override public void run() { - if (!npc.isSpawned()) + if (!npc.isSpawned()) { + lookingAt = null; return; + } if (enableRandomLook) { if (!npc.getNavigator().isNavigating() && lookingAt == null && t <= 0) { @@ -278,11 +280,15 @@ public class LookClose extends Trait implements Toggleable { } t--; - if (!enabled) + if (!enabled) { + lookingAt = null; return; + } - if (npc.getNavigator().isNavigating() && disableWhileNavigating()) + if (npc.getNavigator().isNavigating() && disableWhileNavigating()) { + lookingAt = null; return; + } npc.getEntity().getLocation(NPC_LOCATION); findNewTarget();