IntelliJ Inspection Based Cleanup
This commit is contained in:
parent
afb6882157
commit
c7db1cf90d
@ -3,16 +3,16 @@ package com.massivecraft.massivecore;
|
|||||||
public interface Active
|
public interface Active
|
||||||
{
|
{
|
||||||
// Boolean
|
// Boolean
|
||||||
public boolean isActive();
|
boolean isActive();
|
||||||
public void setActive(boolean active);
|
void setActive(boolean active);
|
||||||
|
|
||||||
// Plugin
|
// Plugin
|
||||||
public MassivePlugin setActivePlugin(MassivePlugin plugin);
|
MassivePlugin setActivePlugin(MassivePlugin plugin);
|
||||||
public MassivePlugin getActivePlugin();
|
MassivePlugin getActivePlugin();
|
||||||
|
|
||||||
// Combined Setter
|
// Combined Setter
|
||||||
// Plugin is set first.
|
// Plugin is set first.
|
||||||
// Boolean by null state.
|
// Boolean by null state.
|
||||||
public void setActive(MassivePlugin plugin);
|
void setActive(MassivePlugin plugin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class Aspect extends Entity<Aspect>
|
|||||||
public boolean isRegistered() { return this.registered; }
|
public boolean isRegistered() { return this.registered; }
|
||||||
public void register() { this.registered = true; }
|
public void register() { this.registered = true; }
|
||||||
|
|
||||||
private transient Collection<String> desc = new ArrayList<String>();
|
private transient Collection<String> desc = new ArrayList<>();
|
||||||
public Collection<String> getDesc() { return this.desc; }
|
public Collection<String> getDesc() { return this.desc; }
|
||||||
public void setDesc(Collection<String> val) { this.desc = val; }
|
public void setDesc(Collection<String> val) { this.desc = val; }
|
||||||
public void setDesc(String... val) { this.desc = Arrays.asList(val); }
|
public void setDesc(String... val) { this.desc = Arrays.asList(val); }
|
||||||
|
@ -30,7 +30,7 @@ public class AspectColl extends Coll<Aspect>
|
|||||||
|
|
||||||
public List<Aspect> getAllRegistered()
|
public List<Aspect> getAllRegistered()
|
||||||
{
|
{
|
||||||
List<Aspect> ret = new ArrayList<Aspect>();
|
List<Aspect> ret = new ArrayList<>();
|
||||||
for (Aspect aspect : this.getAll())
|
for (Aspect aspect : this.getAll())
|
||||||
{
|
{
|
||||||
if (aspect.isRegistered() == false) continue;
|
if (aspect.isRegistered() == false) continue;
|
||||||
@ -41,7 +41,7 @@ public class AspectColl extends Coll<Aspect>
|
|||||||
|
|
||||||
public List<Aspect> getAllRegisteredForMultiverse(Multiverse multiverse, boolean normal)
|
public List<Aspect> getAllRegisteredForMultiverse(Multiverse multiverse, boolean normal)
|
||||||
{
|
{
|
||||||
List<Aspect> ret = new ArrayList<Aspect>();
|
List<Aspect> ret = new ArrayList<>();
|
||||||
for (Aspect aspect : this.getAll())
|
for (Aspect aspect : this.getAll())
|
||||||
{
|
{
|
||||||
if (aspect.isRegistered() == false) continue;
|
if (aspect.isRegistered() == false) continue;
|
||||||
|
@ -4,5 +4,5 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public interface Colorized
|
public interface Colorized
|
||||||
{
|
{
|
||||||
public ChatColor getColor();
|
ChatColor getColor();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class Couple<A, B> implements Entry<A, B>, Cloneable, Serializable
|
|||||||
|
|
||||||
public static <A, B> Couple<A, B> valueOf(A first, B second)
|
public static <A, B> Couple<A, B> valueOf(A first, B second)
|
||||||
{
|
{
|
||||||
return new Couple<A, B>(first, second);
|
return new Couple<>(first, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
|
|||||||
|
|
||||||
public interface Identified
|
public interface Identified
|
||||||
{
|
{
|
||||||
public String getId();
|
String getId();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class Multiverse extends Entity<Multiverse>
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected Map<String, Set<String>> uw = new HashMap<String, Set<String>>();
|
protected Map<String, Set<String>> uw = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -68,7 +68,7 @@ public class Multiverse extends Entity<Multiverse>
|
|||||||
Set<String> ret = this.uw.get(universe);
|
Set<String> ret = this.uw.get(universe);
|
||||||
if (ret == null)
|
if (ret == null)
|
||||||
{
|
{
|
||||||
ret = new HashSet<String>();
|
ret = new HashSet<>();
|
||||||
this.uw.put(universe, ret);
|
this.uw.put(universe, ret);
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class Multiverse extends Entity<Multiverse>
|
|||||||
|
|
||||||
public Set<String> getUniverses()
|
public Set<String> getUniverses()
|
||||||
{
|
{
|
||||||
Set<String> ret = new TreeSet<String>();
|
Set<String> ret = new TreeSet<>();
|
||||||
ret.addAll(this.uw.keySet());
|
ret.addAll(this.uw.keySet());
|
||||||
ret.add(MassiveCore.DEFAULT);
|
ret.add(MassiveCore.DEFAULT);
|
||||||
return ret;
|
return ret;
|
||||||
@ -142,7 +142,7 @@ public class Multiverse extends Entity<Multiverse>
|
|||||||
|
|
||||||
public Set<String> getWorlds()
|
public Set<String> getWorlds()
|
||||||
{
|
{
|
||||||
Set<String> ret = new TreeSet<String>();
|
Set<String> ret = new TreeSet<>();
|
||||||
for (Set<String> uworlds : this.uw.values())
|
for (Set<String> uworlds : this.uw.values())
|
||||||
{
|
{
|
||||||
ret.addAll(uworlds);
|
ret.addAll(uworlds);
|
||||||
@ -155,7 +155,7 @@ public class Multiverse extends Entity<Multiverse>
|
|||||||
Set<String> orig = this.uw.get(universe);
|
Set<String> orig = this.uw.get(universe);
|
||||||
if (orig == null) return null;
|
if (orig == null) return null;
|
||||||
|
|
||||||
Set<String> ret = new TreeSet<String>();
|
Set<String> ret = new TreeSet<>();
|
||||||
ret.addAll(orig);
|
ret.addAll(orig);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
|
|||||||
|
|
||||||
public interface Named
|
public interface Named
|
||||||
{
|
{
|
||||||
public String getName();
|
String getName();
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class PotionEffectWrap
|
|||||||
public static List<PotionEffectWrap> getEffects(LivingEntity entity)
|
public static List<PotionEffectWrap> getEffects(LivingEntity entity)
|
||||||
{
|
{
|
||||||
// Create Ret
|
// Create Ret
|
||||||
List<PotionEffectWrap> ret = new MassiveList<PotionEffectWrap>();
|
List<PotionEffectWrap> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Fill Ret
|
// Fill Ret
|
||||||
for (PotionEffect potionEffect : entity.getActivePotionEffects())
|
for (PotionEffect potionEffect : entity.getActivePotionEffects())
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
|
|||||||
|
|
||||||
public interface Prioritized
|
public interface Prioritized
|
||||||
{
|
{
|
||||||
public int getPriority();
|
int getPriority();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class Progressbar
|
|||||||
public static List<String> renderList(double quota, int width, String left, String solid, String between, String empty, String right, double solidsPerEmpty, String colorTag, Map<Double, String> roofToColor)
|
public static List<String> renderList(double quota, int width, String left, String solid, String between, String empty, String right, double solidsPerEmpty, String colorTag, Map<Double, String> roofToColor)
|
||||||
{
|
{
|
||||||
// Create Ret
|
// Create Ret
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
// Ensure between 0 and 1;
|
// Ensure between 0 and 1;
|
||||||
quota = limit(quota);
|
quota = limit(quota);
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
|
|||||||
|
|
||||||
public interface Registerable
|
public interface Registerable
|
||||||
{
|
{
|
||||||
public boolean isRegistered();
|
boolean isRegistered();
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@ public class Triple<A, B, C> implements Cloneable, Serializable
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final A first;
|
private final A first;
|
||||||
public A getFirst() { return this.first; };
|
public A getFirst() { return this.first; }
|
||||||
|
|
||||||
private final B second;
|
private final B second;
|
||||||
public B getSecond() { return this.second; };
|
public B getSecond() { return this.second; }
|
||||||
|
|
||||||
private final C third;
|
private final C third;
|
||||||
public C getThird() { return this.third; };
|
public C getThird() { return this.third; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELDS: WITH
|
// FIELDS: WITH
|
||||||
@ -55,7 +55,7 @@ public class Triple<A, B, C> implements Cloneable, Serializable
|
|||||||
|
|
||||||
public static <A, B, C> Triple<A, B, C> valueOf(A first, B second, C third)
|
public static <A, B, C> Triple<A, B, C> valueOf(A first, B second, C third)
|
||||||
{
|
{
|
||||||
return new Triple<A, B, C>(first, second, third);
|
return new Triple<>(first, second, third);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -71,7 +71,7 @@ public class AdapterEntry implements JsonDeserializer<Entry<?, ?>>, JsonSerializ
|
|||||||
Object key = context.deserialize(keyJson, keyType);
|
Object key = context.deserialize(keyJson, keyType);
|
||||||
Object value = context.deserialize(valueJson, valueType);
|
Object value = context.deserialize(valueJson, valueType);
|
||||||
|
|
||||||
return new SimpleEntry<Object, Object>(key, value);
|
return new SimpleEntry<>(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -26,7 +26,7 @@ public class AdapterLowercaseEnum<T extends Enum<T>> implements JsonDeserializer
|
|||||||
|
|
||||||
public static <T extends Enum<T>> AdapterLowercaseEnum<T> get(Class<T> clazz)
|
public static <T extends Enum<T>> AdapterLowercaseEnum<T> get(Class<T> clazz)
|
||||||
{
|
{
|
||||||
return new AdapterLowercaseEnum<T>(clazz);
|
return new AdapterLowercaseEnum<>(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -41,8 +41,8 @@ import java.util.Map;
|
|||||||
* @author OniBait
|
* @author OniBait
|
||||||
*/
|
*/
|
||||||
public final class AdapterModdedEnumType<T extends Enum<T>> extends TypeAdapter<T> {
|
public final class AdapterModdedEnumType<T extends Enum<T>> extends TypeAdapter<T> {
|
||||||
private final Map<String, T> nameToConstant = new HashMap<String, T>();
|
private final Map<String, T> nameToConstant = new HashMap<>();
|
||||||
private final Map<T, String> constantToName = new HashMap<T, String>();
|
private final Map<T, String> constantToName = new HashMap<>();
|
||||||
|
|
||||||
public AdapterModdedEnumType(Class<T> classOfT) {
|
public AdapterModdedEnumType(Class<T> classOfT) {
|
||||||
for (T constant : classOfT.getEnumConstants()) {
|
for (T constant : classOfT.getEnumConstants()) {
|
||||||
|
@ -71,7 +71,7 @@ public class ChestGui
|
|||||||
// One could have imagined an approach where we looked at the item instead.
|
// One could have imagined an approach where we looked at the item instead.
|
||||||
// That is however not feasible since the Bukkit ItemStack equals method is not reliable.
|
// That is however not feasible since the Bukkit ItemStack equals method is not reliable.
|
||||||
|
|
||||||
private Map<Integer, ChestAction> indexToAction = new MassiveMap<Integer, ChestAction>();
|
private Map<Integer, ChestAction> indexToAction = new MassiveMap<>();
|
||||||
public Map<Integer, ChestAction> getIndexToAction() { return this.indexToAction; }
|
public Map<Integer, ChestAction> getIndexToAction() { return this.indexToAction; }
|
||||||
public ChestAction removeAction(ItemStack item) { return this.indexToAction.remove(item); }
|
public ChestAction removeAction(ItemStack item) { return this.indexToAction.remove(item); }
|
||||||
public ChestAction setAction(int index, ChestAction action) { return this.indexToAction.put(index, action); }
|
public ChestAction setAction(int index, ChestAction action) { return this.indexToAction.put(index, action); }
|
||||||
|
@ -37,7 +37,7 @@ public class ExceptionSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public <O extends Object> ExceptionSet(boolean standard, O... exceptions)
|
public <O> ExceptionSet(boolean standard, O... exceptions)
|
||||||
{
|
{
|
||||||
this.standard = standard;
|
this.standard = standard;
|
||||||
if (exceptions.length == 0) return;
|
if (exceptions.length == 0) return;
|
||||||
@ -49,7 +49,7 @@ public class ExceptionSet
|
|||||||
// CONTAINS
|
// CONTAINS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public <O extends Object> boolean contains(O object)
|
public <O> boolean contains(O object)
|
||||||
{
|
{
|
||||||
if (object == null) return ! this.standard;
|
if (object == null) return ! this.standard;
|
||||||
String string = stringify(object);
|
String string = stringify(object);
|
||||||
|
@ -64,7 +64,7 @@ public class MassiveMap<K, V> extends LinkedHashMap<K, V>
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <K, V> MassiveMap<K, V> varargCreate(K key1, V value1, Object... objects)
|
public static <K, V> MassiveMap<K, V> varargCreate(K key1, V value1, Object... objects)
|
||||||
{
|
{
|
||||||
MassiveMap<K, V> ret = new MassiveMap<K, V>();
|
MassiveMap<K, V> ret = new MassiveMap<>();
|
||||||
|
|
||||||
ret.put(key1, value1);
|
ret.put(key1, value1);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class WorldExceptionSet extends ExceptionSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public <O extends Object> WorldExceptionSet(boolean standard, O... exceptions)
|
public <O> WorldExceptionSet(boolean standard, O... exceptions)
|
||||||
{
|
{
|
||||||
super(standard, exceptions);
|
super(standard, exceptions);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
public Map<String, MassiveCommand> getChildMatches(String token, boolean levenshtein, CommandSender onlyRelevantToSender)
|
public Map<String, MassiveCommand> getChildMatches(String token, boolean levenshtein, CommandSender onlyRelevantToSender)
|
||||||
{
|
{
|
||||||
// Create Ret
|
// Create Ret
|
||||||
Map<String, MassiveCommand> ret = new MassiveMap<String, MassiveCommand>();
|
Map<String, MassiveCommand> ret = new MassiveMap<>();
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
token = token.toLowerCase();
|
token = token.toLowerCase();
|
||||||
@ -419,7 +419,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// ... consider exact priority ...
|
// ... consider exact priority ...
|
||||||
if (alias.equalsIgnoreCase(token))
|
if (alias.equalsIgnoreCase(token))
|
||||||
{
|
{
|
||||||
return new MassiveMap<String, MassiveCommand>(alias, child);
|
return new MassiveMap<>(alias, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... matches ...
|
// ... matches ...
|
||||||
@ -500,7 +500,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
public List<String> getAliases() { return this.aliases; }
|
public List<String> getAliases() { return this.aliases; }
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends MassiveCommand> T setAliases(Collection<String> aliases) { this.aliases = new MassiveList<String>(aliases); return (T) this; }
|
public <T extends MassiveCommand> T setAliases(Collection<String> aliases) { this.aliases = new MassiveList<>(aliases); return (T) this; }
|
||||||
public <T extends MassiveCommand> T setAliases(String... aliases) { return this.setAliases(Arrays.asList(aliases)); }
|
public <T extends MassiveCommand> T setAliases(String... aliases) { return this.setAliases(Arrays.asList(aliases)); }
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -616,7 +616,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// All
|
// All
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, String defaultDesc, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, String defaultDesc, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, requiredFromConsole, name, defaultDesc), concatFromHere);
|
return this.addParameter(new Parameter<>(defaultValue, type, requiredFromConsole, name, defaultDesc), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WITHOUT 1
|
// WITHOUT 1
|
||||||
@ -624,25 +624,25 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Without defaultValue
|
// Without defaultValue
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, String defaultDesc, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, String defaultDesc, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, requiredFromConsole, name, defaultDesc), concatFromHere);
|
return this.addParameter(new Parameter<>(type, requiredFromConsole, name, defaultDesc), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without reqFromConsole.
|
// Without reqFromConsole.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, String defaultDesc, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, String defaultDesc, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, name, defaultDesc), concatFromHere);
|
return this.addParameter(new Parameter<>(defaultValue, type, name, defaultDesc), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultDesc.
|
// Without defaultDesc.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, requiredFromConsole, name), concatFromHere);
|
return this.addParameter(new Parameter<>(defaultValue, type, requiredFromConsole, name), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without concat.
|
// Without concat.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, requiredFromConsole, name, defaultDesc), false);
|
return this.addParameter(new Parameter<>(defaultValue, type, requiredFromConsole, name, defaultDesc), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WITHOUT 2
|
// WITHOUT 2
|
||||||
@ -650,37 +650,37 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Without defaultValue & reqFromConsole
|
// Without defaultValue & reqFromConsole
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, String name, String defaultDesc, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(Type<T> type, String name, String defaultDesc, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, name, defaultDesc), concatFromHere);
|
return this.addParameter(new Parameter<>(type, name, defaultDesc), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultValue & defaultDesc
|
// Without defaultValue & defaultDesc
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, requiredFromConsole, name), concatFromHere);
|
return this.addParameter(new Parameter<>(type, requiredFromConsole, name), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultValue & concat.
|
// Without defaultValue & concat.
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name, String defaultDesc)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, requiredFromConsole, name, defaultDesc));
|
return this.addParameter(new Parameter<>(type, requiredFromConsole, name, defaultDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without reqFromConsole & defaultDesc.
|
// Without reqFromConsole & defaultDesc.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, name), concatFromHere);
|
return this.addParameter(new Parameter<>(defaultValue, type, name), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without reqFromConsole & concat.
|
// Without reqFromConsole & concat.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, String defaultDesc)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name, String defaultDesc)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, name, defaultDesc));
|
return this.addParameter(new Parameter<>(defaultValue, type, name, defaultDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultDesc & concat.
|
// Without defaultDesc & concat.
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, boolean requiredFromConsole, String name)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, requiredFromConsole, name));
|
return this.addParameter(new Parameter<>(defaultValue, type, requiredFromConsole, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// WITHOUT 3
|
// WITHOUT 3
|
||||||
@ -688,25 +688,25 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Without defaultValue, reqFromConsole & defaultDesc.
|
// Without defaultValue, reqFromConsole & defaultDesc.
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, String name, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(Type<T> type, String name, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, name), concatFromHere);
|
return this.addParameter(new Parameter<>(type, name), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultValue, reqFromConsole & concat .
|
// Without defaultValue, reqFromConsole & concat .
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, String name, String defaultDesc)
|
public <T> Parameter<T> addParameter(Type<T> type, String name, String defaultDesc)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, name, defaultDesc));
|
return this.addParameter(new Parameter<>(type, name, defaultDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultValue, defaultDesc & concat .
|
// Without defaultValue, defaultDesc & concat .
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name)
|
public <T> Parameter<T> addParameter(Type<T> type, boolean requiredFromConsole, String name)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, requiredFromConsole, name));
|
return this.addParameter(new Parameter<>(type, requiredFromConsole, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without reqFromConsole, defaultDesc & concat .
|
// Without reqFromConsole, defaultDesc & concat .
|
||||||
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name)
|
public <T> Parameter<T> addParameter(T defaultValue, Type<T> type, String name)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(defaultValue, type, name));
|
return this.addParameter(new Parameter<>(defaultValue, type, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// WITHOUT 4
|
// WITHOUT 4
|
||||||
@ -714,13 +714,13 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Without defaultValue, reqFromConsole, defaultDesc & concat.
|
// Without defaultValue, reqFromConsole, defaultDesc & concat.
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, String name)
|
public <T> Parameter<T> addParameter(Type<T> type, String name)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type, name));
|
return this.addParameter(new Parameter<>(type, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without defaultValue, name, reqFromConsole & defaultDesc.
|
// Without defaultValue, name, reqFromConsole & defaultDesc.
|
||||||
public <T> Parameter<T> addParameter(Type<T> type, boolean concatFromHere)
|
public <T> Parameter<T> addParameter(Type<T> type, boolean concatFromHere)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type), concatFromHere);
|
return this.addParameter(new Parameter<>(type), concatFromHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without 5
|
// Without 5
|
||||||
@ -728,7 +728,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
// Without defaultValue, name, reqFromConsole, defaultDesc & concat.
|
// Without defaultValue, name, reqFromConsole, defaultDesc & concat.
|
||||||
public <T> Parameter<T> addParameter(Type<T> type)
|
public <T> Parameter<T> addParameter(Type<T> type)
|
||||||
{
|
{
|
||||||
return this.addParameter(new Parameter<T>(type));
|
return this.addParameter(new Parameter<>(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -776,7 +776,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
if ( ! this.isConcatenating()) return args;
|
if ( ! this.isConcatenating()) return args;
|
||||||
|
|
||||||
// Create Ret
|
// Create Ret
|
||||||
List<String> ret = new MassiveList<String>();
|
List<String> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Fill Ret
|
// Fill Ret
|
||||||
final int maxIdx = Math.min(this.getConcatenationIndex(), args.size());
|
final int maxIdx = Math.min(this.getConcatenationIndex(), args.size());
|
||||||
@ -1276,7 +1276,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
|
|
||||||
protected List<Mson> getTemplateParameters(CommandSender sender)
|
protected List<Mson> getTemplateParameters(CommandSender sender)
|
||||||
{
|
{
|
||||||
List<Mson> ret = new MassiveList<Mson>();
|
List<Mson> ret = new MassiveList<>();
|
||||||
|
|
||||||
for (Parameter<?> parameter : this.getParameters())
|
for (Parameter<?> parameter : this.getParameters())
|
||||||
{
|
{
|
||||||
@ -1384,7 +1384,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ... else check the children.
|
// ... else check the children.
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
String token = args.get(args.size()-1).toLowerCase();
|
String token = args.get(args.size()-1).toLowerCase();
|
||||||
for (MassiveCommand child : this.getChildren())
|
for (MassiveCommand child : this.getChildren())
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
|
|||||||
if (this.getMassiveCommand().isUnsmart())
|
if (this.getMassiveCommand().isUnsmart())
|
||||||
{
|
{
|
||||||
List<String> oldArgList = ret;
|
List<String> oldArgList = ret;
|
||||||
ret = new ArrayList<String>(oldArgList.size());
|
ret = new ArrayList<>(oldArgList.size());
|
||||||
for (String arg : oldArgList)
|
for (String arg : oldArgList)
|
||||||
{
|
{
|
||||||
ret.add(Txt.removeSmartQuotes(arg));
|
ret.add(Txt.removeSmartQuotes(arg));
|
||||||
@ -127,7 +127,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
|
|||||||
if (rawArgs == null) throw new IllegalArgumentException("args must not be null");
|
if (rawArgs == null) throw new IllegalArgumentException("args must not be null");
|
||||||
if (alias == null) throw new IllegalArgumentException("args must not be null");
|
if (alias == null) throw new IllegalArgumentException("args must not be null");
|
||||||
|
|
||||||
List<String> args = new MassiveList<String>();
|
List<String> args = new MassiveList<>();
|
||||||
|
|
||||||
// When several spaces are next to each other, empty elements in the array will occur.
|
// When several spaces are next to each other, empty elements in the array will occur.
|
||||||
// To avoid such whitespace we do the following
|
// To avoid such whitespace we do the following
|
||||||
|
@ -193,7 +193,7 @@ public class Parameter<T>
|
|||||||
public static Parameter<Integer> getPage()
|
public static Parameter<Integer> getPage()
|
||||||
{
|
{
|
||||||
// We can't use a singleton because people might want to set a description.
|
// We can't use a singleton because people might want to set a description.
|
||||||
return new Parameter<Integer>(1, TypeInteger.get(), "page", "1");
|
return new Parameter<>(1, TypeInteger.get(), "page", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
|
|||||||
V before = inherited.getValue();
|
V before = inherited.getValue();
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
EventMassiveCoreEditorEdit<O, V> event = new EventMassiveCoreEditorEdit<O, V>(this, source, before, after);
|
EventMassiveCoreEditorEdit<O, V> event = new EventMassiveCoreEditorEdit<>(this, source, before, after);
|
||||||
event.run();
|
event.run();
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
after = event.getAfter();
|
after = event.getAfter();
|
||||||
|
@ -12,36 +12,36 @@ public class CommandEditContainer<O, V> extends CommandEditAbstract<O, V>
|
|||||||
super(settings, property, null);
|
super(settings, property, null);
|
||||||
|
|
||||||
// Children
|
// Children
|
||||||
this.addChild(new CommandEditShow<O, V>(settings, property));
|
this.addChild(new CommandEditShow<>(settings, property));
|
||||||
|
|
||||||
if (property.isNullable())
|
if (property.isNullable())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditCreate<O, V>(settings, property));
|
this.addChild(new CommandEditCreate<>(settings, property));
|
||||||
this.addChild(new CommandEditDelete<O, V>(settings, property));
|
this.addChild(new CommandEditDelete<>(settings, property));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property.isEditable())
|
if (property.isEditable())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditContainerAdd<O, V>(settings, property));
|
this.addChild(new CommandEditContainerAdd<>(settings, property));
|
||||||
|
|
||||||
// These are not suitable for maps.
|
// These are not suitable for maps.
|
||||||
if (property.getValueType().isContainerCollection())
|
if (property.getValueType().isContainerCollection())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditContainerInsert<O, V>(settings, property));
|
this.addChild(new CommandEditContainerInsert<>(settings, property));
|
||||||
this.addChild(new CommandEditContainerSet<O, V>(settings, property));
|
this.addChild(new CommandEditContainerSet<>(settings, property));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addChild(new CommandEditContainerRemove<O, V>(settings, property));
|
this.addChild(new CommandEditContainerRemove<>(settings, property));
|
||||||
this.addChild(new CommandEditContainerRemoveIndex<O, V>(settings, property));
|
this.addChild(new CommandEditContainerRemoveIndex<>(settings, property));
|
||||||
|
|
||||||
// The container must not be sorted, and must be ordered.
|
// The container must not be sorted, and must be ordered.
|
||||||
if ( ! property.getValueType().isContainerSorted() && property.getValueType().getContainerComparator() == null && property.getValueType().isContainerOrdered())
|
if ( ! property.getValueType().isContainerSorted() && property.getValueType().getContainerComparator() == null && property.getValueType().isContainerOrdered())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditContainerMove<O, V>(settings, property));
|
this.addChild(new CommandEditContainerMove<>(settings, property));
|
||||||
this.addChild(new CommandEditContainerSwap<O, V>(settings, property));
|
this.addChild(new CommandEditContainerSwap<>(settings, property));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addChild(new CommandEditContainerClear<O, V>(settings, property));
|
this.addChild(new CommandEditContainerClear<>(settings, property));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public abstract class CommandEditContainerAbstract<O, V> extends CommandEditAbst
|
|||||||
{
|
{
|
||||||
Object key = this.readElementInner(0);
|
Object key = this.readElementInner(0);
|
||||||
Object value = this.readElementInner(1);
|
Object value = this.readElementInner(1);
|
||||||
return new SimpleImmutableEntry<Object, Object>(key, value);
|
return new SimpleImmutableEntry<>(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,17 +16,17 @@ public class CommandEditItemStacks<O> extends CommandEditAbstract<O, List<ItemSt
|
|||||||
super(settings, property, true);
|
super(settings, property, true);
|
||||||
|
|
||||||
// Children
|
// Children
|
||||||
this.addChild(new CommandEditShow<O, List<ItemStack>>(settings, property));
|
this.addChild(new CommandEditShow<>(settings, property));
|
||||||
|
|
||||||
if (property.isNullable())
|
if (property.isNullable())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditCreate<O, List<ItemStack>>(settings, property));
|
this.addChild(new CommandEditCreate<>(settings, property));
|
||||||
this.addChild(new CommandEditDelete<O, List<ItemStack>>(settings, property));
|
this.addChild(new CommandEditDelete<>(settings, property));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property.isEditable())
|
if (property.isEditable())
|
||||||
{
|
{
|
||||||
this.addChild(new CommandEditItemStacksOpen<O>(settings, property));
|
this.addChild(new CommandEditItemStacksOpen<>(settings, property));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
|
|||||||
// EDITING
|
// EDITING
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected Set<UUID> playerIds = new MassiveSet<UUID>();
|
protected Set<UUID> playerIds = new MassiveSet<>();
|
||||||
|
|
||||||
public void setEditing(Player player, boolean editing)
|
public void setEditing(Player player, boolean editing)
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
|
|||||||
if (inventory == null) return null;
|
if (inventory == null) return null;
|
||||||
|
|
||||||
// Create Ret
|
// Create Ret
|
||||||
List<ItemStack> ret = new MassiveList<ItemStack>();
|
List<ItemStack> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Fill Ret
|
// Fill Ret
|
||||||
for (int i = 0; i < inventory.getSize(); i++)
|
for (int i = 0; i < inventory.getSize(); i++)
|
||||||
|
@ -31,7 +31,7 @@ public class CommandEditSingleton<O> extends CommandEditProperties<O, O>
|
|||||||
{
|
{
|
||||||
EditSettings<O> ret = new EditSettings<>(typeObject);
|
EditSettings<O> ret = new EditSettings<>(typeObject);
|
||||||
|
|
||||||
PropertyUsed<O> usedProperty = new PropertyUsed<O>(ret, object);
|
PropertyUsed<O> usedProperty = new PropertyUsed<>(ret, object);
|
||||||
ret.setUsedProperty(usedProperty);
|
ret.setUsedProperty(usedProperty);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -78,7 +78,7 @@ public class EditSettings<O>
|
|||||||
}
|
}
|
||||||
protected EditSettings<CommandSender> createUsedSettings()
|
protected EditSettings<CommandSender> createUsedSettings()
|
||||||
{
|
{
|
||||||
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get()));
|
return new EditSettings<>(TypeSender.get(), new PropertyThis<>(TypeSender.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requirements to edit the used object.
|
// Requirements to edit the used object.
|
||||||
@ -164,12 +164,12 @@ public class EditSettings<O>
|
|||||||
|
|
||||||
public CommandEditUsed<O> createCommandUsed()
|
public CommandEditUsed<O> createCommandUsed()
|
||||||
{
|
{
|
||||||
return new CommandEditUsed<O>(this);
|
return new CommandEditUsed<>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandEditShow<O, O> createCommandShow()
|
public CommandEditShow<O, O> createCommandShow()
|
||||||
{
|
{
|
||||||
return new CommandEditShow<O, O>(this, new PropertyThis<>(this.getObjectType()));
|
return new CommandEditShow<>(this, new PropertyThis<>(this.getObjectType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandEditAbstract<O, O> createCommandEdit()
|
public CommandEditAbstract<O, O> createCommandEdit()
|
||||||
|
@ -62,17 +62,17 @@ public abstract class Property<O, V> implements Named
|
|||||||
// NAME
|
// NAME
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected List<String> names = new MassiveList<String>();
|
protected List<String> names = new MassiveList<>();
|
||||||
public List<String> getNames() { return this.names; }
|
public List<String> getNames() { return this.names; }
|
||||||
@Override public String getName() { return this.getNames().isEmpty() ? null : this.getNames().get(0); }
|
@Override public String getName() { return this.getNames().isEmpty() ? null : this.getNames().get(0); }
|
||||||
public void setName(String name) { this.names = new MassiveList<String>(name); }
|
public void setName(String name) { this.names = new MassiveList<>(name); }
|
||||||
public void setNames(String... names) { this.names = new MassiveList<String>(names); }
|
public void setNames(String... names) { this.names = new MassiveList<>(names); }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// REQUIREMENTS
|
// REQUIREMENTS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected List<Requirement> requirements = new ArrayList<Requirement>();
|
protected List<Requirement> requirements = new ArrayList<>();
|
||||||
|
|
||||||
public List<Requirement> getRequirements() { return this.requirements; }
|
public List<Requirement> getRequirements() { return this.requirements; }
|
||||||
public void setRequirements(List<Requirement> requirements) { this.requirements = requirements; }
|
public void setRequirements(List<Requirement> requirements) { this.requirements = requirements; }
|
||||||
@ -87,7 +87,7 @@ public abstract class Property<O, V> implements Named
|
|||||||
{
|
{
|
||||||
this.objectType = objectType;
|
this.objectType = objectType;
|
||||||
this.valueType = valueType;
|
this.valueType = valueType;
|
||||||
this.names = new MassiveList<String>(names);
|
this.names = new MassiveList<>(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Property(Type<O> objectType, Type<V> valueType, String... names)
|
public Property(Type<O> objectType, Type<V> valueType, String... names)
|
||||||
@ -145,9 +145,9 @@ public abstract class Property<O, V> implements Named
|
|||||||
|
|
||||||
public Entry<O, V> getInheritedEntry(O object)
|
public Entry<O, V> getInheritedEntry(O object)
|
||||||
{
|
{
|
||||||
if (object == null) return new SimpleEntry<O, V>(null, null);
|
if (object == null) return new SimpleEntry<>(null, null);
|
||||||
V value = this.getValue(object);
|
V value = this.getValue(object);
|
||||||
return new SimpleEntry<O, V>(object, value);
|
return new SimpleEntry<>(object, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public O getInheritedObject(O object)
|
public O getInheritedObject(O object)
|
||||||
|
@ -50,7 +50,7 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
Set<String> collnames = new TreeSet<String>(ComparatorNaturalOrder.get());
|
Set<String> collnames = new TreeSet<>(ComparatorNaturalOrder.get());
|
||||||
collnames.addAll(db.getCollnames());
|
collnames.addAll(db.getCollnames());
|
||||||
|
|
||||||
// Do it!
|
// Do it!
|
||||||
|
@ -40,7 +40,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
|||||||
int page = this.readArg();
|
int page = this.readArg();
|
||||||
|
|
||||||
// Pager Create
|
// Pager Create
|
||||||
Pager<Aspect> pager = new Pager<Aspect>(this, "Aspect List", page, AspectColl.get().getAllRegistered(), new Stringifier<Aspect>()
|
Pager<Aspect> pager = new Pager<>(this, "Aspect List", page, AspectColl.get().getAllRegistered(), new Stringifier<Aspect>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String toString(Aspect aspect, int index)
|
public String toString(Aspect aspect, int index)
|
||||||
|
@ -40,7 +40,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
|||||||
int page = this.readArg();
|
int page = this.readArg();
|
||||||
|
|
||||||
// Pager Create
|
// Pager Create
|
||||||
Pager<Multiverse> pager = new Pager<Multiverse>(this, "Multiverse List", page, MultiverseColl.get().getAll(), new Stringifier<Multiverse>()
|
Pager<Multiverse> pager = new Pager<>(this, "Multiverse List", page, MultiverseColl.get().getAll(), new Stringifier<Multiverse>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String toString(Multiverse multiverse, int index)
|
public String toString(Multiverse multiverse, int index)
|
||||||
|
@ -60,7 +60,7 @@ public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
|
|||||||
|
|
||||||
public void msgAspects(List<Aspect> aspects)
|
public void msgAspects(List<Aspect> aspects)
|
||||||
{
|
{
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<>();
|
||||||
for (Aspect aspect : aspects)
|
for (Aspect aspect : aspects)
|
||||||
{
|
{
|
||||||
ids.add(aspect.getId());
|
ids.add(aspect.getId());
|
||||||
|
@ -6,10 +6,10 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
public interface Requirement extends Predicate<CommandSender>
|
public interface Requirement extends Predicate<CommandSender>
|
||||||
{
|
{
|
||||||
public boolean apply(CommandSender sender, MassiveCommand command);
|
boolean apply(CommandSender sender, MassiveCommand command);
|
||||||
|
|
||||||
// This just composes the error message and does NOT test the requirement at all.
|
// This just composes the error message and does NOT test the requirement at all.
|
||||||
|
|
||||||
public String createErrorMessage(CommandSender sender);
|
String createErrorMessage(CommandSender sender);
|
||||||
public String createErrorMessage(CommandSender sender, MassiveCommand command);
|
String createErrorMessage(CommandSender sender, MassiveCommand command);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class RequirementAnd extends RequirementAbstract
|
|||||||
public static RequirementAnd get(Collection<Requirement> requirements) { return new RequirementAnd(requirements); }
|
public static RequirementAnd get(Collection<Requirement> requirements) { return new RequirementAnd(requirements); }
|
||||||
public RequirementAnd(Collection<Requirement> requirements)
|
public RequirementAnd(Collection<Requirement> requirements)
|
||||||
{
|
{
|
||||||
this.requirements = Collections.unmodifiableList(new ArrayList<Requirement>(requirements));
|
this.requirements = Collections.unmodifiableList(new ArrayList<>(requirements));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -21,111 +21,111 @@ public interface Type<T> extends Named
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// Human friendly name
|
// Human friendly name
|
||||||
public String getName();
|
String getName();
|
||||||
|
|
||||||
public Class<T> getClazz();
|
Class<T> getClazz();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INNER TYPE
|
// INNER TYPE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public <I extends Type<?>> List<I> getInnerTypes();
|
<I extends Type<?>> List<I> getInnerTypes();
|
||||||
public <I extends Type<?>> I getInnerType(int index);
|
<I extends Type<?>> I getInnerType(int index);
|
||||||
public <I extends Type<?>> I getInnerType();
|
<I extends Type<?>> I getInnerType();
|
||||||
|
|
||||||
public void setInnerTypes(Collection<Type<?>> innerTypes);
|
void setInnerTypes(Collection<Type<?>> innerTypes);
|
||||||
public void setInnerTypes(Type<?>... innerTypes);
|
void setInnerTypes(Type<?>... innerTypes);
|
||||||
public void setInnerType(Type<?> innerType);
|
void setInnerType(Type<?> innerType);
|
||||||
|
|
||||||
public void setUserOrder(List<Integer> userOrder);
|
void setUserOrder(List<Integer> userOrder);
|
||||||
public void setUserOrder(Integer... userOrder);
|
void setUserOrder(Integer... userOrder);
|
||||||
public List<Integer> getUserOrder();
|
List<Integer> getUserOrder();
|
||||||
public Integer getIndexUser(int indexTechy);
|
Integer getIndexUser(int indexTechy);
|
||||||
public Integer getIndexTech(int indexUser);
|
Integer getIndexTech(int indexUser);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INNER PROPERTY
|
// INNER PROPERTY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean hasInnerProperties();
|
boolean hasInnerProperties();
|
||||||
|
|
||||||
public <I extends Property<T, ?>> List<I> getInnerProperties();
|
<I extends Property<T, ?>> List<I> getInnerProperties();
|
||||||
public <I extends Property<T, ?>> I getInnerProperty(int index);
|
<I extends Property<T, ?>> I getInnerProperty(int index);
|
||||||
|
|
||||||
public <I extends Property<T, ?>> void setInnerProperties(Collection<I> innerTypes);
|
<I extends Property<T, ?>> void setInnerProperties(Collection<I> innerTypes);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <I extends Property<T, ?>> void setInnerProperties(I... innerTypes);
|
<I extends Property<T, ?>> void setInnerProperties(I... innerTypes);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE VISUAL COLOR
|
// WRITE VISUAL COLOR
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public ChatColor getVisualColor(T value, CommandSender sender);
|
ChatColor getVisualColor(T value, CommandSender sender);
|
||||||
public ChatColor getVisualColor(T value);
|
ChatColor getVisualColor(T value);
|
||||||
public void setVisualColor(ChatColor color);
|
void setVisualColor(ChatColor color);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE SHOW
|
// WRITE SHOW
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// A list of property values.
|
// A list of property values.
|
||||||
|
|
||||||
public List<Mson> getShowInner(T value, CommandSender sender);
|
List<Mson> getShowInner(T value, CommandSender sender);
|
||||||
public List<Mson> getShow(T value, CommandSender sender);
|
List<Mson> getShow(T value, CommandSender sender);
|
||||||
public List<Mson> getShow(T value);
|
List<Mson> getShow(T value);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE VISUAL MSON
|
// WRITE VISUAL MSON
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// A visual mson.
|
// A visual mson.
|
||||||
|
|
||||||
public Mson getVisualMsonInner(T value, CommandSender sender);
|
Mson getVisualMsonInner(T value, CommandSender sender);
|
||||||
public Mson getVisualMson(T value, CommandSender sender);
|
Mson getVisualMson(T value, CommandSender sender);
|
||||||
public Mson getVisualMson(T value);
|
Mson getVisualMson(T value);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE VISUAL
|
// WRITE VISUAL
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// A visual and colorful representation. Possibly with added detail such as simple ASCII art.
|
// A visual and colorful representation. Possibly with added detail such as simple ASCII art.
|
||||||
|
|
||||||
public String getVisualInner(T value, CommandSender sender);
|
String getVisualInner(T value, CommandSender sender);
|
||||||
public String getVisual(T value, CommandSender sender);
|
String getVisual(T value, CommandSender sender);
|
||||||
public String getVisual(T value);
|
String getVisual(T value);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE NAME
|
// WRITE NAME
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// A human friendly but simple representation without color and clutter.
|
// A human friendly but simple representation without color and clutter.
|
||||||
|
|
||||||
public String getNameInner(T value);
|
String getNameInner(T value);
|
||||||
public String getName(T value);
|
String getName(T value);
|
||||||
public Set<String> getNamesInner(T value);
|
Set<String> getNamesInner(T value);
|
||||||
public Set<String> getNames(T value);
|
Set<String> getNames(T value);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE ID
|
// WRITE ID
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// System identification string. Most times unsuitable for humans.
|
// System identification string. Most times unsuitable for humans.
|
||||||
|
|
||||||
public String getIdInner(T value);
|
String getIdInner(T value);
|
||||||
public String getId(T value);
|
String getId(T value);
|
||||||
public Set<String> getIdsInner(T value);
|
Set<String> getIdsInner(T value);
|
||||||
public Set<String> getIds(T value);
|
Set<String> getIds(T value);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// READ
|
// READ
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public T read(String arg, CommandSender sender) throws MassiveException;
|
T read(String arg, CommandSender sender) throws MassiveException;
|
||||||
public T read(CommandSender sender) throws MassiveException;
|
T read(CommandSender sender) throws MassiveException;
|
||||||
public T read(String arg) throws MassiveException;
|
T read(String arg) throws MassiveException;
|
||||||
public T read() throws MassiveException;
|
T read() throws MassiveException;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// VALID
|
// VALID
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Used for arbitrary argument order
|
// Used for arbitrary argument order
|
||||||
|
|
||||||
public boolean isValid(String arg, CommandSender sender);
|
boolean isValid(String arg, CommandSender sender);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// TAB LIST
|
// TAB LIST
|
||||||
@ -133,48 +133,48 @@ public interface Type<T> extends Named
|
|||||||
|
|
||||||
// The sender is the one that tried to tab complete.
|
// The sender is the one that tried to tab complete.
|
||||||
// The arg is beginning the word they are trying to tab complete.
|
// The arg is beginning the word they are trying to tab complete.
|
||||||
public Collection<String> getTabList(CommandSender sender, String arg);
|
Collection<String> getTabList(CommandSender sender, String arg);
|
||||||
public List<String> getTabListFiltered(CommandSender sender, String arg);
|
List<String> getTabListFiltered(CommandSender sender, String arg);
|
||||||
|
|
||||||
// Sometimes we put a space after a tab completion.
|
// Sometimes we put a space after a tab completion.
|
||||||
// That would however not make sense with all Types.
|
// That would however not make sense with all Types.
|
||||||
// Default is true;
|
// Default is true;
|
||||||
public boolean allowSpaceAfterTab();
|
boolean allowSpaceAfterTab();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONTAINER > IS
|
// CONTAINER > IS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean isContainer();
|
boolean isContainer();
|
||||||
public boolean isContainerMap();
|
boolean isContainerMap();
|
||||||
public boolean isContainerCollection();
|
boolean isContainerCollection();
|
||||||
|
|
||||||
public boolean isContainerIndexed();
|
boolean isContainerIndexed();
|
||||||
public boolean isContainerOrdered();
|
boolean isContainerOrdered();
|
||||||
public boolean isContainerSorted();
|
boolean isContainerSorted();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONTAINER > COMPARATOR
|
// CONTAINER > COMPARATOR
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public <E> Comparator<E> getContainerComparator();
|
<E> Comparator<E> getContainerComparator();
|
||||||
public void setContainerComparator(Comparator<?> container);
|
void setContainerComparator(Comparator<?> container);
|
||||||
|
|
||||||
public <E> List<E> getContainerElementsOrdered(Iterable<E> elements);
|
<E> List<E> getContainerElementsOrdered(Iterable<E> elements);
|
||||||
public <E> List<E> getContainerElementsOrdered(T container);
|
<E> List<E> getContainerElementsOrdered(T container);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// EQUALS
|
// EQUALS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean equals(T type1, T type2);
|
boolean equals(T type1, T type2);
|
||||||
public boolean equalsInner(T type1, T type2);
|
boolean equalsInner(T type1, T type2);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// EDITOR
|
// EDITOR
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public <O> CommandEditAbstract<O, T> createEditCommand(EditSettings<O> settings, Property<O, T> property);
|
<O> CommandEditAbstract<O, T> createEditCommand(EditSettings<O> settings, Property<O, T> property);
|
||||||
public T createNewInstance();
|
T createNewInstance();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,8 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override public void setInnerTypes(Collection<Type<?>> innerTypes) { this.innerTypes = new MassiveList(innerTypes); }
|
@Override public void setInnerTypes(Collection<Type<?>> innerTypes) { this.innerTypes = new MassiveList(innerTypes); }
|
||||||
@Override public void setInnerTypes(Type<?>... innerTypes) { this.setInnerTypes(Arrays.asList(innerTypes)); };
|
@Override public void setInnerTypes(Type<?>... innerTypes) { this.setInnerTypes(Arrays.asList(innerTypes)); }
|
||||||
|
|
||||||
@Override public void setInnerType(Type<?> innerType) { this.setInnerTypes(innerType); }
|
@Override public void setInnerType(Type<?> innerType) { this.setInnerTypes(innerType); }
|
||||||
|
|
||||||
private List<Integer> userOrder = null;
|
private List<Integer> userOrder = null;
|
||||||
@ -521,7 +522,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<String>(suggestions.size());
|
LinkedHashSet<String> ret = new LinkedHashSet<>(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)
|
||||||
{
|
{
|
||||||
@ -540,7 +541,7 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
ret.add(suggestion.substring(prefix.length(), lastIndex));
|
ret.add(suggestion.substring(prefix.length(), lastIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ArrayList<String>(ret);
|
return new ArrayList<>(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -602,11 +603,11 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
List<E> ret;
|
List<E> ret;
|
||||||
if (elements instanceof Collection<?>)
|
if (elements instanceof Collection<?>)
|
||||||
{
|
{
|
||||||
ret = new MassiveList<E>((Collection<E>)elements);
|
ret = new MassiveList<>((Collection<E>) elements);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = new MassiveList<E>();
|
ret = new MassiveList<>();
|
||||||
for (E element : elements)
|
for (E element : elements)
|
||||||
{
|
{
|
||||||
ret.add(element);
|
ret.add(element);
|
||||||
@ -653,11 +654,11 @@ public abstract class TypeAbstract<T> implements Type<T>
|
|||||||
{
|
{
|
||||||
if (this.hasInnerProperties())
|
if (this.hasInnerProperties())
|
||||||
{
|
{
|
||||||
return new CommandEditProperties<O, T>(settings, property);
|
return new CommandEditProperties<>(settings, property);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new CommandEditSimple<O, T>(settings, property);
|
return new CommandEditSimple<>(settings, property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
public Collection<T> getAll() { return all; }
|
public Collection<T> getAll() { return all; }
|
||||||
public void setAll(Collection<T> all)
|
public void setAll(Collection<T> all)
|
||||||
{
|
{
|
||||||
if (all != null) all = Collections.unmodifiableCollection(new MassiveList<T>(all));
|
if (all != null) all = Collections.unmodifiableCollection(new MassiveList<>(all));
|
||||||
this.all = all;
|
this.all = all;
|
||||||
|
|
||||||
if (all == null)
|
if (all == null)
|
||||||
@ -242,7 +242,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
if ( ! this.isCanSeeOverridden()) return this.getAll();
|
if ( ! this.isCanSeeOverridden()) return this.getAll();
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
Set<T> ret = new MassiveSet<T>();
|
Set<T> ret = new MassiveSet<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (T value : this.getAll())
|
for (T value : this.getAll())
|
||||||
@ -272,7 +272,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
public List<T> getMatches(Map<String, T> options, String arg, boolean levenshtein)
|
public List<T> getMatches(Map<String, T> options, String arg, boolean levenshtein)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<T> ret = new MassiveList<T>();
|
List<T> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
arg = this.prepareOptionKey(arg);
|
arg = this.prepareOptionKey(arg);
|
||||||
@ -331,7 +331,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
public Map<String, T> createOptions(Iterable<T> all)
|
public Map<String, T> createOptions(Iterable<T> all)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Map<String, T> ret = new MassiveMap<String, T>();
|
Map<String, T> ret = new MassiveMap<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (T value : all)
|
for (T value : all)
|
||||||
@ -351,7 +351,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
public List<String> createOptionKeys(T value)
|
public List<String> createOptionKeys(T value)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<String> ret = new MassiveList<String>();
|
List<String> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
String string;
|
String string;
|
||||||
@ -399,7 +399,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
|
|||||||
public Set<String> createTabs(CommandSender sender)
|
public Set<String> createTabs(CommandSender sender)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Set<String> ret = new MassiveSet<String>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (T value : this.getAll(sender))
|
for (T value : this.getAll(sender))
|
||||||
|
@ -52,7 +52,7 @@ public abstract class TypeAbstractSelect<T> extends TypeAbstract<T> implements A
|
|||||||
|
|
||||||
public Collection<String> altNames(CommandSender sender)
|
public Collection<String> altNames(CommandSender sender)
|
||||||
{
|
{
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<>();
|
||||||
for (T value : this.getAll(sender))
|
for (T value : this.getAll(sender))
|
||||||
{
|
{
|
||||||
String name = this.getVisual(value, sender);
|
String name = this.getVisual(value, sender);
|
||||||
@ -107,7 +107,7 @@ public abstract class TypeAbstractSelect<T> extends TypeAbstract<T> implements A
|
|||||||
arg = arg.toLowerCase();
|
arg = arg.toLowerCase();
|
||||||
|
|
||||||
// Try Levenshtein
|
// Try Levenshtein
|
||||||
List<String> matches = new ArrayList<String>();
|
List<String> matches = new ArrayList<>();
|
||||||
|
|
||||||
for (String alias : this.altNames(sender))
|
for (String alias : this.altNames(sender))
|
||||||
{
|
{
|
||||||
|
@ -23,17 +23,17 @@ public class TypeNullable<T> extends TypeWrapper<T>
|
|||||||
|
|
||||||
public static <T> TypeNullable<T> get(Type<T> inner, Collection<String> nulls)
|
public static <T> TypeNullable<T> get(Type<T> inner, Collection<String> nulls)
|
||||||
{
|
{
|
||||||
return new TypeNullable<T>(inner, nulls);
|
return new TypeNullable<>(inner, nulls);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> TypeNullable<T> get(Type<T> inner, String... nulls)
|
public static <T> TypeNullable<T> get(Type<T> inner, String... nulls)
|
||||||
{
|
{
|
||||||
return new TypeNullable<T>(inner, nulls);
|
return new TypeNullable<>(inner, nulls);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> TypeNullable<T> get(Type<T> inner)
|
public static <T> TypeNullable<T> get(Type<T> inner)
|
||||||
{
|
{
|
||||||
return new TypeNullable<T>(inner);
|
return new TypeNullable<>(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -83,7 +83,7 @@ public class TypeStringCommand extends TypeAbstract<String>
|
|||||||
List<String> subcompletions = command.tabComplete(sender, alias, Arrays.copyOfRange(args, 1, args.length));
|
List<String> subcompletions = command.tabComplete(sender, alias, Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
|
||||||
String prefix = Txt.implode(Arrays.copyOfRange(args, 0, args.length-1), " ") + " ";
|
String prefix = Txt.implode(Arrays.copyOfRange(args, 0, args.length-1), " ") + " ";
|
||||||
List<String> ret = new MassiveList<String>();
|
List<String> ret = new MassiveList<>();
|
||||||
|
|
||||||
for (String subcompletion : subcompletions)
|
for (String subcompletion : subcompletions)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public abstract class TypeTransformer<I, O> extends TypeAbstract<O>
|
|||||||
public static Set<String> prefix(Set<String> strings)
|
public static Set<String> prefix(Set<String> strings)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Set<String> ret = new MassiveSet<String>(strings.size());
|
Set<String> ret = new MassiveSet<>(strings.size());
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (String string : strings)
|
for (String string : strings)
|
||||||
|
@ -78,7 +78,7 @@ public class TypeWrapper<T> extends TypeAbstract<T>
|
|||||||
@Override
|
@Override
|
||||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||||
{
|
{
|
||||||
return new MassiveList<String>(this.getInnerType().getTabList(sender, arg));
|
return new MassiveList<>(this.getInnerType().getTabList(sender, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -237,7 +237,7 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
|
|||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<String> parts = new MassiveList<String>();
|
List<String> parts = new MassiveList<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (Type<?> type : this.getInnerTypes())
|
for (Type<?> type : this.getInnerTypes())
|
||||||
@ -386,7 +386,7 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
|
|||||||
public List<Object> readParts(String arg, CommandSender sender) throws MassiveException
|
public List<Object> readParts(String arg, CommandSender sender) throws MassiveException
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<Object> ret = new MassiveList<Object>();
|
List<Object> ret = new MassiveList<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
List<String> innerArgs = this.getArgs(arg);
|
List<String> innerArgs = this.getArgs(arg);
|
||||||
@ -417,7 +417,7 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
|
|||||||
String innerArg = this.getLastArg(arg);
|
String innerArg = this.getLastArg(arg);
|
||||||
String prefix = arg.substring(0, arg.length() - innerArg.length());
|
String prefix = arg.substring(0, arg.length() - innerArg.length());
|
||||||
List<String> strings = innerType.getTabListFiltered(sender, innerArg);
|
List<String> strings = innerType.getTabListFiltered(sender, innerArg);
|
||||||
List<String> ret = new MassiveList<String>();
|
List<String> ret = new MassiveList<>();
|
||||||
for (String string : strings)
|
for (String string : strings)
|
||||||
{
|
{
|
||||||
ret.add(prefix + string);
|
ret.add(prefix + string);
|
||||||
|
@ -20,7 +20,7 @@ public class TypeEntry<K, V> extends TypeCombined<Entry<K, V>>
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static <K, V> TypeEntry<K, V> get(Type<K> keyType, Type<V> valueType) { return new TypeEntry<K, V>(keyType, valueType); }
|
public static <K, V> TypeEntry<K, V> get(Type<K> keyType, Type<V> valueType) { return new TypeEntry<>(keyType, valueType); }
|
||||||
public TypeEntry(Type<K> keyType, Type<V> valueType)
|
public TypeEntry(Type<K> keyType, Type<V> valueType)
|
||||||
{
|
{
|
||||||
super(Entry.class, keyType, valueType);
|
super(Entry.class, keyType, valueType);
|
||||||
|
@ -19,7 +19,7 @@ public class TypeBackstringSet<E extends Enum<E>> extends TypeContainer<Set<E>,
|
|||||||
|
|
||||||
public static <E extends Enum<E>> TypeBackstringSet<E> get(Type<E> innerType)
|
public static <E extends Enum<E>> TypeBackstringSet<E> get(Type<E> innerType)
|
||||||
{
|
{
|
||||||
return new TypeBackstringSet<E>(innerType);
|
return new TypeBackstringSet<>(innerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeBackstringSet(Type<E> innerType)
|
public TypeBackstringSet(Type<E> innerType)
|
||||||
@ -35,7 +35,7 @@ public class TypeBackstringSet<E extends Enum<E>> extends TypeContainer<Set<E>,
|
|||||||
@Override
|
@Override
|
||||||
public BackstringSet<E> createNewInstance()
|
public BackstringSet<E> createNewInstance()
|
||||||
{
|
{
|
||||||
return new BackstringSet<E>((Class<E>) innerTypeClass);
|
return new BackstringSet<>((Class<E>) innerTypeClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
public abstract class TypeContainer<C, E> extends TypeAbstract<C>
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
@ -267,7 +267,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
|
|||||||
@Override
|
@Override
|
||||||
public <O> CommandEditAbstract<O, C> createEditCommand(EditSettings<O> settings, Property<O, C> property)
|
public <O> CommandEditAbstract<O, C> createEditCommand(EditSettings<O> settings, Property<O, C> property)
|
||||||
{
|
{
|
||||||
return new CommandEditContainer<O, C>(settings, property);
|
return new CommandEditContainer<>(settings, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -29,7 +29,7 @@ public class TypeItemStacks extends TypeList<ItemStack>
|
|||||||
@Override
|
@Override
|
||||||
public <O> CommandEditAbstract<O, List<ItemStack>> createEditCommand(EditSettings<O> settings, Property<O, List<ItemStack>> property)
|
public <O> CommandEditAbstract<O, List<ItemStack>> createEditCommand(EditSettings<O> settings, Property<O, List<ItemStack>> property)
|
||||||
{
|
{
|
||||||
return new CommandEditItemStacks<O>(settings, property);
|
return new CommandEditItemStacks<>(settings, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class TypeList<E> extends TypeContainer<List<E>, E>
|
|||||||
|
|
||||||
public static <E> TypeList<E> get(Type<E> innerType)
|
public static <E> TypeList<E> get(Type<E> innerType)
|
||||||
{
|
{
|
||||||
return new TypeList<E>(innerType);
|
return new TypeList<>(innerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeList(Type<E> innerType)
|
public TypeList(Type<E> innerType)
|
||||||
@ -28,7 +28,7 @@ public class TypeList<E> extends TypeContainer<List<E>, E>
|
|||||||
@Override
|
@Override
|
||||||
public List<E> createNewInstance()
|
public List<E> createNewInstance()
|
||||||
{
|
{
|
||||||
return new MassiveList<E>();
|
return new MassiveList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class TypeMap<K, V> extends TypeContainer<Map<K, V>, Entry<K, V>>
|
|||||||
|
|
||||||
public static <K, V> TypeMap<K, V> get(TypeEntry<K, V> entryType)
|
public static <K, V> TypeMap<K, V> get(TypeEntry<K, V> entryType)
|
||||||
{
|
{
|
||||||
return new TypeMap<K, V>(entryType);
|
return new TypeMap<>(entryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeMap(TypeEntry<K, V> entryType)
|
public TypeMap(TypeEntry<K, V> entryType)
|
||||||
@ -43,7 +43,7 @@ public class TypeMap<K, V> extends TypeContainer<Map<K, V>, Entry<K, V>>
|
|||||||
@Override
|
@Override
|
||||||
public Map<K, V> createNewInstance()
|
public Map<K, V> createNewInstance()
|
||||||
{
|
{
|
||||||
return new MassiveMap<K, V>();
|
return new MassiveMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class TypeSet<E> extends TypeContainer<Set<E>, E>
|
|||||||
|
|
||||||
public static <E> TypeSet<E> get(Type<E> innerType)
|
public static <E> TypeSet<E> get(Type<E> innerType)
|
||||||
{
|
{
|
||||||
return new TypeSet<E>(innerType);
|
return new TypeSet<>(innerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeSet(Type<E> innerType)
|
public TypeSet(Type<E> innerType)
|
||||||
@ -28,7 +28,7 @@ public class TypeSet<E> extends TypeContainer<Set<E>, E>
|
|||||||
@Override
|
@Override
|
||||||
public Set<E> createNewInstance()
|
public Set<E> createNewInstance()
|
||||||
{
|
{
|
||||||
return new MassiveSet<E>();
|
return new MassiveSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class TypeEntityType extends TypeEnum<EntityType>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getNamesInner(EntityType value)
|
public Set<String> getNamesInner(EntityType value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>(super.getNamesInner(value));
|
Set<String> ret = new MassiveSet<>(super.getNamesInner(value));
|
||||||
|
|
||||||
if (value == EntityType.PIG_ZOMBIE)
|
if (value == EntityType.PIG_ZOMBIE)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public class TypeEnvironment extends TypeEnum<Environment>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getNamesInner(Environment value)
|
public Set<String> getNamesInner(Environment value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>(super.getNamesInner(value));
|
Set<String> ret = new MassiveSet<>(super.getNamesInner(value));
|
||||||
|
|
||||||
if (value == Environment.NORMAL)
|
if (value == Environment.NORMAL)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public class TypeGameMode extends TypeEnum<GameMode>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getIdsInner(GameMode value)
|
public Set<String> getIdsInner(GameMode value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>(super.getIdsInner(value));
|
Set<String> ret = new MassiveSet<>(super.getIdsInner(value));
|
||||||
|
|
||||||
int idInt = getIntegerId(value);
|
int idInt = getIntegerId(value);
|
||||||
String idString = String.valueOf(idInt);
|
String idString = String.valueOf(idInt);
|
||||||
|
@ -26,7 +26,7 @@ public class TypeMaterial extends TypeEnum<Material>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getIdsInner(Material value)
|
public Set<String> getIdsInner(Material value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>(super.getIdsInner(value));
|
Set<String> ret = new MassiveSet<>(super.getIdsInner(value));
|
||||||
|
|
||||||
String id = String.valueOf(value.getId());
|
String id = String.valueOf(value.getId());
|
||||||
ret.add(id);
|
ret.add(id);
|
||||||
|
@ -17,7 +17,7 @@ public class TypeSound extends TypeEnum<Sound>
|
|||||||
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/Sound.java?until=7898a2a2d2d81308e73e9ed37725f53d7ad37bfc&at=refs%2Fheads%2Fmaster
|
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/Sound.java?until=7898a2a2d2d81308e73e9ed37725f53d7ad37bfc&at=refs%2Fheads%2Fmaster
|
||||||
|
|
||||||
// Maps every sound in Minecraft 1.8 to the new sound in Minecraft 1.9
|
// Maps every sound in Minecraft 1.8 to the new sound in Minecraft 1.9
|
||||||
public static Map<String, String> FROM_18_TO_19 = new MassiveMap<String, String>(
|
public static Map<String, String> FROM_18_TO_19 = new MassiveMap<>(
|
||||||
"AMBIENCE_CAVE", "AMBIENT_CAVE",
|
"AMBIENCE_CAVE", "AMBIENT_CAVE",
|
||||||
"AMBIENCE_RAIN", "WEATHER_RAIN",
|
"AMBIENCE_RAIN", "WEATHER_RAIN",
|
||||||
"AMBIENCE_THUNDER", "ENTITY_LIGHTNING_THUNDER",
|
"AMBIENCE_THUNDER", "ENTITY_LIGHTNING_THUNDER",
|
||||||
@ -302,7 +302,7 @@ public class TypeSound extends TypeEnum<Sound>
|
|||||||
public Set<String> getIdsInner(Sound value)
|
public Set<String> getIdsInner(Sound value)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Set<String> ret = new MassiveSet<String>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
String current = value.name();
|
String current = value.name();
|
||||||
|
@ -46,7 +46,7 @@ public class TypeWeatherType extends TypeEnum<WeatherType>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getNamesInner(WeatherType value)
|
public Set<String> getNamesInner(WeatherType value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public class TypeWorldType extends TypeEnum<WorldType>
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getNamesInner(WorldType value)
|
public Set<String> getNamesInner(WorldType value)
|
||||||
{
|
{
|
||||||
Set<String> ret = new MassiveSet<String>(super.getNamesInner(value));
|
Set<String> ret = new MassiveSet<>(super.getNamesInner(value));
|
||||||
|
|
||||||
if (value == WorldType.NORMAL)
|
if (value == WorldType.NORMAL)
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,13 @@ public abstract class TypeBooleanAbstract extends TypeAbstractChoice<Boolean>
|
|||||||
public static final String NAME_FALSE = "False";
|
public static final String NAME_FALSE = "False";
|
||||||
public static final String NAME_OFF = "Off";
|
public static final String NAME_OFF = "Off";
|
||||||
|
|
||||||
public static final Set<String> NAMES_TRUE = new MassiveSet<String>(
|
public static final Set<String> NAMES_TRUE = new MassiveSet<>(
|
||||||
NAME_YES,
|
NAME_YES,
|
||||||
NAME_TRUE,
|
NAME_TRUE,
|
||||||
NAME_ON
|
NAME_ON
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final Set<String> NAMES_FALSE = new MassiveSet<String>(
|
public static final Set<String> NAMES_FALSE = new MassiveSet<>(
|
||||||
NAME_NO,
|
NAME_NO,
|
||||||
NAME_FALSE,
|
NAME_FALSE,
|
||||||
NAME_OFF
|
NAME_OFF
|
||||||
@ -86,7 +86,7 @@ public abstract class TypeBooleanAbstract extends TypeAbstractChoice<Boolean>
|
|||||||
public Set<String> getNamesInner(Boolean value)
|
public Set<String> getNamesInner(Boolean value)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Set<String> ret = new MassiveSet<String>();
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
ret.add(this.getNameInner(value));
|
ret.add(this.getNameInner(value));
|
||||||
|
@ -21,7 +21,7 @@ public class TypeObject<T> extends TypeAbstract<T>
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> TypeObject<T> get() { return (TypeObject<T>) i; }*/
|
public static <T> TypeObject<T> get() { return (TypeObject<T>) i; }*/
|
||||||
|
|
||||||
public static <T> TypeObject<T> get(Class<T> clazz) { return new TypeObject<T>(clazz); }
|
public static <T> TypeObject<T> get(Class<T> clazz) { return new TypeObject<>(clazz); }
|
||||||
|
|
||||||
public TypeObject(Class<T> clazz)
|
public TypeObject(Class<T> clazz)
|
||||||
{
|
{
|
||||||
|
@ -46,10 +46,10 @@ public class TypeSenderEntity<T extends SenderEntity<T>> extends TypeSenderIdAbs
|
|||||||
// GET
|
// GET
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence, SenderType type) { return new TypeSenderEntity<T>(coll, presence, type); }
|
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence, SenderType type) { return new TypeSenderEntity<>(coll, presence, type); }
|
||||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence) { return new TypeSenderEntity<T>(coll, presence); }
|
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderPresence presence) { return new TypeSenderEntity<>(coll, presence); }
|
||||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderType type) { return new TypeSenderEntity<T>(coll, type); }
|
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll, SenderType type) { return new TypeSenderEntity<>(coll, type); }
|
||||||
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll) { return new TypeSenderEntity<T>(coll); }
|
public static <T extends SenderEntity<T>> TypeSenderEntity<T> get(SenderColl<T> coll) { return new TypeSenderEntity<>(coll); }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
|
@ -166,7 +166,7 @@ public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
|
|||||||
boolean addIds = (arg.length() >= TAB_LIST_UUID_THRESHOLD);
|
boolean addIds = (arg.length() >= TAB_LIST_UUID_THRESHOLD);
|
||||||
int size = ids.size();
|
int size = ids.size();
|
||||||
if (addIds) size *= 2;
|
if (addIds) size *= 2;
|
||||||
Set<String> ret = new MassiveSet<String>(size);
|
Set<String> ret = new MassiveSet<>(size);
|
||||||
for (String id : ids)
|
for (String id : ids)
|
||||||
{
|
{
|
||||||
if ( ! MixinVisibility.get().isVisible(id, sender)) continue;
|
if ( ! MixinVisibility.get().isVisible(id, sender)) continue;
|
||||||
|
@ -9,7 +9,7 @@ public class ComparatorEntryKey<K, V> extends ComparatorAbstractTransformer<Entr
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static <K, V> ComparatorEntryKey<K, V> get(Comparator<K> comparator) { return new ComparatorEntryKey<K, V>(comparator); }
|
public static <K, V> ComparatorEntryKey<K, V> get(Comparator<K> comparator) { return new ComparatorEntryKey<>(comparator); }
|
||||||
public ComparatorEntryKey(Comparator<K> comparator)
|
public ComparatorEntryKey(Comparator<K> comparator)
|
||||||
{
|
{
|
||||||
super(comparator);
|
super(comparator);
|
||||||
|
@ -9,7 +9,7 @@ public class ComparatorEntryValue<K, V> extends ComparatorAbstractTransformer<En
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static <K, V> ComparatorEntryValue<K, V> get(Comparator<V> comparator) { return new ComparatorEntryValue<K, V>(comparator); }
|
public static <K, V> ComparatorEntryValue<K, V> get(Comparator<V> comparator) { return new ComparatorEntryValue<>(comparator); }
|
||||||
public ComparatorEntryValue(Comparator<V> comparator)
|
public ComparatorEntryValue(Comparator<V> comparator)
|
||||||
{
|
{
|
||||||
super(comparator);
|
super(comparator);
|
||||||
|
@ -8,7 +8,7 @@ public class ComparatorReversed<T> extends ComparatorAbstractWrapper<T, T>
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static <T> ComparatorReversed<T> get(Comparator<T> comparator) { return new ComparatorReversed<T>(comparator); }
|
public static <T> ComparatorReversed<T> get(Comparator<T> comparator) { return new ComparatorReversed<>(comparator); }
|
||||||
public ComparatorReversed(Comparator<T> comparator)
|
public ComparatorReversed(Comparator<T> comparator)
|
||||||
{
|
{
|
||||||
super(comparator);
|
super(comparator);
|
||||||
|
@ -50,7 +50,7 @@ public class EngineMassiveCoreCommandRegistration extends Engine
|
|||||||
Map<String, Command> knownCommands = getSimpleCommandMapDotKnownCommands(simpleCommandMap);
|
Map<String, Command> knownCommands = getSimpleCommandMapDotKnownCommands(simpleCommandMap);
|
||||||
|
|
||||||
// Step #2: Create a "name --> target" map that contains the MassiveCommands that /should/ be registered in Bukkit.
|
// Step #2: Create a "name --> target" map that contains the MassiveCommands that /should/ be registered in Bukkit.
|
||||||
Map<String, MassiveCommand> nameTargets = new HashMap<String, MassiveCommand>();
|
Map<String, MassiveCommand> nameTargets = new HashMap<>();
|
||||||
// For each MassiveCommand that is supposed to be registered ...
|
// For each MassiveCommand that is supposed to be registered ...
|
||||||
for (MassiveCommand massiveCommand : MassiveCommand.getAllInstances())
|
for (MassiveCommand massiveCommand : MassiveCommand.getAllInstances())
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public class EngineMassiveCoreDatabase extends Engine
|
|||||||
// PLAYER AND SENDER REFERENCES
|
// PLAYER AND SENDER REFERENCES
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static Map<String, PlayerLoginEvent> idToPlayerLoginEvent = new MassiveMap<String, PlayerLoginEvent>();
|
public static Map<String, PlayerLoginEvent> idToPlayerLoginEvent = new MassiveMap<>();
|
||||||
|
|
||||||
// Immediately set the sender reference and cached PlayerLoginEvent.
|
// Immediately set the sender reference and cached PlayerLoginEvent.
|
||||||
public static void setSenderReferences(CommandSender sender, CommandSender reference, PlayerLoginEvent event)
|
public static void setSenderReferences(CommandSender sender, CommandSender reference, PlayerLoginEvent event)
|
||||||
@ -170,7 +170,7 @@ public class EngineMassiveCoreDatabase extends Engine
|
|||||||
public Map<SenderColl<?>, Entry<JsonObject, Long>> createRemoteEntries(String playerId)
|
public Map<SenderColl<?>, Entry<JsonObject, Long>> createRemoteEntries(String playerId)
|
||||||
{
|
{
|
||||||
// Create Ret
|
// Create Ret
|
||||||
Map<SenderColl<?>, Entry<JsonObject, Long>> ret = new HashMap<SenderColl<?>, Entry<JsonObject, Long>>();
|
Map<SenderColl<?>, Entry<JsonObject, Long>> ret = new HashMap<>();
|
||||||
|
|
||||||
// Fill Ret
|
// Fill Ret
|
||||||
for (final SenderColl<?> coll : Coll.getSenderInstances())
|
for (final SenderColl<?> coll : Coll.getSenderInstances())
|
||||||
|
@ -81,12 +81,12 @@ public class EngineMassiveCoreDestination extends Engine
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Set<String> ALIASES_TOP = new MassiveSet<String>("top");
|
public static final Set<String> ALIASES_TOP = new MassiveSet<>("top");
|
||||||
public static final Set<String> ALIASES_THERE = new MassiveSet<String>("there");
|
public static final Set<String> ALIASES_THERE = new MassiveSet<>("there");
|
||||||
public static final Set<String> ALIASES_THAT = new MassiveSet<String>("that");
|
public static final Set<String> ALIASES_THAT = new MassiveSet<>("that");
|
||||||
public static final Set<String> ALIASES_JUMP = new MassiveSet<String>("jump");
|
public static final Set<String> ALIASES_JUMP = new MassiveSet<>("jump");
|
||||||
public static final Set<String> ALIASES_WORLD = new MassiveSet<String>("world", "w", "spawn", "wspawn", "worldspawn");
|
public static final Set<String> ALIASES_WORLD = new MassiveSet<>("world", "w", "spawn", "wspawn", "worldspawn");
|
||||||
public static final Set<String> ALIASES_PLAYER = new MassiveSet<String>("player", "p", "here", "me", "self");
|
public static final Set<String> ALIASES_PLAYER = new MassiveSet<>("player", "p", "here", "me", "self");
|
||||||
|
|
||||||
public Destination destinationArg(String arg, CommandSender sender) throws MassiveException
|
public Destination destinationArg(String arg, CommandSender sender) throws MassiveException
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ public class EngineMassiveCoreGank extends Engine
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// NOTE: The usage of WeakHashMap here is important. We would create a memory leak otherwise. WeakHashMap works very well for meta data storage.
|
// NOTE: The usage of WeakHashMap here is important. We would create a memory leak otherwise. WeakHashMap works very well for meta data storage.
|
||||||
protected WeakHashMap<Entity, WeakHashMap<Player, Double>> entityToPlayerDamages = new WeakHashMap<Entity, WeakHashMap<Player, Double>>();
|
protected WeakHashMap<Entity, WeakHashMap<Player, Double>> entityToPlayerDamages = new WeakHashMap<>();
|
||||||
|
|
||||||
protected Map<Player, Double> getPlayerDamages(Entity entity, boolean store)
|
protected Map<Player, Double> getPlayerDamages(Entity entity, boolean store)
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ public class EngineMassiveCoreGank extends Engine
|
|||||||
|
|
||||||
if (ret == null)
|
if (ret == null)
|
||||||
{
|
{
|
||||||
ret = new WeakHashMap<Player, Double>(4);
|
ret = new WeakHashMap<>(4);
|
||||||
if (store)
|
if (store)
|
||||||
{
|
{
|
||||||
this.entityToPlayerDamages.put(entity, ret);
|
this.entityToPlayerDamages.put(entity, ret);
|
||||||
@ -73,7 +73,7 @@ public class EngineMassiveCoreGank extends Engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create Ret
|
// Create Ret
|
||||||
Map<Player, Double> ret = new MassiveMap<Player, Double>(playerDamages.size());
|
Map<Player, Double> ret = new MassiveMap<>(playerDamages.size());
|
||||||
|
|
||||||
// Fill Ret
|
// Fill Ret
|
||||||
for (Entry<Player, Double> playerDamage : playerDamages.entrySet())
|
for (Entry<Player, Double> playerDamage : playerDamages.entrySet())
|
||||||
|
@ -66,7 +66,7 @@ public class EngineMassiveCoreMain extends Engine
|
|||||||
String format = event.getFormat();
|
String format = event.getFormat();
|
||||||
|
|
||||||
// Pick the recipients to avoid the message getting sent without canceling the event.
|
// Pick the recipients to avoid the message getting sent without canceling the event.
|
||||||
Set<Player> players = new HashSet<Player>(event.getRecipients());
|
Set<Player> players = new HashSet<>(event.getRecipients());
|
||||||
event.getRecipients().clear();
|
event.getRecipients().clear();
|
||||||
|
|
||||||
// For each of the players
|
// For each of the players
|
||||||
@ -121,7 +121,7 @@ public class EngineMassiveCoreMain extends Engine
|
|||||||
Predicate<String> predicate = PredicateStartsWithIgnoreCase.get(event.getLastToken());
|
Predicate<String> predicate = PredicateStartsWithIgnoreCase.get(event.getLastToken());
|
||||||
|
|
||||||
// Create a case insensitive set to check for already added stuff
|
// Create a case insensitive set to check for already added stuff
|
||||||
Set<String> current = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
Set<String> current = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
current.addAll(event.getTabCompletions());
|
current.addAll(event.getTabCompletions());
|
||||||
|
|
||||||
// Add names of all online senders that match and isn't added yet.
|
// Add names of all online senders that match and isn't added yet.
|
||||||
@ -180,7 +180,7 @@ public class EngineMassiveCoreMain extends Engine
|
|||||||
// EVENT TOOL: causedByKick
|
// EVENT TOOL: causedByKick
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static Map<UUID, String> kickedPlayerReasons = new HashMap<UUID, String>();
|
public static Map<UUID, String> kickedPlayerReasons = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void causedByKick(PlayerKickEvent event)
|
public void causedByKick(PlayerKickEvent event)
|
||||||
|
@ -45,7 +45,7 @@ public class EngineMassiveCorePlayerState extends Engine
|
|||||||
// STATE STORAGE
|
// STATE STORAGE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private Map<UUID, PlayerState> idToState = new ConcurrentHashMap<UUID, PlayerState>();
|
private Map<UUID, PlayerState> idToState = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public PlayerState getState(Player player)
|
public PlayerState getState(Player player)
|
||||||
{
|
{
|
||||||
|
@ -91,7 +91,7 @@ public class EngineMassiveCorePlayerUpdate extends Engine
|
|||||||
// FIX NO CHEAT PLUS BUG
|
// FIX NO CHEAT PLUS BUG
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static Map<UUID, Long> idToLastFlyActive = new HashMap<UUID, Long>();
|
public static Map<UUID, Long> idToLastFlyActive = new HashMap<>();
|
||||||
public static Long getLastFlyActive(Player player)
|
public static Long getLastFlyActive(Player player)
|
||||||
{
|
{
|
||||||
return idToLastFlyActive.get(player.getUniqueId());
|
return idToLastFlyActive.get(player.getUniqueId());
|
||||||
|
@ -39,7 +39,7 @@ public class EngineMassiveCoreScheduledTeleport extends Engine
|
|||||||
// SCHEDULED TELEPORT INDEX
|
// SCHEDULED TELEPORT INDEX
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected Map<String, ScheduledTeleport> teleporteeIdToScheduledTeleport = new ConcurrentHashMap<String, ScheduledTeleport>();
|
protected Map<String, ScheduledTeleport> teleporteeIdToScheduledTeleport = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public boolean isScheduled(ScheduledTeleport st)
|
public boolean isScheduled(ScheduledTeleport st)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ public class EngineMassiveCoreVariable extends Engine
|
|||||||
// VARIABLE BUFFER
|
// VARIABLE BUFFER
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static final Map<String, String> idToBuffer = new HashMap<String, String>();
|
public static final Map<String, String> idToBuffer = new HashMap<>();
|
||||||
|
|
||||||
public static String getBuffer(Object senderObject)
|
public static String getBuffer(Object senderObject)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ public class EngineMassiveCoreWorldNameSet extends Engine
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final TreeSet<String> worldNamesInner = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
private final TreeSet<String> worldNamesInner = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
private final Set<String> worldNamesOuter = Collections.unmodifiableSet(this.worldNamesInner);
|
private final Set<String> worldNamesOuter = Collections.unmodifiableSet(this.worldNamesInner);
|
||||||
public Set<String> getWorldNames() { return this.worldNamesOuter; }
|
public Set<String> getWorldNames() { return this.worldNamesOuter; }
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class EventMassiveCoreDestinationTabList extends EventMassiveCore
|
|||||||
{
|
{
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.suggestions = new MassiveList<String>();
|
this.suggestions = new MassiveList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class EventMassiveCoreLorePriority extends EventMassiveCore
|
|||||||
List<Entry<String, Integer>> ret = new MassiveList<>();
|
List<Entry<String, Integer>> ret = new MassiveList<>();
|
||||||
for (String line : meta.getLore())
|
for (String line : meta.getLore())
|
||||||
{
|
{
|
||||||
ret.add(new SimpleEntry<String, Integer>(line, PRIORITY_DEFAULT));
|
ret.add(new SimpleEntry<>(line, PRIORITY_DEFAULT));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,6 @@ public class EventMassiveCorePlayerLeave extends Event implements Runnable
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// STORING THE ACTIVE PLAYER EVENT
|
// STORING THE ACTIVE PLAYER EVENT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
public static Map<UUID, EventMassiveCorePlayerLeave> player2event = new HashMap<UUID, EventMassiveCorePlayerLeave>();
|
public static Map<UUID, EventMassiveCorePlayerLeave> player2event = new HashMap<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ public class EventMassiveCorePlayerUpdate extends EventMassiveCore
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// For backwards version compatibility we use the enumeration names rather than the enumerations themselves.
|
// For backwards version compatibility we use the enumeration names rather than the enumerations themselves.
|
||||||
public static Set<String> FLY_DEFAULT_GAME_MODE_NAMES = new MassiveSet<String>(
|
public static Set<String> FLY_DEFAULT_GAME_MODE_NAMES = new MassiveSet<>(
|
||||||
"CREATIVE",
|
"CREATIVE",
|
||||||
"SPECTATOR"
|
"SPECTATOR"
|
||||||
);
|
);
|
||||||
|
@ -51,11 +51,11 @@ public class Fetcher implements Callable<Set<IdAndName>>
|
|||||||
// STATIC
|
// STATIC
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static Set<IdAndName> fetch(Collection<? extends Object> objects) throws Exception
|
public static Set<IdAndName> fetch(Collection<?> objects) throws Exception
|
||||||
{
|
{
|
||||||
// Separate names and ids
|
// Separate names and ids
|
||||||
final Set<String> names = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
final Set<String> names = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
final Set<UUID> ids = new HashSet<UUID>();
|
final Set<UUID> ids = new HashSet<>();
|
||||||
for (Object object : objects)
|
for (Object object : objects)
|
||||||
{
|
{
|
||||||
if (object instanceof UUID)
|
if (object instanceof UUID)
|
||||||
@ -83,7 +83,7 @@ public class Fetcher implements Callable<Set<IdAndName>>
|
|||||||
@Override
|
@Override
|
||||||
public Set<IdAndName> call() throws Exception
|
public Set<IdAndName> call() throws Exception
|
||||||
{
|
{
|
||||||
return new HashSet<IdAndName>(new FetcherByName(names).call().values());
|
return new HashSet<>(new FetcherByName(names).call().values());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,11 +92,11 @@ public class Fetcher implements Callable<Set<IdAndName>>
|
|||||||
@Override
|
@Override
|
||||||
public Set<IdAndName> call() throws Exception
|
public Set<IdAndName> call() throws Exception
|
||||||
{
|
{
|
||||||
return new HashSet<IdAndName>(new FetcherById(ids).call().values());
|
return new HashSet<>(new FetcherById(ids).call().values());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final List<Callable<Set<IdAndName>>> tasks = new ArrayList<Callable<Set<IdAndName>>>();
|
final List<Callable<Set<IdAndName>>> tasks = new ArrayList<>();
|
||||||
tasks.add(taskName);
|
tasks.add(taskName);
|
||||||
tasks.add(taskId);
|
tasks.add(taskId);
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public class Fetcher implements Callable<Set<IdAndName>>
|
|||||||
List<Future<Set<IdAndName>>> futures = ES.invokeAll(tasks);
|
List<Future<Set<IdAndName>>> futures = ES.invokeAll(tasks);
|
||||||
|
|
||||||
// Merge Return Value
|
// Merge Return Value
|
||||||
Set<IdAndName> ret = new HashSet<IdAndName>();
|
Set<IdAndName> ret = new HashSet<>();
|
||||||
for (Future<Set<IdAndName>> future : futures)
|
for (Future<Set<IdAndName>> future : futures)
|
||||||
{
|
{
|
||||||
Set<IdAndName> set = future.get();
|
Set<IdAndName> set = future.get();
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.massivecore.fetcher;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -52,17 +53,17 @@ public class FetcherById implements Callable<Map<Object, IdAndName>>
|
|||||||
public static Map<Object, IdAndName> fetch(Collection<UUID> ids) throws Exception
|
public static Map<Object, IdAndName> fetch(Collection<UUID> ids) throws Exception
|
||||||
{
|
{
|
||||||
// Create Tasks
|
// Create Tasks
|
||||||
final List<Callable<Map<UUID, IdAndName>>> tasks = new ArrayList<Callable<Map<UUID, IdAndName>>>();
|
final List<Callable<Map<UUID, IdAndName>>> tasks = new ArrayList<>();
|
||||||
for (UUID id : ids)
|
for (UUID id : ids)
|
||||||
{
|
{
|
||||||
tasks.add(new FetcherByIdSingle(Arrays.asList(id)));
|
tasks.add(new FetcherByIdSingle(Collections.singletonList(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke All Tasks
|
// Invoke All Tasks
|
||||||
List<Future<Map<UUID, IdAndName>>> futures = ES.invokeAll(tasks);
|
List<Future<Map<UUID, IdAndName>>> futures = ES.invokeAll(tasks);
|
||||||
|
|
||||||
// Merge Return Value
|
// Merge Return Value
|
||||||
Map<Object, IdAndName> ret = new HashMap<Object, IdAndName>();
|
Map<Object, IdAndName> ret = new HashMap<>();
|
||||||
for (Future<Map<UUID, IdAndName>> future : futures)
|
for (Future<Map<UUID, IdAndName>> future : futures)
|
||||||
{
|
{
|
||||||
Map<UUID, IdAndName> map = future.get();
|
Map<UUID, IdAndName> map = future.get();
|
||||||
|
@ -60,7 +60,7 @@ public class FetcherByIdSingle implements Callable<Map<UUID, IdAndName>>
|
|||||||
|
|
||||||
public static Map<UUID, IdAndName> fetch(Collection<UUID> ids) throws Exception
|
public static Map<UUID, IdAndName> fetch(Collection<UUID> ids) throws Exception
|
||||||
{
|
{
|
||||||
Map<UUID, IdAndName> ret = new HashMap<UUID, IdAndName>();
|
Map<UUID, IdAndName> ret = new HashMap<>();
|
||||||
JSONParser jsonParser = new JSONParser();
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
|
||||||
for (UUID id : ids)
|
for (UUID id : ids)
|
||||||
|
@ -52,8 +52,8 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
|
|||||||
public static Map<String, IdAndName> fetch(Collection<String> names) throws Exception
|
public static Map<String, IdAndName> fetch(Collection<String> names) throws Exception
|
||||||
{
|
{
|
||||||
// Create batches
|
// Create batches
|
||||||
List<List<String>> batches = new ArrayList<List<String>>();
|
List<List<String>> batches = new ArrayList<>();
|
||||||
names = new ArrayList<String>(names);
|
names = new ArrayList<>(names);
|
||||||
while (names.size() > 0)
|
while (names.size() > 0)
|
||||||
{
|
{
|
||||||
List<String> batch = take(names, BATCH_SIZE);
|
List<String> batch = take(names, BATCH_SIZE);
|
||||||
@ -61,7 +61,7 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create Tasks
|
// Create Tasks
|
||||||
final List<Callable<Map<String, IdAndName>>> tasks = new ArrayList<Callable<Map<String, IdAndName>>>();
|
final List<Callable<Map<String, IdAndName>>> tasks = new ArrayList<>();
|
||||||
for (List<String> batch : batches)
|
for (List<String> batch : batches)
|
||||||
{
|
{
|
||||||
tasks.add(new FetcherByNameSingle(batch));
|
tasks.add(new FetcherByNameSingle(batch));
|
||||||
@ -71,7 +71,7 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
|
|||||||
List<Future<Map<String, IdAndName>>> futures = ES.invokeAll(tasks);
|
List<Future<Map<String, IdAndName>>> futures = ES.invokeAll(tasks);
|
||||||
|
|
||||||
// Merge Return Value
|
// Merge Return Value
|
||||||
Map<String, IdAndName> ret = new TreeMap<String, IdAndName> (String.CASE_INSENSITIVE_ORDER);
|
Map<String, IdAndName> ret = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
for (Future<Map<String, IdAndName>> future : futures)
|
for (Future<Map<String, IdAndName>> future : futures)
|
||||||
{
|
{
|
||||||
ret.putAll(future.get());
|
ret.putAll(future.get());
|
||||||
@ -82,7 +82,7 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
|
|||||||
|
|
||||||
public static <T> List<T> take(Collection<T> coll, int count)
|
public static <T> List<T> take(Collection<T> coll, int count)
|
||||||
{
|
{
|
||||||
List<T> ret = new ArrayList<T>();
|
List<T> ret = new ArrayList<>();
|
||||||
|
|
||||||
Iterator<T> iter = coll.iterator();
|
Iterator<T> iter = coll.iterator();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -13,6 +13,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
@ -79,8 +80,8 @@ public class FetcherByNameSingle implements Callable<Map<String, IdAndName>>
|
|||||||
|
|
||||||
public static Map<String, IdAndName> fetch(Collection<String> namesCollection, boolean rateLimiting) throws Exception
|
public static Map<String, IdAndName> fetch(Collection<String> namesCollection, boolean rateLimiting) throws Exception
|
||||||
{
|
{
|
||||||
List<String> names = new ArrayList<String>(namesCollection);
|
List<String> names = new ArrayList<>(namesCollection);
|
||||||
Map<String, IdAndName> ret = new TreeMap<String, IdAndName>(String.CASE_INSENSITIVE_ORDER);
|
Map<String, IdAndName> ret = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
JSONParser jsonParser = new JSONParser();
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
|
||||||
int requests = (int) Math.ceil(names.size() / (double) PROFILES_PER_REQUEST);
|
int requests = (int) Math.ceil(names.size() / (double) PROFILES_PER_REQUEST);
|
||||||
@ -172,7 +173,7 @@ public class FetcherByNameSingle implements Callable<Map<String, IdAndName>>
|
|||||||
|
|
||||||
public static IdAndName get(String name) throws Exception
|
public static IdAndName get(String name) throws Exception
|
||||||
{
|
{
|
||||||
return fetch(Arrays.asList(name)).get(name);
|
return fetch(Collections.singletonList(name)).get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ public class ConverterDefault<X, Y> extends Converter<X, Y>
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static final ConverterDefault<Object, Object> i = new ConverterDefault<Object, Object>();
|
private static final ConverterDefault<Object, Object> i = new ConverterDefault<>();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <X, Y> ConverterDefault<X, Y> get() { return (ConverterDefault<X, Y>) i; }
|
public static <X, Y> ConverterDefault<X, Y> get() { return (ConverterDefault<X, Y>) i; }
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -35,7 +35,7 @@ public class MixinWorld extends Mixin
|
|||||||
public List<String> getWorldIds()
|
public List<String> getWorldIds()
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (World world : Bukkit.getWorlds())
|
for (World world : Bukkit.getWorlds())
|
||||||
@ -50,7 +50,7 @@ public class MixinWorld extends Mixin
|
|||||||
public List<String> getVisibleWorldIds(Permissible permissible)
|
public List<String> getVisibleWorldIds(Permissible permissible)
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (String worldId : this.getWorldIds())
|
for (String worldId : this.getWorldIds())
|
||||||
@ -70,7 +70,7 @@ public class MixinWorld extends Mixin
|
|||||||
|
|
||||||
public List<String> getWorldAliases(String worldId)
|
public List<String> getWorldAliases(String worldId)
|
||||||
{
|
{
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorldAliasOrId(String worldId)
|
public String getWorldAliasOrId(String worldId)
|
||||||
|
@ -11,7 +11,8 @@ public class Money
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static MoneyMixin mixin = null;
|
private static MoneyMixin mixin = null;
|
||||||
public static MoneyMixin mixin() { return mixin; };
|
public static MoneyMixin mixin() { return mixin; }
|
||||||
|
|
||||||
public static void mixin(MoneyMixin mixin) { Money.mixin = mixin; }
|
public static void mixin(MoneyMixin mixin) { Money.mixin = mixin; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -8,64 +8,64 @@ public interface MoneyMixin
|
|||||||
// ENABLED
|
// ENABLED
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean enabled();
|
boolean enabled();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FORMAT AND NAME
|
// FORMAT AND NAME
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public String format(double amount);
|
String format(double amount);
|
||||||
public String format(double amount, boolean includeUnit);
|
String format(double amount, boolean includeUnit);
|
||||||
public String singular();
|
String singular();
|
||||||
public String plural();
|
String plural();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FRACTIONAL DIGITS
|
// FRACTIONAL DIGITS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public int fractionalDigits();
|
int fractionalDigits();
|
||||||
public double prepare(double amount);
|
double prepare(double amount);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// EXISTANCE
|
// EXISTANCE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean exists(String accountId);
|
boolean exists(String accountId);
|
||||||
public boolean create(String accountId);
|
boolean create(String accountId);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CHECK
|
// CHECK
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public double get(String accountId);
|
double get(String accountId);
|
||||||
public boolean has(String accountId, double amount);
|
boolean has(String accountId, double amount);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MODIFY
|
// MODIFY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories, Object message);
|
boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories, Object message);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, String category, Object message);
|
boolean move(String fromId, String toId, String byId, double amount, String category, Object message);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories);
|
boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount, String category);
|
boolean move(String fromId, String toId, String byId, double amount, String category);
|
||||||
public boolean move(String fromId, String toId, String byId, double amount);
|
boolean move(String fromId, String toId, String byId, double amount);
|
||||||
|
|
||||||
public boolean spawn(String toId, String byId, double amount, Collection<String> categories, Object message);
|
boolean spawn(String toId, String byId, double amount, Collection<String> categories, Object message);
|
||||||
public boolean spawn(String toId, String byId, double amount, String category, Object message);
|
boolean spawn(String toId, String byId, double amount, String category, Object message);
|
||||||
public boolean spawn(String toId, String byId, double amount, Collection<String> categories);
|
boolean spawn(String toId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean spawn(String toId, String byId, double amount, String category);
|
boolean spawn(String toId, String byId, double amount, String category);
|
||||||
public boolean spawn(String toId, String byId, double amount);
|
boolean spawn(String toId, String byId, double amount);
|
||||||
|
|
||||||
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories, Object message);
|
boolean despawn(String fromId, String byId, double amount, Collection<String> categories, Object message);
|
||||||
public boolean despawn(String fromId, String byId, double amount, String category, Object message);
|
boolean despawn(String fromId, String byId, double amount, String category, Object message);
|
||||||
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
|
boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean despawn(String fromId, String byId, double amount, String category);
|
boolean despawn(String fromId, String byId, double amount, String category);
|
||||||
public boolean despawn(String fromId, String byId, double amount);
|
boolean despawn(String fromId, String byId, double amount);
|
||||||
|
|
||||||
public boolean set(String accountId, String byId, double amount, Collection<String> categories, Object message);
|
boolean set(String accountId, String byId, double amount, Collection<String> categories, Object message);
|
||||||
public boolean set(String accountId, String byId, double amount, String category, Object message);
|
boolean set(String accountId, String byId, double amount, String category, Object message);
|
||||||
public boolean set(String accountId, String byId, double amount, Collection<String> categories);
|
boolean set(String accountId, String byId, double amount, Collection<String> categories);
|
||||||
public boolean set(String accountId, String byId, double amount, String category);
|
boolean set(String accountId, String byId, double amount, String category);
|
||||||
public boolean set(String accountId, String byId, double amount);
|
boolean set(String accountId, String byId, double amount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ public class Mson implements Serializable
|
|||||||
|
|
||||||
public Mson add(Iterable<?> parts)
|
public Mson add(Iterable<?> parts)
|
||||||
{
|
{
|
||||||
List<Mson> extra = new MassiveList<Mson>(this.getExtra());
|
List<Mson> extra = new MassiveList<>(this.getExtra());
|
||||||
List<Mson> msons = msons(parts);
|
List<Mson> msons = msons(parts);
|
||||||
extra.addAll(msons);
|
extra.addAll(msons);
|
||||||
return this.extra(extra);
|
return this.extra(extra);
|
||||||
@ -996,7 +996,7 @@ public class Mson implements Serializable
|
|||||||
|
|
||||||
Mson ret = this.text("");
|
Mson ret = this.text("");
|
||||||
|
|
||||||
List<Mson> msons = new ArrayList<Mson>();
|
List<Mson> msons = new ArrayList<>();
|
||||||
StringBuffer currentString = new StringBuffer();
|
StringBuffer currentString = new StringBuffer();
|
||||||
Matcher matcher = pattern.matcher(this.getText());
|
Matcher matcher = pattern.matcher(this.getText());
|
||||||
while (matcher.find())
|
while (matcher.find())
|
||||||
@ -1102,17 +1102,17 @@ public class Mson implements Serializable
|
|||||||
{
|
{
|
||||||
return implode(list, glue, null);
|
return implode(list, glue, null);
|
||||||
}
|
}
|
||||||
public static Mson implode(final Collection<? extends Object> coll, final Mson glue, final Mson format)
|
public static Mson implode(final Collection<?> coll, final Mson glue, final Mson format)
|
||||||
{
|
{
|
||||||
return implode(coll.toArray(new Object[0]), glue, format);
|
return implode(coll.toArray(new Object[0]), glue, format);
|
||||||
}
|
}
|
||||||
public static Mson implode(final Collection<? extends Object> coll, final Mson glue)
|
public static Mson implode(final Collection<?> coll, final Mson glue)
|
||||||
{
|
{
|
||||||
return implode(coll, glue, null);
|
return implode(coll, glue, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implode comma and dot
|
// Implode comma and dot
|
||||||
public static Mson implodeCommaAndDot(Collection<? extends Object> objects, Mson format, Mson comma, Mson and, Mson dot)
|
public static Mson implodeCommaAndDot(Collection<?> objects, Mson format, Mson comma, Mson and, Mson dot)
|
||||||
{
|
{
|
||||||
if (objects.size() == 0) return mson();
|
if (objects.size() == 0) return mson();
|
||||||
if (objects.size() == 1)
|
if (objects.size() == 1)
|
||||||
@ -1135,27 +1135,27 @@ public class Mson implements Serializable
|
|||||||
return implode(ourObjects, comma, format).add(mson(dot));
|
return implode(ourObjects, comma, format).add(mson(dot));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Mson implodeCommaAndDot(final Collection<? extends Object> objects, Mson comma, Mson and, Mson dot)
|
public static Mson implodeCommaAndDot(final Collection<?> objects, Mson comma, Mson and, Mson dot)
|
||||||
{
|
{
|
||||||
return implodeCommaAndDot(objects, null, comma, and, dot);
|
return implodeCommaAndDot(objects, null, comma, and, dot);
|
||||||
}
|
}
|
||||||
public static Mson implodeCommaAnd(final Collection<? extends Object> objects, Mson comma, Mson and)
|
public static Mson implodeCommaAnd(final Collection<?> objects, Mson comma, Mson and)
|
||||||
{
|
{
|
||||||
return implodeCommaAndDot(objects, comma, and, mson());
|
return implodeCommaAndDot(objects, comma, and, mson());
|
||||||
}
|
}
|
||||||
public static Mson implodeCommaAndDot(final Collection<? extends Object> objects, ChatColor color)
|
public static Mson implodeCommaAndDot(final Collection<?> objects, ChatColor color)
|
||||||
{
|
{
|
||||||
return implodeCommaAndDot(objects, mson(", ").color(color), mson(" and ").color(color), mson(".").color(color));
|
return implodeCommaAndDot(objects, mson(", ").color(color), mson(" and ").color(color), mson(".").color(color));
|
||||||
}
|
}
|
||||||
public static Mson implodeCommaAnd(final Collection<? extends Object> objects, ChatColor color)
|
public static Mson implodeCommaAnd(final Collection<?> objects, ChatColor color)
|
||||||
{
|
{
|
||||||
return implodeCommaAndDot(objects, mson(", ").color(color), mson(" and ").color(color), mson());
|
return implodeCommaAndDot(objects, mson(", ").color(color), mson(" and ").color(color), mson());
|
||||||
}
|
}
|
||||||
public static Mson implodeCommaAndDot(final Collection<? extends Object> objects)
|
public static Mson implodeCommaAndDot(final Collection<?> objects)
|
||||||
{
|
{
|
||||||
return implodeCommaAndDot(objects, null);
|
return implodeCommaAndDot(objects, null);
|
||||||
}
|
}
|
||||||
public static Mson implodeCommaAnd(final Collection<? extends Object> objects)
|
public static Mson implodeCommaAnd(final Collection<?> objects)
|
||||||
{
|
{
|
||||||
return implodeCommaAnd(objects, null);
|
return implodeCommaAnd(objects, null);
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore.mson;
|
|||||||
|
|
||||||
public interface MsonReplacement
|
public interface MsonReplacement
|
||||||
{
|
{
|
||||||
public Mson getReplacement(String match, Mson parent);
|
Mson getReplacement(String match, Mson parent);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class Test
|
|||||||
test("ofMson");
|
test("ofMson");
|
||||||
|
|
||||||
mson = mson(
|
mson = mson(
|
||||||
new MassiveList<String>("hello ", "you!")
|
new MassiveList<>("hello ", "you!")
|
||||||
);
|
);
|
||||||
test("ofCollection");
|
test("ofCollection");
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class NmsEntityGet18R1P extends NmsEntityGet
|
|||||||
// INTERNAL
|
// INTERNAL
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private Map<World, Map<UUID, Object>> worldMaps = new WeakHashMap<World, Map<UUID, Object>>();
|
private Map<World, Map<UUID, Object>> worldMaps = new WeakHashMap<>();
|
||||||
|
|
||||||
private Map<UUID, Object> getWorldMap(Object handle)
|
private Map<UUID, Object> getWorldMap(Object handle)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ public class NmsSkullMeta extends Mixin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return Ret
|
// Return Ret
|
||||||
return new Couple<String, UUID>(retName, retId);
|
return new Couple<>(retName, retId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ import com.massivecraft.massivecore.mson.Mson;
|
|||||||
|
|
||||||
public interface Msonifier<T>
|
public interface Msonifier<T>
|
||||||
{
|
{
|
||||||
public Mson toMson(T item, int index);
|
Mson toMson(T item, int index);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class Pager<T>
|
|||||||
if (ret != null) return ret;
|
if (ret != null) return ret;
|
||||||
|
|
||||||
MassiveCommand command = this.getCommand();
|
MassiveCommand command = this.getCommand();
|
||||||
if (command != null) return new ArrayList<String>(command.getArgs());
|
if (command != null) return new ArrayList<>(command.getArgs());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ public class Pager<T>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
items = new ArrayList<T>(this.getItems());
|
items = new ArrayList<>(this.getItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = number - 1;
|
int index = number - 1;
|
||||||
@ -223,7 +223,7 @@ public class Pager<T>
|
|||||||
public List<Mson> get()
|
public List<Mson> get()
|
||||||
{
|
{
|
||||||
// Create ret
|
// Create ret
|
||||||
List<Mson> ret = new ArrayList<Mson>();
|
List<Mson> ret = new ArrayList<>();
|
||||||
|
|
||||||
// Add title
|
// Add title
|
||||||
ret.add(Txt.titleizeMson(this.getTitle(), this.size(), this.getNumber(), this.getCommand(), this.getArgs()));
|
ret.add(Txt.titleizeMson(this.getTitle(), this.size(), this.getNumber(), this.getCommand(), this.getArgs()));
|
||||||
|
@ -2,5 +2,5 @@ package com.massivecraft.massivecore.pager;
|
|||||||
|
|
||||||
public interface Stringifier<T>
|
public interface Stringifier<T>
|
||||||
{
|
{
|
||||||
public String toString(T item, int index);
|
String toString(T item, int index);
|
||||||
}
|
}
|
||||||
|
@ -382,8 +382,8 @@ public enum ParticleEffect {
|
|||||||
*/
|
*/
|
||||||
MOB_APPEARANCE("mobappearance", 41, 8);
|
MOB_APPEARANCE("mobappearance", 41, 8);
|
||||||
|
|
||||||
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
|
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<>();
|
||||||
private static final Map<Integer, ParticleEffect> ID_MAP = new HashMap<Integer, ParticleEffect>();
|
private static final Map<Integer, ParticleEffect> ID_MAP = new HashMap<>();
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int id;
|
private final int id;
|
||||||
private final int requiredVersion;
|
private final int requiredVersion;
|
||||||
@ -405,7 +405,7 @@ public enum ParticleEffect {
|
|||||||
* @param requiredVersion Version which is required (1.x)
|
* @param requiredVersion Version which is required (1.x)
|
||||||
* @param properties Properties of this particle effect
|
* @param properties Properties of this particle effect
|
||||||
*/
|
*/
|
||||||
private ParticleEffect(String name, int id, int requiredVersion, ParticleProperty... properties) {
|
ParticleEffect(String name, int id, int requiredVersion, ParticleProperty... properties) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.requiredVersion = requiredVersion;
|
this.requiredVersion = requiredVersion;
|
||||||
@ -907,7 +907,7 @@ public enum ParticleEffect {
|
|||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
*/
|
*/
|
||||||
public static enum ParticleProperty {
|
public enum ParticleProperty {
|
||||||
/**
|
/**
|
||||||
* The particle effect requires water to be displayed
|
* The particle effect requires water to be displayed
|
||||||
*/
|
*/
|
||||||
@ -923,7 +923,7 @@ public enum ParticleEffect {
|
|||||||
/**
|
/**
|
||||||
* The particle effect uses the offsets as color values
|
* The particle effect uses the offsets as color values
|
||||||
*/
|
*/
|
||||||
COLORABLE;
|
COLORABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -382,7 +382,7 @@ public final class ReflectionUtils {
|
|||||||
*
|
*
|
||||||
* @param path Path of the package
|
* @param path Path of the package
|
||||||
*/
|
*/
|
||||||
private PackageType(String path) {
|
PackageType(String path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +392,7 @@ public final class ReflectionUtils {
|
|||||||
* @param parent Parent package of the package
|
* @param parent Parent package of the package
|
||||||
* @param path Path of the package
|
* @param path Path of the package
|
||||||
*/
|
*/
|
||||||
private PackageType(PackageType parent, String path) {
|
PackageType(PackageType parent, String path) {
|
||||||
this(parent + "." + path);
|
this(parent + "." + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ public final class ReflectionUtils {
|
|||||||
DOUBLE(double.class, Double.class),
|
DOUBLE(double.class, Double.class),
|
||||||
BOOLEAN(boolean.class, Boolean.class);
|
BOOLEAN(boolean.class, Boolean.class);
|
||||||
|
|
||||||
private static final Map<Class<?>, DataType> CLASS_MAP = new HashMap<Class<?>, DataType>();
|
private static final Map<Class<?>, DataType> CLASS_MAP = new HashMap<>();
|
||||||
private final Class<?> primitive;
|
private final Class<?> primitive;
|
||||||
private final Class<?> reference;
|
private final Class<?> reference;
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ public final class ReflectionUtils {
|
|||||||
* @param primitive Primitive class of this data type
|
* @param primitive Primitive class of this data type
|
||||||
* @param reference Reference class of this data type
|
* @param reference Reference class of this data type
|
||||||
*/
|
*/
|
||||||
private DataType(Class<?> primitive, Class<?> reference) {
|
DataType(Class<?> primitive, Class<?> reference) {
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user