From ae2ce0c7d60e0ae145a34dca7d6fea18445e217f Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 3 Aug 2024 21:36:25 +0200 Subject: [PATCH] Clarifies a message --- .../blacksmithvisuals/command/SetNPCPositionCommand.java | 2 +- .../blacksmithvisuals/listener/BlacksmithListener.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/knarcraft/blacksmithvisuals/command/SetNPCPositionCommand.java b/src/main/java/net/knarcraft/blacksmithvisuals/command/SetNPCPositionCommand.java index 5aab070..f2625e3 100644 --- a/src/main/java/net/knarcraft/blacksmithvisuals/command/SetNPCPositionCommand.java +++ b/src/main/java/net/knarcraft/blacksmithvisuals/command/SetNPCPositionCommand.java @@ -30,7 +30,7 @@ public class SetNPCPositionCommand implements TabExecutor { @NotNull String[] arguments) { NPC npc = CitizensAPI.getDefaultNPCSelector().getSelected(commandSender); if (npc == null || (!npc.hasTrait(BlacksmithTrait.class) && !npc.hasTrait(ScrapperTrait.class))) { - commandSender.sendMessage("You must select an NPC before executing this command"); + commandSender.sendMessage("You must select a scrapper or blacksmith NPC before executing this command"); return true; } diff --git a/src/main/java/net/knarcraft/blacksmithvisuals/listener/BlacksmithListener.java b/src/main/java/net/knarcraft/blacksmithvisuals/listener/BlacksmithListener.java index e709134..5ab082e 100644 --- a/src/main/java/net/knarcraft/blacksmithvisuals/listener/BlacksmithListener.java +++ b/src/main/java/net/knarcraft/blacksmithvisuals/listener/BlacksmithListener.java @@ -99,6 +99,7 @@ public class BlacksmithListener implements Listener { BlacksmithVisuals instance = BlacksmithVisuals.getInstance(); BukkitScheduler scheduler = Bukkit.getScheduler(); NPC npc = event.getNpc(); + long delay = moveToWorkingPosition(npc, NPCPosition.getFromMaterial(event.getCraftingStation())); long finishTime = event.getActionDurationTicks() - (2 * delay); @@ -128,10 +129,10 @@ public class BlacksmithListener implements Listener { npc.getName() + " is unreachable!"); return; } - npc.getNavigator().setTarget(targetLocation); Bukkit.getScheduler().scheduleSyncDelayedTask(BlacksmithVisuals.getInstance(), () -> npc.getEntity().teleport(targetLocation), getWalkTime(npc.getEntity().getLocation(), targetLocation)); + npc.getNavigator().setTarget(targetLocation); } /**