From 21eaeac5fabd4e0fbeaacc5bbbf9316b596ffe07 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 13 Oct 2013 22:58:27 +0200 Subject: [PATCH] Add vehicle location to the "ncp inspect" command. --- .../nocheatplus/command/admin/InspectCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/command/admin/InspectCommand.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/command/admin/InspectCommand.java index eaec6788..39a56265 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/command/admin/InspectCommand.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/command/admin/InspectCommand.java @@ -50,7 +50,7 @@ public class InspectCommand extends BaseCommand { } else { final StringBuilder builder = new StringBuilder(256); builder.append(player.getName() + c1); - builder.append(" (" + (player.isOnline() ? "online" : "offline") + (player.isDead() ? ",dead" : "") + (player.isValid() ? "" : ",invalid") + (player.isInsideVehicle() ? (",vehicle=" + player.getVehicle().getType()) : "")+ "):"); + builder.append(" (" + (player.isOnline() ? "online" : "offline") + (player.isDead() ? ",dead" : "") + (player.isValid() ? "" : ",invalid") + (player.isInsideVehicle() ? (",vehicle=" + player.getVehicle().getType() + "@" + locString(player.getVehicle().getLocation())) : "")+ "):"); // TODO: isValid, isDead, isInsideVehicle ... // Health. builder.append(" health=" + f1.format(player.getHealth()) + "/" + f1.format(player.getMaxHealth())); @@ -81,12 +81,16 @@ public class InspectCommand extends BaseCommand { // TODO: is..sneaking,sprinting,blocking, // Finally the block location. final Location loc = player.getLocation(); - builder.append(" pos=" + loc.getWorld().getName() + "/" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ()); + builder.append(" pos=" + locString(loc)); sender.sendMessage(builder.toString()); } } return true; } + + private final String locString(Location loc) { + return loc.getWorld().getName() + "/" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ(); + } /* (non-Javadoc) * @see fr.neatmonster.nocheatplus.command.AbstractCommand#onTabComplete(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])