mirror of https://github.com/webbukkit/dynmap.git
Fixed time being reported of the correct world.
This commit is contained in:
parent
db9ced3394
commit
a81665d38d
|
@ -84,7 +84,7 @@ public class DynmapPlugin extends JavaPlugin {
|
|||
webServer = new HttpServer(bindAddress, port);
|
||||
webServer.handlers.put("/", new FilesystemHandler(getFile(configuration.getString("webpath", "web"))));
|
||||
webServer.handlers.put("/tiles/", new FilesystemHandler(tilesDirectory));
|
||||
webServer.handlers.put("/up/", new ClientUpdateHandler(mapManager, playerList, getWorld()));
|
||||
webServer.handlers.put("/up/", new ClientUpdateHandler(mapManager, playerList, getServer()));
|
||||
webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map<?, ?>) configuration.getProperty("web")));
|
||||
|
||||
try {
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.dynmap.Client;
|
||||
|
@ -19,12 +20,12 @@ import org.dynmap.web.Json;
|
|||
public class ClientUpdateHandler implements HttpHandler {
|
||||
private MapManager mapManager;
|
||||
private PlayerList playerList;
|
||||
private World world;
|
||||
private Server server;
|
||||
|
||||
public ClientUpdateHandler(MapManager mapManager, PlayerList playerList, World world) {
|
||||
public ClientUpdateHandler(MapManager mapManager, PlayerList playerList, Server server) {
|
||||
this.mapManager = mapManager;
|
||||
this.playerList = playerList;
|
||||
this.world = world;
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
Pattern updatePathPattern = Pattern.compile("world/([a-zA-Z0-9_]+)/([0-9]*)");
|
||||
|
@ -39,6 +40,10 @@ public class ClientUpdateHandler implements HttpHandler {
|
|||
String worldName = match.group(1);
|
||||
String timeKey = match.group(2);
|
||||
|
||||
World world = server.getWorld(worldName);
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
long current = System.currentTimeMillis();
|
||||
long since = 0;
|
||||
|
||||
|
@ -74,6 +79,5 @@ public class ClientUpdateHandler implements HttpHandler {
|
|||
response.fields.put("Content-Length", Integer.toString(bytes.length));
|
||||
BufferedOutputStream out = new BufferedOutputStream(response.getBody());
|
||||
out.write(bytes);
|
||||
out.flush();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue