diff --git a/api/src/main/java/lol/pyr/znpcsplus/util/ZLocation.java b/api/src/main/java/lol/pyr/znpcsplus/util/ZLocation.java index ecc16c7..b0b2006 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/util/ZLocation.java +++ b/api/src/main/java/lol/pyr/znpcsplus/util/ZLocation.java @@ -28,14 +28,26 @@ public class ZLocation { return this.x; } + public int getBlockX() { + return (int) getX(); + } + public double getY() { return this.y; } + public int getBlockY() { + return (int) getY(); + } + public double getZ() { return this.z; } + public int getBlockZ() { + return (int) getZ(); + } + public float getYaw() { return this.yaw; } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java index 825c202..1fc604a 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java @@ -5,11 +5,11 @@ import lol.pyr.director.adventure.command.CommandHandler; import lol.pyr.director.common.command.CommandExecutionException; import lol.pyr.znpcsplus.npc.NpcImpl; import lol.pyr.znpcsplus.npc.NpcRegistryImpl; +import lol.pyr.znpcsplus.util.ZLocation; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.NamedTextColor; -import org.bukkit.Location; public class ListCommand implements CommandHandler { @Override @@ -17,7 +17,7 @@ public class ListCommand implements CommandHandler { TextComponent.Builder component = Component.text("Npc's:\n").color(NamedTextColor.GOLD).toBuilder(); for (String id : NpcRegistryImpl.get().modifiableIds()) { NpcImpl npc = NpcRegistryImpl.get().get(id).getNpc(); - Location location = npc.getLocation().toBukkitLocation(npc.getWorld()); + ZLocation location = npc.getLocation(); component.append(Component.text("ID: " + id, NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) .append(Component.text("Type: ", NamedTextColor.GREEN)) @@ -26,7 +26,7 @@ public class ListCommand implements CommandHandler { .append(Component.text("Name: ", NamedTextColor.GREEN)) .append(npc.getHologram().getLine(0).color(NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) - .append(Component.text("Location: " + npc.getWorld().getName() + " X:" + location.getBlockX() + " Y:" + location.getBlockY() + " Z:" + location.getBlockZ(), NamedTextColor.GREEN)) + .append(Component.text("Location: " + npc.getWorldName() + " X:" + location.getBlockX() + " Y:" + location.getBlockY() + " Z:" + location.getBlockZ(), NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) .append(Component.text("[TELEPORT]", NamedTextColor.DARK_GREEN).clickEvent(ClickEvent.runCommand("/npc teleport " + id))) .append(Component.text("\n", NamedTextColor.GRAY));