Option to output player health in json for later web usage.

This commit is contained in:
zeeZ 2011-05-18 15:55:24 +02:00 committed by FrozenCow
parent 7937a64f06
commit 728cd8304a
5 changed files with 14 additions and 5 deletions

View file

@ -44,6 +44,7 @@ class JsonTimerTask extends TimerTask {
long jsonInterval = configuration.getInteger("jsonfile-interval", 1) * 1000;
long current = System.currentTimeMillis();
File outputFile;
boolean showHealth = configuration.getBoolean("health-in-json", false);
//Handles Reading WebChat
if (configuration.getNode("web").getBoolean("allowwebchat", false)) {
@ -98,7 +99,7 @@ class JsonTimerTask extends TimerTask {
for (int i = 0; i < players.length; i++) {
Player p = players[i];
Location pl = p.getLocation();
update.players[i] = new Client.Player(p.getDisplayName(), pl.getWorld().getName(), pl.getX(), pl.getY(), pl.getZ());
update.players[i] = new Client.Player(p.getDisplayName(), pl.getWorld().getName(), pl.getX(), pl.getY(), pl.getZ(), showHealth?p.getHealth():-1);
}
update.updates = mapManager.getWorldUpdates(world.getName(), current - (jsonInterval + 10000));