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

Commit 7c9bb4a

Browse files
committed
Try to debug unreqwuired .changed calls
1 parent 17526c3 commit 7c9bb4a

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

src/com/massivecraft/massivecore/MassiveCore.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ public void onEnableInner()
259259
// Delete Files (at once and additionally after all plugins loaded)
260260
MassiveCoreTaskDeleteFiles.get().run();
261261
Bukkit.getScheduler().scheduleSyncDelayedTask(this, MassiveCoreTaskDeleteFiles.get());
262+
263+
// Uneccessary call of .changed() for debug
264+
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
265+
@Override
266+
public void run() {
267+
MassiveCoreMConf.get().changed();
268+
}
269+
}, 200L);
262270
}
263271

264272
@Override

src/com/massivecraft/massivecore/store/Coll.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.massivecraft.massivecore.mixin.MixinModification;
1010
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
1111
import com.massivecraft.massivecore.util.MUtil;
12-
import com.massivecraft.massivecore.util.ReflectionUtil;
1312
import com.massivecraft.massivecore.util.Txt;
1413
import com.massivecraft.massivecore.xlib.gson.Gson;
1514
import com.massivecraft.massivecore.xlib.gson.JsonElement;
@@ -555,7 +554,13 @@ public Modification syncIdFixed(String id, final Modification suppliedModificati
555554
this.removeIdentifiedModificationFixed(id);
556555
break;
557556
}
558-
557+
558+
E entity = this.getFixed(id);
559+
if (entity != null)
560+
{
561+
entity.setLastStackTraceChanged(null);
562+
}
563+
559564
return modification;
560565
}
561566

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

612618
protected void logModification(E entity, Modification modification)

src/com/massivecraft/massivecore/store/Entity.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package com.massivecraft.massivecore.store;
22

3+
import com.massivecraft.massivecore.ConfServer;
4+
import com.massivecraft.massivecore.util.MUtil;
35
import com.massivecraft.massivecore.xlib.gson.JsonObject;
46

7+
import java.util.List;
8+
59
// Self referencing generic.
610
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206
711
public class Entity<E extends Entity<E>> extends EntityInternal<E>
@@ -31,13 +35,20 @@ public String getUniverse()
3135
private volatile transient boolean lastDefault = false;
3236
public boolean getLastDefault() { return this.lastDefault; }
3337
public void setLastDefault(boolean lastDefault) { this.lastDefault = lastDefault; }
34-
38+
39+
private volatile transient List<StackTraceElement> lastStackTraceChanged;
40+
public List<StackTraceElement> getLastStackTraceChanged() { return this.lastStackTraceChanged; }
41+
public void setLastStackTraceChanged(List<StackTraceElement> lastStackTraceChanged) { this.lastStackTraceChanged = lastStackTraceChanged; }
42+
3543
public void clearSyncLogFields()
3644
{
3745
this.lastRaw = null;
3846
this.lastMtime = 0;
3947
this.lastDefault = false;
48+
this.lastStackTraceChanged = null;
4049
}
50+
51+
4152

4253
// -------------------------------------------- //
4354
// ATTACH AND DETACH
@@ -62,6 +73,14 @@ public E detach()
6273
// -------------------------------------------- //
6374
// SYNC AND IO ACTIONS
6475
// -------------------------------------------- //
76+
77+
@Override
78+
public void changed()
79+
{
80+
super.changed();
81+
if (!ConfServer.localPollingEnabled) return;
82+
this.lastStackTraceChanged = MUtil.getStackTrace();
83+
}
6584

6685
public Modification sync()
6786
{

0 commit comments

Comments
 (0)