mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 05:05:16 +01:00
Updated JsonTimerTask.java to be Multi-World Compatible
This commit is contained in:
parent
f7dbc89ab4
commit
3c1bde1092
@ -32,21 +32,29 @@ class JsonTimerTask extends TimerTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
for(World world : this.server.getWorlds())
|
||||||
|
{
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
|
|
||||||
Client.Update update = new Client.Update();
|
Client.Update update = new Client.Update();
|
||||||
update.timestamp = current;
|
update.timestamp = current;
|
||||||
update.servertime = ((World)this.server.getWorlds().get(0)).getTime();
|
update.servertime = world.getTime();
|
||||||
|
|
||||||
Player[] players = this.playerList.getVisiblePlayers();
|
update.timestamp = current;
|
||||||
|
update.servertime = world.getTime() % 24000;
|
||||||
|
|
||||||
|
|
||||||
|
Player[] players = playerList.getVisiblePlayers();
|
||||||
update.players = new Client.Player[players.length];
|
update.players = new Client.Player[players.length];
|
||||||
for(int i=0;i<players.length;i++) {
|
for(int i=0;i<players.length;i++) {
|
||||||
Player p = players[i];
|
Player p = players[i];
|
||||||
update.players[i] = new Client.Player(p.getName(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
|
Location pl = p.getLocation();
|
||||||
|
update.players[i] = new Client.Player(p.getName(), pl.getWorld().getName(), pl.getX(), pl.getY(), pl.getZ());
|
||||||
}
|
}
|
||||||
update.updates = this.mapManager.updateQueue.getUpdatedObjects(current - 10L);
|
|
||||||
|
|
||||||
File webpath = new File(this.configuration.getString("webpath", "web"), "dynmap.json");
|
update.updates = mapManager.getWorldUpdates(world.getName(), current - 10L);
|
||||||
|
|
||||||
|
File webpath = new File(this.configuration.getString("webpath", "web"), "dynmap_"+world.getName()+".json");
|
||||||
File outputFile;
|
File outputFile;
|
||||||
if (webpath.isAbsolute())
|
if (webpath.isAbsolute())
|
||||||
outputFile = webpath;
|
outputFile = webpath;
|
||||||
@ -69,3 +77,4 @@ class JsonTimerTask extends TimerTask
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user