Fix config hashcode inconsistency on world loads (UI reload loop in JSON mode)

This commit is contained in:
Mike Primm 2011-12-09 12:21:11 +08:00 committed by mikeprimm
parent 6a86b81417
commit aea2d29c98
2 changed files with 5 additions and 1 deletions

View File

@ -665,8 +665,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
@Override
public void onWorldLoad(WorldLoadEvent event) {
mapManager.activateWorld(event.getWorld());
updateConfigHashcode();
mapManager.activateWorld(event.getWorld());
}
};

View File

@ -30,6 +30,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
private HashMap<String,String> useralias = new HashMap<String,String>();
private int aliasindex = 1;
private long last_confighash;
private Charset cs_utf8 = Charset.forName("UTF-8");
public JsonFileClientUpdateComponent(final DynmapPlugin plugin, final ConfigurationNode configuration) {
@ -41,6 +42,8 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
@Override
public void run() {
currentTimestamp = System.currentTimeMillis();
if(last_confighash != plugin.getConfigHashcode())
writeConfiguration();
writeUpdates();
if (allowwebchat) {
handleWebChat();
@ -89,6 +92,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
plugin.events.trigger("buildclientconfiguration", clientConfiguration);
outputFile = getStandaloneFile("dynmap_config.json");
outputTempFile = getStandaloneFile("dynmap_config.json.new");
last_confighash = plugin.getConfigHashcode();
int retrycnt = 0;
boolean done = false;