*/
public class PlayerInformation implements NativeCommand {
@Override
public void execute(MessageReceiver caller, String[] args) {
Player subject = null;
if (args.length == 2) {
subject = Canary.getServer().matchPlayer(args[1]);
}
else if (caller instanceof Player) {
subject = (Player) caller;
}
if (subject != null) {
caller.message(TextFormat.GREEN + subject.getName() + "'s info:");
sendData(caller, "First Joined: ", subject.getFirstJoined());
sendData(caller, "Time Played: ", ToolBox.getTimeUntil(subject.getTimePlayed()));
sendData(caller, "Muted: ", subject.isMuted());
sendData(caller, "Prefix: ", subject.getPrefix());
sendData(caller, "IP: ", subject.getIP());
sendData(caller, "Primary Group: ", subject.getGroup().getName());
sendData(caller, "Other Groups: ", subject.getPlayerGroups());
sendData(caller, "Health: ", subject.getHealth());
sendData(caller, "Mode: ", subject.getMode());
sendData(caller, "Food Level: ", subject.getHunger());
sendData(caller, "Food Exhaustion: ", String.format("%.2f", subject.getExhaustionLevel()));
sendData(caller, "XP Level: ", subject.getLevel());
sendData(caller, "XP Total: ", subject.getExperience());
Location l = subject.getLocation();
sendData(caller, "Position: ", String.format("X: %.2f Y: %.2f Z: %.2f Pitch: %.2f Yawn: %.2f", l.getX(), l.getY(), l.getZ(), l.getRotation(), l.getPitch()));
sendData(caller, "World: ", subject.getWorld().getFqName());
Warp home = Canary.warps().getHome(subject.getName());
if (home != null) {
l = home.getLocation();
sendData(caller, "Home: ", String.format("X: %.2f Y: %.2f Z: %.2f", l.getX(), l.getY(), l.getZ()));
}