Random possibly required security
This commit is contained in:
parent
9649998352
commit
86ddbdcf15
@ -49,6 +49,7 @@ import com.massivecraft.massivecore.teleport.EngineScheduledTeleport;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.PlayerUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import com.massivecraft.massivecore.xlib.gson.Gson;
|
||||
import com.massivecraft.massivecore.xlib.gson.GsonBuilder;
|
||||
@ -158,6 +159,9 @@ public class MassiveCore extends MassivePlugin
|
||||
|
||||
if ( ! preEnable()) return;
|
||||
|
||||
// TODO: This seems to fix most race conditions within the class asynchronous class loader.
|
||||
System.out.println("TimeUnit.MILLIS_PER_MINUTE: " + TimeUnit.MILLIS_PER_MINUTE);
|
||||
|
||||
// Load Server Config
|
||||
ConfServer.get().load();
|
||||
|
||||
|
@ -440,7 +440,7 @@ public class Coll<E> implements CollInterface<E>
|
||||
|
||||
protected Map<String, Modification> identifiedModifications;
|
||||
|
||||
protected void removeIdentifiedModification(Object oid)
|
||||
protected synchronized void removeIdentifiedModification(Object oid)
|
||||
{
|
||||
if (oid == null) throw new NullPointerException("oid");
|
||||
String id = this.fixId(oid);
|
||||
@ -839,12 +839,16 @@ public class Coll<E> implements CollInterface<E>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncIdentified()
|
||||
public void syncIdentified(boolean safe)
|
||||
{
|
||||
for (Entry<String, Modification> entry : this.identifiedModifications.entrySet())
|
||||
{
|
||||
String id = entry.getKey();
|
||||
Modification modification = entry.getValue();
|
||||
if (safe)
|
||||
{
|
||||
modification = null;
|
||||
}
|
||||
this.syncId(id, modification);
|
||||
}
|
||||
}
|
||||
@ -853,7 +857,7 @@ public class Coll<E> implements CollInterface<E>
|
||||
public void syncAll()
|
||||
{
|
||||
this.identifyModifications();
|
||||
this.syncIdentified();
|
||||
this.syncIdentified(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -879,7 +883,7 @@ public class Coll<E> implements CollInterface<E>
|
||||
@Override
|
||||
public void onTick()
|
||||
{
|
||||
this.syncIdentified();
|
||||
this.syncIdentified(true);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -140,7 +140,7 @@ public interface CollInterface<E>
|
||||
public Modification syncId(Object oid);
|
||||
public Modification syncId(Object oid, Modification modificationState);
|
||||
public Modification syncId(Object oid, Modification modificationState, Entry<JsonElement, Long> remoteEntry);
|
||||
public void syncIdentified();
|
||||
public void syncIdentified(boolean safe);
|
||||
public void syncAll();
|
||||
public void identifyModifications();
|
||||
public void initLoadAllFromRemote();
|
||||
|
@ -373,6 +373,22 @@ public class MUtil
|
||||
list.addAll(repeat(object, length - list.size()));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// MAP OPERATIONS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static void keepLeft(Map<?, ?> map, int maxSize)
|
||||
{
|
||||
int i = 0;
|
||||
Iterator<?> iter = map.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
iter.next();
|
||||
i++;
|
||||
if (i > maxSize) iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ITERABLE MATH
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user