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

Commit 6db82dd

Browse files
committed
Try to debug unreqwuired .changed calls
1 parent 17526c3 commit 6db82dd

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

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: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package com.massivecraft.massivecore.store;
22

3+
import com.massivecraft.massivecore.ConfServer;
4+
import com.massivecraft.massivecore.MassiveCoreMConf;
5+
import com.massivecraft.massivecore.util.MUtil;
36
import com.massivecraft.massivecore.xlib.gson.JsonObject;
47

8+
import java.util.List;
9+
510
// Self referencing generic.
611
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206
712
public class Entity<E extends Entity<E>> extends EntityInternal<E>
@@ -31,13 +36,20 @@ public String getUniverse()
3136
private volatile transient boolean lastDefault = false;
3237
public boolean getLastDefault() { return this.lastDefault; }
3338
public void setLastDefault(boolean lastDefault) { this.lastDefault = lastDefault; }
34-
39+
40+
private volatile transient List<StackTraceElement> lastStackTraceChanged;
41+
public List<StackTraceElement> getLastStackTraceChanged() { return this.lastStackTraceChanged; }
42+
public void setLastStackTraceChanged(List<StackTraceElement> lastStackTraceChanged) { this.lastStackTraceChanged = lastStackTraceChanged; }
43+
3544
public void clearSyncLogFields()
3645
{
3746
this.lastRaw = null;
3847
this.lastMtime = 0;
3948
this.lastDefault = false;
49+
this.lastStackTraceChanged = null;
4050
}
51+
52+
4153

4254
// -------------------------------------------- //
4355
// ATTACH AND DETACH
@@ -62,6 +74,14 @@ public E detach()
6274
// -------------------------------------------- //
6375
// SYNC AND IO ACTIONS
6476
// -------------------------------------------- //
77+
78+
@Override
79+
public void changed()
80+
{
81+
super.changed();
82+
if (!ConfServer.localPollingEnabled || !MassiveCoreMConf.get().warnOnLocalAlter) return;
83+
this.lastStackTraceChanged = MUtil.getStackTrace();
84+
}
6585

6686
public Modification sync()
6787
{

0 commit comments

Comments
 (0)