@Override public synchronized void loadFromRemoteFixed(String id, Entry<JsonObject, Long> remoteEntry) { if (!Factions.get().isDatabaseInitialized()) { super.loadFromRemoteFixed(id, remoteEntry); return; } MPlayer mplayer = null; // Before String beforeId = null; if (mplayer == null) mplayer = this.id2entity.get(id); if (mplayer != null) beforeId = mplayer.getFactionId(); // Super super.loadFromRemoteFixed(id, remoteEntry); // After String afterId = null; if (mplayer == null) mplayer = this.id2entity.get(id); if (mplayer != null) afterId = mplayer.getFactionId(); // Perform if (mplayer != null) mplayer.updateFactionIndexes(beforeId, afterId); }
public void clean() { for (MPlayer mplayer : this.getAll()) { String factionId = mplayer.getFactionId(); if (FactionColl.get().containsId(factionId)) continue; mplayer.resetFactionData(); String message = Txt.parse( "<i>Reset data for <h>%s <i>. Unknown factionId <h>%s", mplayer.getDisplayName(IdUtil.getConsole()), factionId); Factions.get().log(message); } }
@Override public synchronized MPlayer removeAtLocalFixed(String id) { if (!Factions.get().isDatabaseInitialized()) return super.removeAtLocalFixed(id); MPlayer mplayer = this.id2entity.get(id); if (mplayer != null) { String beforeId = mplayer.getFactionId(); String afterId = null; mplayer.updateFactionIndexes(beforeId, afterId); } return super.removeAtLocalFixed(id); }