Fixed web-to-mc chat for JsonFile?
This commit is contained in:
parent
1f79d2bcb8
commit
90e9c9f640
1 changed files with 4 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
|
||||||
protected TimerTask task;
|
protected TimerTask task;
|
||||||
protected Timer timer;
|
protected Timer timer;
|
||||||
protected long jsonInterval;
|
protected long jsonInterval;
|
||||||
|
protected long currentTimestamp = 0;
|
||||||
protected long lastTimestamp = 0;
|
protected long lastTimestamp = 0;
|
||||||
protected JSONParser parser = new JSONParser();
|
protected JSONParser parser = new JSONParser();
|
||||||
public JsonFileClientUpdateComponent(final DynmapPlugin plugin, final ConfigurationNode configuration) {
|
public JsonFileClientUpdateComponent(final DynmapPlugin plugin, final ConfigurationNode configuration) {
|
||||||
|
|
@ -33,10 +34,12 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
|
||||||
task = new TimerTask() {
|
task = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
currentTimestamp = System.currentTimeMillis();
|
||||||
writeUpdates();
|
writeUpdates();
|
||||||
if (allowwebchat) {
|
if (allowwebchat) {
|
||||||
handleWebChat();
|
handleWebChat();
|
||||||
}
|
}
|
||||||
|
lastTimestamp = currentTimestamp;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
|
|
@ -82,16 +85,14 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeUpdates() {
|
protected void writeUpdates() {
|
||||||
long current = System.currentTimeMillis();
|
|
||||||
File outputFile;
|
File outputFile;
|
||||||
|
|
||||||
//Handles Updates
|
//Handles Updates
|
||||||
for (DynmapWorld dynmapWorld : plugin.mapManager.worlds.values()) {
|
for (DynmapWorld dynmapWorld : plugin.mapManager.worlds.values()) {
|
||||||
World world = dynmapWorld.world;
|
World world = dynmapWorld.world;
|
||||||
current = System.currentTimeMillis();
|
|
||||||
|
|
||||||
JSONObject update = new JSONObject();
|
JSONObject update = new JSONObject();
|
||||||
update.put("timestamp", current);
|
update.put("timestamp", currentTimestamp);
|
||||||
ClientUpdateEvent clientUpdate = new ClientUpdateEvent(lastTimestamp, dynmapWorld, update);
|
ClientUpdateEvent clientUpdate = new ClientUpdateEvent(lastTimestamp, dynmapWorld, update);
|
||||||
plugin.events.trigger("buildclientupdate", clientUpdate);
|
plugin.events.trigger("buildclientupdate", clientUpdate);
|
||||||
|
|
||||||
|
|
@ -107,7 +108,6 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
|
||||||
}
|
}
|
||||||
plugin.events.<ClientUpdateEvent>trigger("clientupdatewritten", clientUpdate);
|
plugin.events.<ClientUpdateEvent>trigger("clientupdatewritten", clientUpdate);
|
||||||
}
|
}
|
||||||
lastTimestamp = System.currentTimeMillis();
|
|
||||||
|
|
||||||
plugin.events.<Object>trigger("clientupdateswritten", null);
|
plugin.events.<Object>trigger("clientupdateswritten", null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue