Added timestamp support to Update Tiles and Chat.
New web config to handle for jsonfile method Modified webclient to handle timestamps to prevent duplication. Removed duplicate code in JsonTimerTask.java
This commit is contained in:
parent
7e858e39d5
commit
8469b323d3
6 changed files with 18 additions and 9 deletions
|
|
@ -27,19 +27,23 @@ public class Client {
|
|||
public String type = "chat";
|
||||
public String playerName;
|
||||
public String message;
|
||||
public long timestamp;
|
||||
|
||||
public ChatMessage(String playerName, String message) {
|
||||
public ChatMessage(String playerName, String message, long timestamp) {
|
||||
this.playerName = playerName;
|
||||
this.message = message;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Tile {
|
||||
public String type = "tile";
|
||||
public String name;
|
||||
public long timestamp;
|
||||
|
||||
public Tile(String name) {
|
||||
public Tile(String name, long timestamp) {
|
||||
this.name = name;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,6 @@ public class DynmapPlayerListener extends PlayerListener {
|
|||
* Relevant event details
|
||||
*/
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
mgr.pushUpdate(new Client.ChatMessage(event.getPlayer().getName(), event.getMessage()));
|
||||
mgr.pushUpdate(new Client.ChatMessage(event.getPlayer().getName(), event.getMessage(), System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
|
|
@ -37,8 +37,6 @@ class JsonTimerTask extends TimerTask
|
|||
long current = System.currentTimeMillis();
|
||||
|
||||
Client.Update update = new Client.Update();
|
||||
update.timestamp = current;
|
||||
update.servertime = world.getTime();
|
||||
|
||||
update.timestamp = current;
|
||||
update.servertime = world.getTime() % 24000;
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ public class MapManager {
|
|||
|
||||
public boolean render(MapTile tile) {
|
||||
boolean result = tile.getMap().render(tile, getTileFile(tile));
|
||||
pushUpdate(tile.getWorld(), new Client.Tile(tile.getFilename()));
|
||||
pushUpdate(tile.getWorld(), new Client.Tile(tile.getFilename(), System.currentTimeMillis()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue