From a535cea8bc8456e1b101ff04f18f7fc44bf85185 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 31 Mar 2020 21:44:04 +0800 Subject: [PATCH] Pretty print location in /npc moveto --- .../src/main/java/net/citizensnpcs/commands/NPCCommands.java | 2 +- main/src/main/java/net/citizensnpcs/util/Util.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java index bdd2f1441..cba7a180b 100644 --- a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -1088,7 +1088,7 @@ public class NPCCommands { npc.teleport(to, TeleportCause.COMMAND); NMS.look(npc.getEntity(), to.getYaw(), to.getPitch()); - Messaging.sendTr(sender, Messages.MOVETO_TELEPORTED, npc.getName(), to); + Messaging.sendTr(sender, Messages.MOVETO_TELEPORTED, npc.getName(), Util.prettyPrintLocation(to)); } @Command( diff --git a/main/src/main/java/net/citizensnpcs/util/Util.java b/main/src/main/java/net/citizensnpcs/util/Util.java index 3b92610dc..6716d9076 100644 --- a/main/src/main/java/net/citizensnpcs/util/Util.java +++ b/main/src/main/java/net/citizensnpcs/util/Util.java @@ -217,6 +217,11 @@ public class Util { return e.name().toLowerCase().replace('_', ' '); } + public static String prettyPrintLocation(Location to) { + return String.format("%s at %d, %d, %d (%d, %d)", to.getWorld().getName(), to.getBlockX(), to.getBlockY(), + to.getBlockZ(), (int) to.getYaw(), (int) to.getPitch()); + } + public static String[] splitPlayerName(String coloredName) { String name = coloredName, prefix = null, suffix = null; if (coloredName.length() > 16) {