Pretty print location in /npc moveto

This commit is contained in:
fullwall 2020-03-31 21:44:04 +08:00
parent 8779062a82
commit a535cea8bc
2 changed files with 6 additions and 1 deletions

View File

@ -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(

View File

@ -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) {