Add vehicle location to the "ncp inspect" command.

This commit is contained in:
asofold 2013-10-13 22:58:27 +02:00
parent 0d52467fc2
commit 21eaeac5fa

View File

@ -50,7 +50,7 @@ public class InspectCommand extends BaseCommand {
} else { } else {
final StringBuilder builder = new StringBuilder(256); final StringBuilder builder = new StringBuilder(256);
builder.append(player.getName() + c1); 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 ... // TODO: isValid, isDead, isInsideVehicle ...
// Health. // Health.
builder.append(" health=" + f1.format(player.getHealth()) + "/" + f1.format(player.getMaxHealth())); 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, // TODO: is..sneaking,sprinting,blocking,
// Finally the block location. // Finally the block location.
final Location loc = player.getLocation(); 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()); sender.sendMessage(builder.toString());
} }
} }
return true; return true;
} }
private final String locString(Location loc) {
return loc.getWorld().getName() + "/" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ();
}
/* (non-Javadoc) /* (non-Javadoc)
* @see fr.neatmonster.nocheatplus.command.AbstractCommand#onTabComplete(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[]) * @see fr.neatmonster.nocheatplus.command.AbstractCommand#onTabComplete(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])