Add a case insensitive treeset builder and commonly used sets of strings meaning nothing and remove.
This commit is contained in:
parent
af67dfbf0f
commit
938efaeed4
@ -34,6 +34,7 @@ import com.massivecraft.massivecore.store.Coll;
|
|||||||
import com.massivecraft.massivecore.store.ExamineThread;
|
import com.massivecraft.massivecore.store.ExamineThread;
|
||||||
import com.massivecraft.massivecore.teleport.EngineScheduledTeleport;
|
import com.massivecraft.massivecore.teleport.EngineScheduledTeleport;
|
||||||
import com.massivecraft.massivecore.util.IdUtil;
|
import com.massivecraft.massivecore.util.IdUtil;
|
||||||
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.util.PlayerUtil;
|
import com.massivecraft.massivecore.util.PlayerUtil;
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
import com.massivecraft.massivecore.xlib.gson.Gson;
|
import com.massivecraft.massivecore.xlib.gson.Gson;
|
||||||
@ -52,6 +53,11 @@ public class MassiveCore extends MassivePlugin
|
|||||||
public final static String INSTANCE = "instance";
|
public final static String INSTANCE = "instance";
|
||||||
public final static String DEFAULT = "default";
|
public final static String DEFAULT = "default";
|
||||||
|
|
||||||
|
public final static Set<String> NOTHING = MUtil.treeset("", "none", "null", "nothing");
|
||||||
|
public final static Set<String> REMOVE = MUtil.treeset("clear", "c", "delete", "del", "d", "erase", "e", "remove", "rem", "r", "reset", "res");
|
||||||
|
public final static Set<String> NOTHING_REMOVE = MUtil.treeset("", "none", "null", "nothing", "clear", "c", "delete", "del", "d", "erase", "e", "remove", "rem", "r", "reset", "res");
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -602,6 +602,23 @@ public class MUtil
|
|||||||
return new LinkedHashSet<T>(Arrays.asList(items));
|
return new LinkedHashSet<T>(Arrays.asList(items));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SafeVarargs
|
||||||
|
public static <T> Set<T> treeset(T... items)
|
||||||
|
{
|
||||||
|
Set<T> ret;
|
||||||
|
if (items[0] instanceof String)
|
||||||
|
{
|
||||||
|
ret = (Set<T>) new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = new TreeSet<T>();
|
||||||
|
}
|
||||||
|
ret.addAll(Arrays.asList(items));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
@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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user