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