Use the Massive collections some more
This commit is contained in:
parent
213b8c79d2
commit
00983bfc94
@ -5,6 +5,8 @@ import com.massivecraft.massivecore.Identified;
|
|||||||
import com.massivecraft.massivecore.MassiveException;
|
import com.massivecraft.massivecore.MassiveException;
|
||||||
import com.massivecraft.massivecore.Named;
|
import com.massivecraft.massivecore.Named;
|
||||||
import com.massivecraft.massivecore.collections.MassiveList;
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
|
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
|
||||||
import com.massivecraft.massivecore.command.editor.CommandEditProperties;
|
import com.massivecraft.massivecore.command.editor.CommandEditProperties;
|
||||||
import com.massivecraft.massivecore.command.editor.CommandEditSimple;
|
import com.massivecraft.massivecore.command.editor.CommandEditSimple;
|
||||||
@ -522,7 +524,7 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
|
|
||||||
private static List<String> withoutPreAndSuffix(List<String> suggestions, String prefix)
|
private static List<String> withoutPreAndSuffix(List<String> suggestions, String prefix)
|
||||||
{
|
{
|
||||||
LinkedHashSet<String> ret = new LinkedHashSet<>(suggestions.size());
|
MassiveSet<String> ret = new MassiveSet<>(suggestions.size());
|
||||||
boolean includesPrefix = false; // Sometimes a suggestion is equal to the prefix.
|
boolean includesPrefix = false; // Sometimes a suggestion is equal to the prefix.
|
||||||
for (String suggestion : suggestions)
|
for (String suggestion : suggestions)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.massivecore.event;
|
package com.massivecraft.massivecore.event;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
import com.massivecraft.massivecore.store.SenderColl;
|
import com.massivecraft.massivecore.store.SenderColl;
|
||||||
import com.massivecraft.massivecore.store.SenderEntity;
|
import com.massivecraft.massivecore.store.SenderEntity;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -32,7 +33,7 @@ public class EventMassiveCorePlayerCleanInactivityToleranceMillis extends EventM
|
|||||||
|
|
||||||
public SenderColl<?> getColl() { return entity.getColl(); }
|
public SenderColl<?> getColl() { return entity.getColl(); }
|
||||||
|
|
||||||
private final Map<String, Long> toleranceCauseMillis = new LinkedHashMap<>();
|
private final Map<String, Long> toleranceCauseMillis = new MassiveMap<>();
|
||||||
public Map<String, Long> getToleranceCauseMillis() { return this.toleranceCauseMillis; }
|
public Map<String, Long> getToleranceCauseMillis() { return this.toleranceCauseMillis; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.massivecore.ps;
|
|||||||
import com.massivecraft.massivecore.Aspect;
|
import com.massivecraft.massivecore.Aspect;
|
||||||
import com.massivecraft.massivecore.MassiveCore;
|
import com.massivecraft.massivecore.MassiveCore;
|
||||||
import com.massivecraft.massivecore.Multiverse;
|
import com.massivecraft.massivecore.Multiverse;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.comparator.ComparatorSmart;
|
import com.massivecraft.massivecore.comparator.ComparatorSmart;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
||||||
@ -863,7 +864,7 @@ public final class PS implements Serializable, Comparable<PS>
|
|||||||
|
|
||||||
public static Set<PS> getDistinctChunks(Collection<PS> pss)
|
public static Set<PS> getDistinctChunks(Collection<PS> pss)
|
||||||
{
|
{
|
||||||
Set<PS> ret = new LinkedHashSet<>();
|
Set<PS> ret = new MassiveSet<>();
|
||||||
for (PS ps : pss)
|
for (PS ps : pss)
|
||||||
{
|
{
|
||||||
ret.add(ps.getChunk(true));
|
ret.add(ps.getChunk(true));
|
||||||
@ -873,7 +874,7 @@ public final class PS implements Serializable, Comparable<PS>
|
|||||||
|
|
||||||
public static Set<String> getDistinctWorlds(Collection<PS> pss)
|
public static Set<String> getDistinctWorlds(Collection<PS> pss)
|
||||||
{
|
{
|
||||||
Set<String> ret = new LinkedHashSet<>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
for (PS ps : pss)
|
for (PS ps : pss)
|
||||||
{
|
{
|
||||||
ret.add(ps.getWorld());
|
ret.add(ps.getWorld());
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.massivecraft.massivecore.store;
|
package com.massivecraft.massivecore.store;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.util.DiscUtil;
|
import com.massivecraft.massivecore.util.DiscUtil;
|
||||||
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
||||||
import com.massivecraft.massivecore.xlib.gson.JsonParser;
|
import com.massivecraft.massivecore.xlib.gson.JsonParser;
|
||||||
@ -68,7 +70,7 @@ public class DriverFlatfile extends DriverAbstract
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getCollnames(Db db)
|
public Set<String> getCollnames(Db db)
|
||||||
{
|
{
|
||||||
Set<String> ret = new LinkedHashSet<>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
for (File file : ((DbFlatfile)db).directory.listFiles())
|
for (File file : ((DbFlatfile)db).directory.listFiles())
|
||||||
{
|
{
|
||||||
@ -181,7 +183,7 @@ public class DriverFlatfile extends DriverAbstract
|
|||||||
File[] files = directory.listFiles(JsonFileFilter.get());
|
File[] files = directory.listFiles(JsonFileFilter.get());
|
||||||
|
|
||||||
// Create Ret
|
// Create Ret
|
||||||
ret = new LinkedHashMap<>(files.length);
|
ret = new MassiveMap<>(files.length);
|
||||||
|
|
||||||
// For Each Found
|
// For Each Found
|
||||||
for (File file : files)
|
for (File file : files)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.massivecore.store;
|
package com.massivecraft.massivecore.store;
|
||||||
|
|
||||||
import com.massivecraft.massivecore.MassiveCoreMConf;
|
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
||||||
import com.massivecraft.massivecore.xlib.mongodb.BasicDBObject;
|
import com.massivecraft.massivecore.xlib.mongodb.BasicDBObject;
|
||||||
import com.massivecraft.massivecore.xlib.mongodb.DB;
|
import com.massivecraft.massivecore.xlib.mongodb.DB;
|
||||||
@ -217,7 +218,7 @@ public class DriverMongo extends DriverAbstract
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Create Ret
|
// Create Ret
|
||||||
ret = new LinkedHashMap<>(cursor.count());
|
ret = new MassiveMap<>(cursor.count());
|
||||||
|
|
||||||
// For Each Found
|
// For Each Found
|
||||||
while (cursor.hasNext())
|
while (cursor.hasNext())
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.massivecore.store.accessor;
|
package com.massivecraft.massivecore.store.accessor;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
import com.massivecraft.massivecore.store.EntityInternalMap;
|
import com.massivecraft.massivecore.store.EntityInternalMap;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -22,7 +23,7 @@ public class Accessor
|
|||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
public Class<?> getClazz() { return this.clazz; }
|
public Class<?> getClazz() { return this.clazz; }
|
||||||
|
|
||||||
private Map<String, FieldAccessor> fieldToAccessor = new LinkedHashMap<>();
|
private Map<String, FieldAccessor> fieldToAccessor = new MassiveMap<>();
|
||||||
public Map<String, FieldAccessor> getFieldToAccessor() { return this.fieldToAccessor; }
|
public Map<String, FieldAccessor> getFieldToAccessor() { return this.fieldToAccessor; }
|
||||||
|
|
||||||
public FieldAccessor getFieldAccessor(String fieldName)
|
public FieldAccessor getFieldAccessor(String fieldName)
|
||||||
@ -152,7 +153,7 @@ public class Accessor
|
|||||||
|
|
||||||
public static Map<String, Field> getFieldMap(Class<?> clazz)
|
public static Map<String, Field> getFieldMap(Class<?> clazz)
|
||||||
{
|
{
|
||||||
Map<String, Field> ret = new LinkedHashMap<>();
|
Map<String, Field> ret = new MassiveMap<>();
|
||||||
|
|
||||||
for (Field field : getFieldList(clazz))
|
for (Field field : getFieldList(clazz))
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.massivecore.util;
|
|||||||
import com.massivecraft.massivecore.MassiveCore;
|
import com.massivecraft.massivecore.MassiveCore;
|
||||||
import com.massivecraft.massivecore.SenderPresence;
|
import com.massivecraft.massivecore.SenderPresence;
|
||||||
import com.massivecraft.massivecore.SenderType;
|
import com.massivecraft.massivecore.SenderType;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
|
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
|
||||||
import com.massivecraft.massivecore.event.EventMassiveCoreSenderRegister;
|
import com.massivecraft.massivecore.event.EventMassiveCoreSenderRegister;
|
||||||
import com.massivecraft.massivecore.event.EventMassiveCoreSenderUnregister;
|
import com.massivecraft.massivecore.event.EventMassiveCoreSenderUnregister;
|
||||||
@ -177,7 +178,7 @@ public class IdUtil implements Listener, Runnable
|
|||||||
|
|
||||||
public static Set<CommandSender> getLocalSenders()
|
public static Set<CommandSender> getLocalSenders()
|
||||||
{
|
{
|
||||||
Set<CommandSender> ret = new LinkedHashSet<>();
|
Set<CommandSender> ret = new MassiveSet<>();
|
||||||
|
|
||||||
// Add Online Players
|
// Add Online Players
|
||||||
ret.addAll(MUtil.getOnlinePlayers());
|
ret.addAll(MUtil.getOnlinePlayers());
|
||||||
@ -922,7 +923,7 @@ public class IdUtil implements Listener, Runnable
|
|||||||
|
|
||||||
public static Set<IdData> getLocalPlayerDatas()
|
public static Set<IdData> getLocalPlayerDatas()
|
||||||
{
|
{
|
||||||
Set<IdData> ret = new LinkedHashSet<>();
|
Set<IdData> ret = new MassiveSet<>();
|
||||||
|
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.massivecore.util;
|
|||||||
import com.massivecraft.massivecore.MassiveCore;
|
import com.massivecraft.massivecore.MassiveCore;
|
||||||
import com.massivecraft.massivecore.collections.ExceptionSet;
|
import com.massivecraft.massivecore.collections.ExceptionSet;
|
||||||
import com.massivecraft.massivecore.collections.MassiveList;
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.collections.MassiveTreeSet;
|
import com.massivecraft.massivecore.collections.MassiveTreeSet;
|
||||||
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
|
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
|
||||||
@ -1614,7 +1615,7 @@ public class MUtil
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <K, V> Map<K, V> map(K key1, V value1, Object... objects)
|
public static <K, V> Map<K, V> map(K key1, V value1, Object... objects)
|
||||||
{
|
{
|
||||||
Map<K, V> ret = new LinkedHashMap<>();
|
Map<K, V> ret = new MassiveMap<>();
|
||||||
|
|
||||||
ret.put(key1, value1);
|
ret.put(key1, value1);
|
||||||
|
|
||||||
@ -1631,7 +1632,7 @@ public class MUtil
|
|||||||
|
|
||||||
public static <K, V> Map<V, K> flippedMap(Map<K, V> map)
|
public static <K, V> Map<V, K> flippedMap(Map<K, V> map)
|
||||||
{
|
{
|
||||||
Map<V, K> ret = new LinkedHashMap<>();
|
Map<V, K> ret = new MassiveMap<>();
|
||||||
|
|
||||||
for(Entry<K, V> entry : map.entrySet())
|
for(Entry<K, V> entry : map.entrySet())
|
||||||
{
|
{
|
||||||
@ -1647,7 +1648,7 @@ public class MUtil
|
|||||||
|
|
||||||
public static <K, V> Map<V, Set<K>> reverseIndex(Map<K, V> map)
|
public static <K, V> Map<V, Set<K>> reverseIndex(Map<K, V> map)
|
||||||
{
|
{
|
||||||
Map<V, Set<K>> ret = new LinkedHashMap<>();
|
Map<V, Set<K>> ret = new MassiveMap<>();
|
||||||
|
|
||||||
for (Entry<K, V> entry : map.entrySet())
|
for (Entry<K, V> entry : map.entrySet())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user