Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Try to debug unreqwuired .changed calls
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusulf committed Apr 29, 2018
1 parent 17526c3 commit 7c9bb4a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/com/massivecraft/massivecore/MassiveCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ public void onEnableInner()
// 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
Expand Down
10 changes: 8 additions & 2 deletions src/com/massivecraft/massivecore/store/Coll.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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;
Expand Down Expand Up @@ -555,7 +554,13 @@ public Modification syncIdFixed(String id, final Modification suppliedModificati
this.removeIdentifiedModificationFixed(id);
break;
}


E entity = this.getFixed(id);
if (entity != null)
{
entity.setLastStackTraceChanged(null);
}

return modification;
}

Expand Down Expand Up @@ -607,6 +612,7 @@ private void checkActuallyModifiedFixed(String id)
String change = Txt.implode(messages, Txt.parse("<silver> | "));
String message = Txt.parse("<b>[No Modification] %s", change);
this.getPlugin().log(message);
this.getPlugin().log(MUtil.getStackTraceString(entity.getLastStackTraceChanged(), true));
}

protected void logModification(E entity, Modification modification)
Expand Down
21 changes: 20 additions & 1 deletion src/com/massivecraft/massivecore/store/Entity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.massivecraft.massivecore.store;

import com.massivecraft.massivecore.ConfServer;
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>
Expand Down Expand Up @@ -31,13 +35,20 @@ public String getUniverse()
private volatile transient boolean lastDefault = false;
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
Expand All @@ -62,6 +73,14 @@ public E detach()
// -------------------------------------------- //
// SYNC AND IO ACTIONS
// -------------------------------------------- //

@Override
public void changed()
{
super.changed();
if (!ConfServer.localPollingEnabled) return;
this.lastStackTraceChanged = MUtil.getStackTrace();
}

public Modification sync()
{
Expand Down

0 comments on commit 7c9bb4a

Please sign in to comment.