Try to debug unreqwuired .changed calls
This commit is contained in:
parent
17526c3f5f
commit
84104fa03a
@ -259,6 +259,14 @@ public class MassiveCore extends MassivePlugin
|
||||
// Delete Files (at once and additionally after all plugins loaded)
|
||||
MassiveCoreTaskDeleteFiles.get().run();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, MassiveCoreTaskDeleteFiles.get());
|
||||
|
||||
// Uneccessary call of .changed() for debug
|
||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MassiveCoreMConf.get().changed();
|
||||
}
|
||||
}, 200L);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,6 +133,9 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
||||
@EditorType(TypeBooleanOn.class)
|
||||
public boolean warnOnLocalAlter = false;
|
||||
|
||||
@EditorType(TypeBooleanOn.class)
|
||||
public boolean advancedLocalPollingDebug = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CLEAN
|
||||
// -------------------------------------------- //
|
||||
|
@ -9,7 +9,6 @@ import com.massivecraft.massivecore.comparator.ComparatorNaturalOrder;
|
||||
import com.massivecraft.massivecore.mixin.MixinModification;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.ReflectionUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import com.massivecraft.massivecore.xlib.gson.Gson;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
||||
@ -556,6 +555,12 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
break;
|
||||
}
|
||||
|
||||
E entity = this.getFixed(id);
|
||||
if (entity != null)
|
||||
{
|
||||
entity.setLastStackTraceChanged(null);
|
||||
}
|
||||
|
||||
return modification;
|
||||
}
|
||||
|
||||
@ -595,7 +600,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
|
||||
private void checkActuallyModifiedFixed(String id)
|
||||
{
|
||||
if (!ConfServer.localPollingEnabled || !MassiveCoreMConf.get().warnOnLocalAlter) return;
|
||||
if (!MStore.isLocalPollingDebugEnabled()) return;
|
||||
|
||||
E entity = this.getFixed(id);
|
||||
boolean modified = this.examineHasLocalAlterFixed(id, entity);
|
||||
@ -607,6 +612,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
String change = Txt.implode(messages, Txt.parse("<silver> | "));
|
||||
String message = Txt.parse("<b>[No Modification] %s", change);
|
||||
this.getPlugin().log(message);
|
||||
if (entity.getLastStackTraceChanged() != null) this.getPlugin().log(MUtil.getStackTraceString(entity.getLastStackTraceChanged(), true));
|
||||
}
|
||||
|
||||
protected void logModification(E entity, Modification modification)
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.massivecraft.massivecore.store;
|
||||
|
||||
import com.massivecraft.massivecore.ConfServer;
|
||||
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// Self referencing generic.
|
||||
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206
|
||||
public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
@ -32,13 +37,20 @@ public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
public boolean getLastDefault() { return this.lastDefault; }
|
||||
public void setLastDefault(boolean lastDefault) { this.lastDefault = lastDefault; }
|
||||
|
||||
private volatile transient List<StackTraceElement> lastStackTraceChanged;
|
||||
public List<StackTraceElement> getLastStackTraceChanged() { return this.lastStackTraceChanged; }
|
||||
public void setLastStackTraceChanged(List<StackTraceElement> lastStackTraceChanged) { this.lastStackTraceChanged = lastStackTraceChanged; }
|
||||
|
||||
public void clearSyncLogFields()
|
||||
{
|
||||
this.lastRaw = null;
|
||||
this.lastMtime = 0;
|
||||
this.lastDefault = false;
|
||||
this.lastStackTraceChanged = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ATTACH AND DETACH
|
||||
// -------------------------------------------- //
|
||||
@ -63,6 +75,14 @@ public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
// SYNC AND IO ACTIONS
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void changed()
|
||||
{
|
||||
super.changed();
|
||||
if (!MStore.isLocalPollingDebugEnabled() || !MassiveCoreMConf.get().advancedLocalPollingDebug) return;
|
||||
this.lastStackTraceChanged = MUtil.getStackTrace();
|
||||
}
|
||||
|
||||
public Modification sync()
|
||||
{
|
||||
if (!this.isLive()) return Modification.UNKNOWN;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.massivecore.store;
|
||||
|
||||
import com.massivecraft.massivecore.ConfServer;
|
||||
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
||||
|
||||
import java.net.URI;
|
||||
@ -110,4 +111,14 @@ public class MStore
|
||||
return driver.getDb(uri.toString());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OTHER
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean isLocalPollingDebugEnabled()
|
||||
{
|
||||
return ConfServer.localPollingEnabled && MassiveCoreMConf.get().warnOnLocalAlter;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user