IntelliJ Inspection Based Cleanup

This commit is contained in:
Olof Larsson 2017-03-24 14:03:29 +01:00
parent afb6882157
commit c7db1cf90d
250 changed files with 954 additions and 935 deletions

View File

@ -3,16 +3,16 @@ package com.massivecraft.massivecore;
public interface Active
{
// Boolean
public boolean isActive();
public void setActive(boolean active);
boolean isActive();
void setActive(boolean active);
// Plugin
public MassivePlugin setActivePlugin(MassivePlugin plugin);
public MassivePlugin getActivePlugin();
MassivePlugin setActivePlugin(MassivePlugin plugin);
MassivePlugin getActivePlugin();
// Combined Setter
// Plugin is set first.
// Boolean by null state.
public void setActive(MassivePlugin plugin);
void setActive(MassivePlugin plugin);
}

View File

@ -26,7 +26,7 @@ public class Aspect extends Entity<Aspect>
public boolean isRegistered() { return this.registered; }
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 void setDesc(Collection<String> val) { this.desc = val; }
public void setDesc(String... val) { this.desc = Arrays.asList(val); }

View File

@ -30,7 +30,7 @@ public class AspectColl extends Coll<Aspect>
public List<Aspect> getAllRegistered()
{
List<Aspect> ret = new ArrayList<Aspect>();
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;
@ -41,7 +41,7 @@ public class AspectColl extends Coll<Aspect>
public List<Aspect> getAllRegisteredForMultiverse(Multiverse multiverse, boolean normal)
{
List<Aspect> ret = new ArrayList<Aspect>();
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;

View File

@ -4,5 +4,5 @@ import org.bukkit.ChatColor;
public interface Colorized
{
public ChatColor getColor();
ChatColor getColor();
}

View File

@ -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)
{
return new Couple<A, B>(first, second);
return new Couple<>(first, second);
}
// -------------------------------------------- //

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
public interface Identified
{
public String getId();
String getId();
}

View File

@ -27,7 +27,7 @@ public class Multiverse extends Entity<Multiverse>
// 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);
if (ret == null)
{
ret = new HashSet<String>();
ret = new HashSet<>();
this.uw.put(universe, ret);
this.changed();
}
@ -83,7 +83,7 @@ public class Multiverse extends Entity<Multiverse>
public Set<String> getUniverses()
{
Set<String> ret = new TreeSet<String>();
Set<String> ret = new TreeSet<>();
ret.addAll(this.uw.keySet());
ret.add(MassiveCore.DEFAULT);
return ret;
@ -142,7 +142,7 @@ public class Multiverse extends Entity<Multiverse>
public Set<String> getWorlds()
{
Set<String> ret = new TreeSet<String>();
Set<String> ret = new TreeSet<>();
for (Set<String> uworlds : this.uw.values())
{
ret.addAll(uworlds);
@ -155,7 +155,7 @@ public class Multiverse extends Entity<Multiverse>
Set<String> orig = this.uw.get(universe);
if (orig == null) return null;
Set<String> ret = new TreeSet<String>();
Set<String> ret = new TreeSet<>();
ret.addAll(orig);
return ret;

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
public interface Named
{
public String getName();
String getName();
}

View File

@ -105,7 +105,7 @@ public class PotionEffectWrap
public static List<PotionEffectWrap> getEffects(LivingEntity entity)
{
// Create Ret
List<PotionEffectWrap> ret = new MassiveList<PotionEffectWrap>();
List<PotionEffectWrap> ret = new MassiveList<>();
// Fill Ret
for (PotionEffect potionEffect : entity.getActivePotionEffects())

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
public interface Prioritized
{
public int getPriority();
int getPriority();
}

View File

@ -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)
{
// Create Ret
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
// Ensure between 0 and 1;
quota = limit(quota);

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore;
public interface Registerable
{
public boolean isRegistered();
boolean isRegistered();
}

View File

@ -17,13 +17,13 @@ public class Triple<A, B, C> implements Cloneable, Serializable
// -------------------------------------------- //
private final A first;
public A getFirst() { return this.first; };
public A getFirst() { return this.first; }
private final B second;
public B getSecond() { return this.second; };
public B getSecond() { return this.second; }
private final C third;
public C getThird() { return this.third; };
public C getThird() { return this.third; }
// -------------------------------------------- //
// 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)
{
return new Triple<A, B, C>(first, second, third);
return new Triple<>(first, second, third);
}
// -------------------------------------------- //

View File

@ -71,7 +71,7 @@ public class AdapterEntry implements JsonDeserializer<Entry<?, ?>>, JsonSerializ
Object key = context.deserialize(keyJson, keyType);
Object value = context.deserialize(valueJson, valueType);
return new SimpleEntry<Object, Object>(key, value);
return new SimpleEntry<>(key, value);
}
// -------------------------------------------- //

View File

@ -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)
{
return new AdapterLowercaseEnum<T>(clazz);
return new AdapterLowercaseEnum<>(clazz);
}
// -------------------------------------------- //

View File

@ -41,8 +41,8 @@ import java.util.Map;
* @author OniBait
*/
public final class AdapterModdedEnumType<T extends Enum<T>> extends TypeAdapter<T> {
private final Map<String, T> nameToConstant = new HashMap<String, T>();
private final Map<T, String> constantToName = new HashMap<T, String>();
private final Map<String, T> nameToConstant = new HashMap<>();
private final Map<T, String> constantToName = new HashMap<>();
public AdapterModdedEnumType(Class<T> classOfT) {
for (T constant : classOfT.getEnumConstants()) {

View File

@ -71,7 +71,7 @@ public class ChestGui
// 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.
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 ChestAction removeAction(ItemStack item) { return this.indexToAction.remove(item); }
public ChestAction setAction(int index, ChestAction action) { return this.indexToAction.put(index, action); }

View File

@ -37,7 +37,7 @@ public class ExceptionSet
}
@SafeVarargs
public <O extends Object> ExceptionSet(boolean standard, O... exceptions)
public <O> ExceptionSet(boolean standard, O... exceptions)
{
this.standard = standard;
if (exceptions.length == 0) return;
@ -49,7 +49,7 @@ public class ExceptionSet
// CONTAINS
// -------------------------------------------- //
public <O extends Object> boolean contains(O object)
public <O> boolean contains(O object)
{
if (object == null) return ! this.standard;
String string = stringify(object);

View File

@ -64,7 +64,7 @@ public class MassiveMap<K, V> extends LinkedHashMap<K, V>
@SuppressWarnings("unchecked")
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);

View File

@ -22,7 +22,7 @@ public class WorldExceptionSet extends ExceptionSet
}
@SafeVarargs
public <O extends Object> WorldExceptionSet(boolean standard, O... exceptions)
public <O> WorldExceptionSet(boolean standard, O... exceptions)
{
super(standard, exceptions);
}

View File

@ -402,7 +402,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
public Map<String, MassiveCommand> getChildMatches(String token, boolean levenshtein, CommandSender onlyRelevantToSender)
{
// Create Ret
Map<String, MassiveCommand> ret = new MassiveMap<String, MassiveCommand>();
Map<String, MassiveCommand> ret = new MassiveMap<>();
// Prepare
token = token.toLowerCase();
@ -419,7 +419,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// ... consider exact priority ...
if (alias.equalsIgnoreCase(token))
{
return new MassiveMap<String, MassiveCommand>(alias, child);
return new MassiveMap<>(alias, child);
}
// ... matches ...
@ -500,7 +500,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
public List<String> getAliases() { return this.aliases; }
@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)); }
@SuppressWarnings("unchecked")
@ -616,7 +616,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// All
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
@ -624,25 +624,25 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Without defaultValue
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.
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.
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.
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
@ -650,37 +650,37 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Without defaultValue & reqFromConsole
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
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.
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.
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.
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.
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
@ -688,25 +688,25 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Without defaultValue, reqFromConsole & defaultDesc.
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 .
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 .
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 .
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
@ -714,13 +714,13 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Without defaultValue, reqFromConsole, defaultDesc & concat.
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.
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
@ -728,7 +728,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Without defaultValue, name, reqFromConsole, defaultDesc & concat.
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;
// Create Ret
List<String> ret = new MassiveList<String>();
List<String> ret = new MassiveList<>();
// Fill Ret
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)
{
List<Mson> ret = new MassiveList<Mson>();
List<Mson> ret = new MassiveList<>();
for (Parameter<?> parameter : this.getParameters())
{
@ -1384,7 +1384,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
}
// ... else check the children.
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
String token = args.get(args.size()-1).toLowerCase();
for (MassiveCommand child : this.getChildren())
{

View File

@ -76,7 +76,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
if (this.getMassiveCommand().isUnsmart())
{
List<String> oldArgList = ret;
ret = new ArrayList<String>(oldArgList.size());
ret = new ArrayList<>(oldArgList.size());
for (String arg : oldArgList)
{
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 (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.
// To avoid such whitespace we do the following

View File

@ -193,7 +193,7 @@ public class Parameter<T>
public static Parameter<Integer> getPage()
{
// 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");
}
}

View File

@ -111,7 +111,7 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
V before = inherited.getValue();
// 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();
if (event.isCancelled()) return;
after = event.getAfter();

View File

@ -12,36 +12,36 @@ public class CommandEditContainer<O, V> extends CommandEditAbstract<O, V>
super(settings, property, null);
// Children
this.addChild(new CommandEditShow<O, V>(settings, property));
this.addChild(new CommandEditShow<>(settings, property));
if (property.isNullable())
{
this.addChild(new CommandEditCreate<O, V>(settings, property));
this.addChild(new CommandEditDelete<O, V>(settings, property));
this.addChild(new CommandEditCreate<>(settings, property));
this.addChild(new CommandEditDelete<>(settings, property));
}
if (property.isEditable())
{
this.addChild(new CommandEditContainerAdd<O, V>(settings, property));
this.addChild(new CommandEditContainerAdd<>(settings, property));
// These are not suitable for maps.
if (property.getValueType().isContainerCollection())
{
this.addChild(new CommandEditContainerInsert<O, V>(settings, property));
this.addChild(new CommandEditContainerSet<O, V>(settings, property));
this.addChild(new CommandEditContainerInsert<>(settings, property));
this.addChild(new CommandEditContainerSet<>(settings, property));
}
this.addChild(new CommandEditContainerRemove<O, V>(settings, property));
this.addChild(new CommandEditContainerRemoveIndex<O, V>(settings, property));
this.addChild(new CommandEditContainerRemove<>(settings, property));
this.addChild(new CommandEditContainerRemoveIndex<>(settings, property));
// The container must not be sorted, and must be ordered.
if ( ! property.getValueType().isContainerSorted() && property.getValueType().getContainerComparator() == null && property.getValueType().isContainerOrdered())
{
this.addChild(new CommandEditContainerMove<O, V>(settings, property));
this.addChild(new CommandEditContainerSwap<O, V>(settings, property));
this.addChild(new CommandEditContainerMove<>(settings, property));
this.addChild(new CommandEditContainerSwap<>(settings, property));
}
this.addChild(new CommandEditContainerClear<O, V>(settings, property));
this.addChild(new CommandEditContainerClear<>(settings, property));
}
}

View File

@ -208,7 +208,7 @@ public abstract class CommandEditContainerAbstract<O, V> extends CommandEditAbst
{
Object key = this.readElementInner(0);
Object value = this.readElementInner(1);
return new SimpleImmutableEntry<Object, Object>(key, value);
return new SimpleImmutableEntry<>(key, value);
}
}

View File

@ -16,17 +16,17 @@ public class CommandEditItemStacks<O> extends CommandEditAbstract<O, List<ItemSt
super(settings, property, true);
// Children
this.addChild(new CommandEditShow<O, List<ItemStack>>(settings, property));
this.addChild(new CommandEditShow<>(settings, property));
if (property.isNullable())
{
this.addChild(new CommandEditCreate<O, List<ItemStack>>(settings, property));
this.addChild(new CommandEditDelete<O, List<ItemStack>>(settings, property));
this.addChild(new CommandEditCreate<>(settings, property));
this.addChild(new CommandEditDelete<>(settings, property));
}
if (property.isEditable())
{
this.addChild(new CommandEditItemStacksOpen<O>(settings, property));
this.addChild(new CommandEditItemStacksOpen<>(settings, property));
}
}

View File

@ -43,7 +43,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
// EDITING
// -------------------------------------------- //
protected Set<UUID> playerIds = new MassiveSet<UUID>();
protected Set<UUID> playerIds = new MassiveSet<>();
public void setEditing(Player player, boolean editing)
{
@ -141,7 +141,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
if (inventory == null) return null;
// Create Ret
List<ItemStack> ret = new MassiveList<ItemStack>();
List<ItemStack> ret = new MassiveList<>();
// Fill Ret
for (int i = 0; i < inventory.getSize(); i++)

View File

@ -31,7 +31,7 @@ public class CommandEditSingleton<O> extends CommandEditProperties<O, O>
{
EditSettings<O> ret = new EditSettings<>(typeObject);
PropertyUsed<O> usedProperty = new PropertyUsed<O>(ret, object);
PropertyUsed<O> usedProperty = new PropertyUsed<>(ret, object);
ret.setUsedProperty(usedProperty);
return ret;

View File

@ -78,7 +78,7 @@ public class EditSettings<O>
}
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.
@ -164,12 +164,12 @@ public class EditSettings<O>
public CommandEditUsed<O> createCommandUsed()
{
return new CommandEditUsed<O>(this);
return new CommandEditUsed<>(this);
}
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()

View File

@ -62,17 +62,17 @@ public abstract class Property<O, V> implements Named
// NAME
// -------------------------------------------- //
protected List<String> names = new MassiveList<String>();
protected List<String> names = new MassiveList<>();
public List<String> getNames() { return this.names; }
@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 setNames(String... names) { this.names = new MassiveList<String>(names); }
public void setName(String name) { this.names = new MassiveList<>(name); }
public void setNames(String... names) { this.names = new MassiveList<>(names); }
// -------------------------------------------- //
// REQUIREMENTS
// -------------------------------------------- //
protected List<Requirement> requirements = new ArrayList<Requirement>();
protected List<Requirement> requirements = new ArrayList<>();
public List<Requirement> getRequirements() { return this.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.valueType = valueType;
this.names = new MassiveList<String>(names);
this.names = new MassiveList<>(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)
{
if (object == null) return new SimpleEntry<O, V>(null, null);
if (object == null) return new SimpleEntry<>(null, null);
V value = this.getValue(object);
return new SimpleEntry<O, V>(object, value);
return new SimpleEntry<>(object, value);
}
public O getInheritedObject(O object)

View File

@ -50,7 +50,7 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
}
// Prepare
Set<String> collnames = new TreeSet<String>(ComparatorNaturalOrder.get());
Set<String> collnames = new TreeSet<>(ComparatorNaturalOrder.get());
collnames.addAll(db.getCollnames());
// Do it!

View File

@ -40,7 +40,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
int page = this.readArg();
// 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
public String toString(Aspect aspect, int index)

View File

@ -40,7 +40,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
int page = this.readArg();
// 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
public String toString(Multiverse multiverse, int index)

View File

@ -60,7 +60,7 @@ public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
public void msgAspects(List<Aspect> aspects)
{
List<String> ids = new ArrayList<String>();
List<String> ids = new ArrayList<>();
for (Aspect aspect : aspects)
{
ids.add(aspect.getId());

View File

@ -6,10 +6,10 @@ import org.bukkit.command.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.
public String createErrorMessage(CommandSender sender);
public String createErrorMessage(CommandSender sender, MassiveCommand command);
String createErrorMessage(CommandSender sender);
String createErrorMessage(CommandSender sender, MassiveCommand command);
}

View File

@ -26,7 +26,7 @@ public class RequirementAnd extends RequirementAbstract
public static RequirementAnd get(Collection<Requirement> requirements) { return new RequirementAnd(requirements); }
public RequirementAnd(Collection<Requirement> requirements)
{
this.requirements = Collections.unmodifiableList(new ArrayList<Requirement>(requirements));
this.requirements = Collections.unmodifiableList(new ArrayList<>(requirements));
}
// -------------------------------------------- //

View File

@ -21,111 +21,111 @@ public interface Type<T> extends Named
// -------------------------------------------- //
// Human friendly name
public String getName();
String getName();
public Class<T> getClazz();
Class<T> getClazz();
// -------------------------------------------- //
// INNER TYPE
// -------------------------------------------- //
public <I extends Type<?>> List<I> getInnerTypes();
public <I extends Type<?>> I getInnerType(int index);
public <I extends Type<?>> I getInnerType();
<I extends Type<?>> List<I> getInnerTypes();
<I extends Type<?>> I getInnerType(int index);
<I extends Type<?>> I getInnerType();
public void setInnerTypes(Collection<Type<?>> innerTypes);
public void setInnerTypes(Type<?>... innerTypes);
public void setInnerType(Type<?> innerType);
void setInnerTypes(Collection<Type<?>> innerTypes);
void setInnerTypes(Type<?>... innerTypes);
void setInnerType(Type<?> innerType);
public void setUserOrder(List<Integer> userOrder);
public void setUserOrder(Integer... userOrder);
public List<Integer> getUserOrder();
public Integer getIndexUser(int indexTechy);
public Integer getIndexTech(int indexUser);
void setUserOrder(List<Integer> userOrder);
void setUserOrder(Integer... userOrder);
List<Integer> getUserOrder();
Integer getIndexUser(int indexTechy);
Integer getIndexTech(int indexUser);
// -------------------------------------------- //
// INNER PROPERTY
// -------------------------------------------- //
public boolean hasInnerProperties();
boolean hasInnerProperties();
public <I extends Property<T, ?>> List<I> getInnerProperties();
public <I extends Property<T, ?>> I getInnerProperty(int index);
<I extends Property<T, ?>> List<I> getInnerProperties();
<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")
public <I extends Property<T, ?>> void setInnerProperties(I... innerTypes);
<I extends Property<T, ?>> void setInnerProperties(I... innerTypes);
// -------------------------------------------- //
// WRITE VISUAL COLOR
// -------------------------------------------- //
public ChatColor getVisualColor(T value, CommandSender sender);
public ChatColor getVisualColor(T value);
public void setVisualColor(ChatColor color);
ChatColor getVisualColor(T value, CommandSender sender);
ChatColor getVisualColor(T value);
void setVisualColor(ChatColor color);
// -------------------------------------------- //
// WRITE SHOW
// -------------------------------------------- //
// A list of property values.
public List<Mson> getShowInner(T value, CommandSender sender);
public List<Mson> getShow(T value, CommandSender sender);
public List<Mson> getShow(T value);
List<Mson> getShowInner(T value, CommandSender sender);
List<Mson> getShow(T value, CommandSender sender);
List<Mson> getShow(T value);
// -------------------------------------------- //
// WRITE VISUAL MSON
// -------------------------------------------- //
// A visual mson.
public Mson getVisualMsonInner(T value, CommandSender sender);
public Mson getVisualMson(T value, CommandSender sender);
public Mson getVisualMson(T value);
Mson getVisualMsonInner(T value, CommandSender sender);
Mson getVisualMson(T value, CommandSender sender);
Mson getVisualMson(T value);
// -------------------------------------------- //
// WRITE VISUAL
// -------------------------------------------- //
// A visual and colorful representation. Possibly with added detail such as simple ASCII art.
public String getVisualInner(T value, CommandSender sender);
public String getVisual(T value, CommandSender sender);
public String getVisual(T value);
String getVisualInner(T value, CommandSender sender);
String getVisual(T value, CommandSender sender);
String getVisual(T value);
// -------------------------------------------- //
// WRITE NAME
// -------------------------------------------- //
// A human friendly but simple representation without color and clutter.
public String getNameInner(T value);
public String getName(T value);
public Set<String> getNamesInner(T value);
public Set<String> getNames(T value);
String getNameInner(T value);
String getName(T value);
Set<String> getNamesInner(T value);
Set<String> getNames(T value);
// -------------------------------------------- //
// WRITE ID
// -------------------------------------------- //
// System identification string. Most times unsuitable for humans.
public String getIdInner(T value);
public String getId(T value);
public Set<String> getIdsInner(T value);
public Set<String> getIds(T value);
String getIdInner(T value);
String getId(T value);
Set<String> getIdsInner(T value);
Set<String> getIds(T value);
// -------------------------------------------- //
// READ
// -------------------------------------------- //
public T read(String arg, CommandSender sender) throws MassiveException;
public T read(CommandSender sender) throws MassiveException;
public T read(String arg) throws MassiveException;
public T read() throws MassiveException;
T read(String arg, CommandSender sender) throws MassiveException;
T read(CommandSender sender) throws MassiveException;
T read(String arg) throws MassiveException;
T read() throws MassiveException;
// -------------------------------------------- //
// VALID
// -------------------------------------------- //
// Used for arbitrary argument order
public boolean isValid(String arg, CommandSender sender);
boolean isValid(String arg, CommandSender sender);
// -------------------------------------------- //
// TAB LIST
@ -133,48 +133,48 @@ public interface Type<T> extends Named
// The sender is the one that tried to tab complete.
// The arg is beginning the word they are trying to tab complete.
public Collection<String> getTabList(CommandSender sender, String arg);
public List<String> getTabListFiltered(CommandSender sender, String arg);
Collection<String> getTabList(CommandSender sender, String arg);
List<String> getTabListFiltered(CommandSender sender, String arg);
// Sometimes we put a space after a tab completion.
// That would however not make sense with all Types.
// Default is true;
public boolean allowSpaceAfterTab();
boolean allowSpaceAfterTab();
// -------------------------------------------- //
// CONTAINER > IS
// -------------------------------------------- //
public boolean isContainer();
public boolean isContainerMap();
public boolean isContainerCollection();
boolean isContainer();
boolean isContainerMap();
boolean isContainerCollection();
public boolean isContainerIndexed();
public boolean isContainerOrdered();
public boolean isContainerSorted();
boolean isContainerIndexed();
boolean isContainerOrdered();
boolean isContainerSorted();
// -------------------------------------------- //
// CONTAINER > COMPARATOR
// -------------------------------------------- //
public <E> Comparator<E> getContainerComparator();
public void setContainerComparator(Comparator<?> container);
<E> Comparator<E> getContainerComparator();
void setContainerComparator(Comparator<?> container);
public <E> List<E> getContainerElementsOrdered(Iterable<E> elements);
public <E> List<E> getContainerElementsOrdered(T container);
<E> List<E> getContainerElementsOrdered(Iterable<E> elements);
<E> List<E> getContainerElementsOrdered(T container);
// -------------------------------------------- //
// EQUALS
// -------------------------------------------- //
public boolean equals(T type1, T type2);
public boolean equalsInner(T type1, T type2);
boolean equals(T type1, T type2);
boolean equalsInner(T type1, T type2);
// -------------------------------------------- //
// EDITOR
// -------------------------------------------- //
public <O> CommandEditAbstract<O, T> createEditCommand(EditSettings<O> settings, Property<O, T> property);
public T createNewInstance();
<O> CommandEditAbstract<O, T> createEditCommand(EditSettings<O> settings, Property<O, T> property);
T createNewInstance();
}

View File

@ -108,7 +108,8 @@ public abstract class TypeAbstract<T> implements Type<T>
@SuppressWarnings({ "unchecked", "rawtypes" })
@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); }
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)
{
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.
for (String suggestion : suggestions)
{
@ -540,7 +541,7 @@ public abstract class TypeAbstract<T> implements Type<T>
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;
if (elements instanceof Collection<?>)
{
ret = new MassiveList<E>((Collection<E>)elements);
ret = new MassiveList<>((Collection<E>) elements);
}
else
{
ret = new MassiveList<E>();
ret = new MassiveList<>();
for (E element : elements)
{
ret.add(element);
@ -653,11 +654,11 @@ public abstract class TypeAbstract<T> implements Type<T>
{
if (this.hasInnerProperties())
{
return new CommandEditProperties<O, T>(settings, property);
return new CommandEditProperties<>(settings, property);
}
else
{
return new CommandEditSimple<O, T>(settings, property);
return new CommandEditSimple<>(settings, property);
}
}

View File

@ -62,7 +62,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
public Collection<T> getAll() { return 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;
if (all == null)
@ -242,7 +242,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
if ( ! this.isCanSeeOverridden()) return this.getAll();
// Create
Set<T> ret = new MassiveSet<T>();
Set<T> ret = new MassiveSet<>();
// Fill
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)
{
// Create
List<T> ret = new MassiveList<T>();
List<T> ret = new MassiveList<>();
// Prepare
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)
{
// Create
Map<String, T> ret = new MassiveMap<String, T>();
Map<String, T> ret = new MassiveMap<>();
// Fill
for (T value : all)
@ -351,7 +351,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
public List<String> createOptionKeys(T value)
{
// Create
List<String> ret = new MassiveList<String>();
List<String> ret = new MassiveList<>();
// Fill
String string;
@ -399,7 +399,7 @@ public abstract class TypeAbstractChoice<T> extends TypeAbstract<T> implements A
public Set<String> createTabs(CommandSender sender)
{
// Create
Set<String> ret = new MassiveSet<String>();
Set<String> ret = new MassiveSet<>();
// Fill
for (T value : this.getAll(sender))

View File

@ -52,7 +52,7 @@ public abstract class TypeAbstractSelect<T> extends TypeAbstract<T> implements A
public Collection<String> altNames(CommandSender sender)
{
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
for (T value : this.getAll(sender))
{
String name = this.getVisual(value, sender);
@ -107,7 +107,7 @@ public abstract class TypeAbstractSelect<T> extends TypeAbstract<T> implements A
arg = arg.toLowerCase();
// Try Levenshtein
List<String> matches = new ArrayList<String>();
List<String> matches = new ArrayList<>();
for (String alias : this.altNames(sender))
{

View File

@ -23,17 +23,17 @@ public class TypeNullable<T> extends TypeWrapper<T>
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)
{
return new TypeNullable<T>(inner, nulls);
return new TypeNullable<>(inner, nulls);
}
public static <T> TypeNullable<T> get(Type<T> inner)
{
return new TypeNullable<T>(inner);
return new TypeNullable<>(inner);
}
// -------------------------------------------- //

View File

@ -83,7 +83,7 @@ public class TypeStringCommand extends TypeAbstract<String>
List<String> subcompletions = command.tabComplete(sender, alias, Arrays.copyOfRange(args, 1, args.length));
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)
{

View File

@ -40,7 +40,7 @@ public abstract class TypeTransformer<I, O> extends TypeAbstract<O>
public static Set<String> prefix(Set<String> strings)
{
// Create
Set<String> ret = new MassiveSet<String>(strings.size());
Set<String> ret = new MassiveSet<>(strings.size());
// Fill
for (String string : strings)

View File

@ -78,7 +78,7 @@ public class TypeWrapper<T> extends TypeAbstract<T>
@Override
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

View File

@ -237,7 +237,7 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
public String getName()
{
// Create
List<String> parts = new MassiveList<String>();
List<String> parts = new MassiveList<>();
// Fill
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
{
// Create
List<Object> ret = new MassiveList<Object>();
List<Object> ret = new MassiveList<>();
// Fill
List<String> innerArgs = this.getArgs(arg);
@ -417,7 +417,7 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
String innerArg = this.getLastArg(arg);
String prefix = arg.substring(0, arg.length() - innerArg.length());
List<String> strings = innerType.getTabListFiltered(sender, innerArg);
List<String> ret = new MassiveList<String>();
List<String> ret = new MassiveList<>();
for (String string : strings)
{
ret.add(prefix + string);

View File

@ -20,7 +20,7 @@ public class TypeEntry<K, V> extends TypeCombined<Entry<K, V>>
// 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)
{
super(Entry.class, keyType, valueType);

View File

@ -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)
{
return new TypeBackstringSet<E>(innerType);
return new TypeBackstringSet<>(innerType);
}
public TypeBackstringSet(Type<E> innerType)
@ -35,7 +35,7 @@ public class TypeBackstringSet<E extends Enum<E>> extends TypeContainer<Set<E>,
@Override
public BackstringSet<E> createNewInstance()
{
return new BackstringSet<E>((Class<E>) innerTypeClass);
return new BackstringSet<>((Class<E>) innerTypeClass);
}
}

View File

@ -18,7 +18,7 @@ import java.util.Arrays;
import java.util.Collection;
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
@ -267,7 +267,7 @@ public abstract class TypeContainer<C extends Object, E> extends TypeAbstract<C>
@Override
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);
}
// -------------------------------------------- //

View File

@ -29,7 +29,7 @@ public class TypeItemStacks extends TypeList<ItemStack>
@Override
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);
}
}

View File

@ -13,7 +13,7 @@ public class TypeList<E> extends TypeContainer<List<E>, E>
public static <E> TypeList<E> get(Type<E> innerType)
{
return new TypeList<E>(innerType);
return new TypeList<>(innerType);
}
public TypeList(Type<E> innerType)
@ -28,7 +28,7 @@ public class TypeList<E> extends TypeContainer<List<E>, E>
@Override
public List<E> createNewInstance()
{
return new MassiveList<E>();
return new MassiveList<>();
}
}

View File

@ -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)
{
return new TypeMap<K, V>(entryType);
return new TypeMap<>(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
public Map<K, V> createNewInstance()
{
return new MassiveMap<K, V>();
return new MassiveMap<>();
}
}

View File

@ -13,7 +13,7 @@ public class TypeSet<E> extends TypeContainer<Set<E>, E>
public static <E> TypeSet<E> get(Type<E> innerType)
{
return new TypeSet<E>(innerType);
return new TypeSet<>(innerType);
}
public TypeSet(Type<E> innerType)
@ -28,7 +28,7 @@ public class TypeSet<E> extends TypeContainer<Set<E>, E>
@Override
public Set<E> createNewInstance()
{
return new MassiveSet<E>();
return new MassiveSet<>();
}
}

View File

@ -25,7 +25,7 @@ public class TypeEntityType extends TypeEnum<EntityType>
@Override
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)
{

View File

@ -25,7 +25,7 @@ public class TypeEnvironment extends TypeEnum<Environment>
@Override
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)
{

View File

@ -25,7 +25,7 @@ public class TypeGameMode extends TypeEnum<GameMode>
@Override
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);
String idString = String.valueOf(idInt);

View File

@ -26,7 +26,7 @@ public class TypeMaterial extends TypeEnum<Material>
@Override
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());
ret.add(id);

View File

@ -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
// 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_RAIN", "WEATHER_RAIN",
"AMBIENCE_THUNDER", "ENTITY_LIGHTNING_THUNDER",
@ -302,7 +302,7 @@ public class TypeSound extends TypeEnum<Sound>
public Set<String> getIdsInner(Sound value)
{
// Create
Set<String> ret = new MassiveSet<String>();
Set<String> ret = new MassiveSet<>();
// Fill
String current = value.name();

View File

@ -46,7 +46,7 @@ public class TypeWeatherType extends TypeEnum<WeatherType>
@Override
public Set<String> getNamesInner(WeatherType value)
{
Set<String> ret = new MassiveSet<String>();
Set<String> ret = new MassiveSet<>();
switch (value)
{

View File

@ -25,7 +25,7 @@ public class TypeWorldType extends TypeEnum<WorldType>
@Override
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)
{

View File

@ -21,13 +21,13 @@ public abstract class TypeBooleanAbstract extends TypeAbstractChoice<Boolean>
public static final String NAME_FALSE = "False";
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_TRUE,
NAME_ON
);
public static final Set<String> NAMES_FALSE = new MassiveSet<String>(
public static final Set<String> NAMES_FALSE = new MassiveSet<>(
NAME_NO,
NAME_FALSE,
NAME_OFF
@ -86,7 +86,7 @@ public abstract class TypeBooleanAbstract extends TypeAbstractChoice<Boolean>
public Set<String> getNamesInner(Boolean value)
{
// Create
Set<String> ret = new MassiveSet<String>();
Set<String> ret = new MassiveSet<>();
// Fill
ret.add(this.getNameInner(value));

View File

@ -21,7 +21,7 @@ public class TypeObject<T> extends TypeAbstract<T>
@SuppressWarnings("unchecked")
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)
{

View File

@ -46,10 +46,10 @@ public class TypeSenderEntity<T extends SenderEntity<T>> extends TypeSenderIdAbs
// 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) { return new TypeSenderEntity<T>(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) { return new TypeSenderEntity<T>(coll); }
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<>(coll, presence); }
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<>(coll); }
// -------------------------------------------- //
// OVERRIDE

View File

@ -166,7 +166,7 @@ public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
boolean addIds = (arg.length() >= TAB_LIST_UUID_THRESHOLD);
int size = ids.size();
if (addIds) size *= 2;
Set<String> ret = new MassiveSet<String>(size);
Set<String> ret = new MassiveSet<>(size);
for (String id : ids)
{
if ( ! MixinVisibility.get().isVisible(id, sender)) continue;

View File

@ -9,7 +9,7 @@ public class ComparatorEntryKey<K, V> extends ComparatorAbstractTransformer<Entr
// 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)
{
super(comparator);

View File

@ -9,7 +9,7 @@ public class ComparatorEntryValue<K, V> extends ComparatorAbstractTransformer<En
// 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)
{
super(comparator);

View File

@ -8,7 +8,7 @@ public class ComparatorReversed<T> extends ComparatorAbstractWrapper<T, T>
// 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)
{
super(comparator);

View File

@ -50,7 +50,7 @@ public class EngineMassiveCoreCommandRegistration extends Engine
Map<String, Command> knownCommands = getSimpleCommandMapDotKnownCommands(simpleCommandMap);
// 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 (MassiveCommand massiveCommand : MassiveCommand.getAllInstances())
{

View File

@ -38,7 +38,7 @@ public class EngineMassiveCoreDatabase extends Engine
// 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.
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)
{
// Create Ret
Map<SenderColl<?>, Entry<JsonObject, Long>> ret = new HashMap<SenderColl<?>, Entry<JsonObject, Long>>();
Map<SenderColl<?>, Entry<JsonObject, Long>> ret = new HashMap<>();
// Fill Ret
for (final SenderColl<?> coll : Coll.getSenderInstances())

View File

@ -81,12 +81,12 @@ public class EngineMassiveCoreDestination extends Engine
event.setCancelled(true);
}
public static final Set<String> ALIASES_TOP = new MassiveSet<String>("top");
public static final Set<String> ALIASES_THERE = new MassiveSet<String>("there");
public static final Set<String> ALIASES_THAT = new MassiveSet<String>("that");
public static final Set<String> ALIASES_JUMP = new MassiveSet<String>("jump");
public static final Set<String> ALIASES_WORLD = new MassiveSet<String>("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_TOP = new MassiveSet<>("top");
public static final Set<String> ALIASES_THERE = new MassiveSet<>("there");
public static final Set<String> ALIASES_THAT = new MassiveSet<>("that");
public static final Set<String> ALIASES_JUMP = new MassiveSet<>("jump");
public static final Set<String> ALIASES_WORLD = new MassiveSet<>("world", "w", "spawn", "wspawn", "worldspawn");
public static final Set<String> ALIASES_PLAYER = new MassiveSet<>("player", "p", "here", "me", "self");
public Destination destinationArg(String arg, CommandSender sender) throws MassiveException
{

View File

@ -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.
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)
{
@ -36,7 +36,7 @@ public class EngineMassiveCoreGank extends Engine
if (ret == null)
{
ret = new WeakHashMap<Player, Double>(4);
ret = new WeakHashMap<>(4);
if (store)
{
this.entityToPlayerDamages.put(entity, ret);
@ -73,7 +73,7 @@ public class EngineMassiveCoreGank extends Engine
}
// Create Ret
Map<Player, Double> ret = new MassiveMap<Player, Double>(playerDamages.size());
Map<Player, Double> ret = new MassiveMap<>(playerDamages.size());
// Fill Ret
for (Entry<Player, Double> playerDamage : playerDamages.entrySet())

View File

@ -66,7 +66,7 @@ public class EngineMassiveCoreMain extends Engine
String format = event.getFormat();
// 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();
// For each of the players
@ -121,7 +121,7 @@ public class EngineMassiveCoreMain extends Engine
Predicate<String> predicate = PredicateStartsWithIgnoreCase.get(event.getLastToken());
// 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());
// 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
// -------------------------------------------- //
public static Map<UUID, String> kickedPlayerReasons = new HashMap<UUID, String>();
public static Map<UUID, String> kickedPlayerReasons = new HashMap<>();
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void causedByKick(PlayerKickEvent event)

View File

@ -45,7 +45,7 @@ public class EngineMassiveCorePlayerState extends Engine
// STATE STORAGE
// -------------------------------------------- //
private Map<UUID, PlayerState> idToState = new ConcurrentHashMap<UUID, PlayerState>();
private Map<UUID, PlayerState> idToState = new ConcurrentHashMap<>();
public PlayerState getState(Player player)
{

View File

@ -91,7 +91,7 @@ public class EngineMassiveCorePlayerUpdate extends Engine
// 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)
{
return idToLastFlyActive.get(player.getUniqueId());

View File

@ -39,7 +39,7 @@ public class EngineMassiveCoreScheduledTeleport extends Engine
// SCHEDULED TELEPORT INDEX
// -------------------------------------------- //
protected Map<String, ScheduledTeleport> teleporteeIdToScheduledTeleport = new ConcurrentHashMap<String, ScheduledTeleport>();
protected Map<String, ScheduledTeleport> teleporteeIdToScheduledTeleport = new ConcurrentHashMap<>();
public boolean isScheduled(ScheduledTeleport st)
{

View File

@ -107,7 +107,7 @@ public class EngineMassiveCoreVariable extends Engine
// 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)
{

View File

@ -41,7 +41,7 @@ public class EngineMassiveCoreWorldNameSet extends Engine
// 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);
public Set<String> getWorldNames() { return this.worldNamesOuter; }

View File

@ -37,7 +37,7 @@ public class EventMassiveCoreDestinationTabList extends EventMassiveCore
{
this.arg = arg;
this.sender = sender;
this.suggestions = new MassiveList<String>();
this.suggestions = new MassiveList<>();
}
}

View File

@ -61,7 +61,7 @@ public class EventMassiveCoreLorePriority extends EventMassiveCore
List<Entry<String, Integer>> ret = new MassiveList<>();
for (String line : meta.getLore())
{
ret.add(new SimpleEntry<String, Integer>(line, PRIORITY_DEFAULT));
ret.add(new SimpleEntry<>(line, PRIORITY_DEFAULT));
}
return ret;
}

View File

@ -88,6 +88,6 @@ public class EventMassiveCorePlayerLeave extends Event implements Runnable
// -------------------------------------------- //
// STORING THE ACTIVE PLAYER EVENT
// -------------------------------------------- //
public static Map<UUID, EventMassiveCorePlayerLeave> player2event = new HashMap<UUID, EventMassiveCorePlayerLeave>();
public static Map<UUID, EventMassiveCorePlayerLeave> player2event = new HashMap<>();
}

View File

@ -137,7 +137,7 @@ public class EventMassiveCorePlayerUpdate extends EventMassiveCore
// -------------------------------------------- //
// 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",
"SPECTATOR"
);

View File

@ -51,11 +51,11 @@ public class Fetcher implements Callable<Set<IdAndName>>
// 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
final Set<String> names = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
final Set<UUID> ids = new HashSet<UUID>();
final Set<String> names = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
final Set<UUID> ids = new HashSet<>();
for (Object object : objects)
{
if (object instanceof UUID)
@ -83,7 +83,7 @@ public class Fetcher implements Callable<Set<IdAndName>>
@Override
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
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(taskId);
@ -104,7 +104,7 @@ public class Fetcher implements Callable<Set<IdAndName>>
List<Future<Set<IdAndName>>> futures = ES.invokeAll(tasks);
// Merge Return Value
Set<IdAndName> ret = new HashSet<IdAndName>();
Set<IdAndName> ret = new HashSet<>();
for (Future<Set<IdAndName>> future : futures)
{
Set<IdAndName> set = future.get();

View File

@ -3,6 +3,7 @@ package com.massivecraft.massivecore.fetcher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
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
{
// 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)
{
tasks.add(new FetcherByIdSingle(Arrays.asList(id)));
tasks.add(new FetcherByIdSingle(Collections.singletonList(id)));
}
// Invoke All Tasks
List<Future<Map<UUID, IdAndName>>> futures = ES.invokeAll(tasks);
// Merge Return Value
Map<Object, IdAndName> ret = new HashMap<Object, IdAndName>();
Map<Object, IdAndName> ret = new HashMap<>();
for (Future<Map<UUID, IdAndName>> future : futures)
{
Map<UUID, IdAndName> map = future.get();

View File

@ -60,7 +60,7 @@ public class FetcherByIdSingle implements Callable<Map<UUID, IdAndName>>
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();
for (UUID id : ids)

View File

@ -52,8 +52,8 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
public static Map<String, IdAndName> fetch(Collection<String> names) throws Exception
{
// Create batches
List<List<String>> batches = new ArrayList<List<String>>();
names = new ArrayList<String>(names);
List<List<String>> batches = new ArrayList<>();
names = new ArrayList<>(names);
while (names.size() > 0)
{
List<String> batch = take(names, BATCH_SIZE);
@ -61,7 +61,7 @@ public class FetcherByName implements Callable<Map<String, IdAndName>>
}
// 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)
{
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);
// 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)
{
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)
{
List<T> ret = new ArrayList<T>();
List<T> ret = new ArrayList<>();
Iterator<T> iter = coll.iterator();
int i = 0;

View File

@ -13,6 +13,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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
{
List<String> names = new ArrayList<String>(namesCollection);
Map<String, IdAndName> ret = new TreeMap<String, IdAndName>(String.CASE_INSENSITIVE_ORDER);
List<String> names = new ArrayList<>(namesCollection);
Map<String, IdAndName> ret = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
JSONParser jsonParser = new JSONParser();
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
{
return fetch(Arrays.asList(name)).get(name);
return fetch(Collections.singletonList(name)).get(name);
}
}

View File

@ -6,7 +6,7 @@ public class ConverterDefault<X, Y> extends Converter<X, Y>
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static final ConverterDefault<Object, Object> i = new ConverterDefault<Object, Object>();
private static final ConverterDefault<Object, Object> i = new ConverterDefault<>();
@SuppressWarnings("unchecked")
public static <X, Y> ConverterDefault<X, Y> get() { return (ConverterDefault<X, Y>) i; }
@SuppressWarnings("unchecked")

View File

@ -35,7 +35,7 @@ public class MixinWorld extends Mixin
public List<String> getWorldIds()
{
// Create
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
// Fill
for (World world : Bukkit.getWorlds())
@ -50,7 +50,7 @@ public class MixinWorld extends Mixin
public List<String> getVisibleWorldIds(Permissible permissible)
{
// Create
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
// Fill
for (String worldId : this.getWorldIds())
@ -70,7 +70,7 @@ public class MixinWorld extends Mixin
public List<String> getWorldAliases(String worldId)
{
return new ArrayList<String>();
return new ArrayList<>();
}
public String getWorldAliasOrId(String worldId)

View File

@ -11,7 +11,8 @@ public class Money
// -------------------------------------------- //
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; }
// -------------------------------------------- //

View File

@ -8,64 +8,64 @@ public interface MoneyMixin
// ENABLED
// -------------------------------------------- //
public boolean enabled();
boolean enabled();
// -------------------------------------------- //
// FORMAT AND NAME
// -------------------------------------------- //
public String format(double amount);
public String format(double amount, boolean includeUnit);
public String singular();
public String plural();
String format(double amount);
String format(double amount, boolean includeUnit);
String singular();
String plural();
// -------------------------------------------- //
// FRACTIONAL DIGITS
// -------------------------------------------- //
public int fractionalDigits();
public double prepare(double amount);
int fractionalDigits();
double prepare(double amount);
// -------------------------------------------- //
// EXISTANCE
// -------------------------------------------- //
public boolean exists(String accountId);
public boolean create(String accountId);
boolean exists(String accountId);
boolean create(String accountId);
// -------------------------------------------- //
// CHECK
// -------------------------------------------- //
public double get(String accountId);
public boolean has(String accountId, double amount);
double get(String accountId);
boolean has(String accountId, double amount);
// -------------------------------------------- //
// MODIFY
// -------------------------------------------- //
public 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);
public 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);
public boolean move(String fromId, String toId, String byId, double amount);
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, String category, Object message);
boolean move(String fromId, String toId, String byId, double amount, Collection<String> categories);
boolean move(String fromId, String toId, String byId, double amount, String category);
boolean move(String fromId, String toId, String byId, double amount);
public 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);
public boolean spawn(String toId, String byId, double amount, Collection<String> categories);
public 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, Collection<String> categories, Object message);
boolean spawn(String toId, String byId, double amount, String category, Object message);
boolean spawn(String toId, String byId, double amount, Collection<String> categories);
boolean spawn(String toId, String byId, double amount, String category);
boolean spawn(String toId, String byId, double amount);
public 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);
public boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
public 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, Collection<String> categories, Object message);
boolean despawn(String fromId, String byId, double amount, String category, Object message);
boolean despawn(String fromId, String byId, double amount, Collection<String> categories);
boolean despawn(String fromId, String byId, double amount, String category);
boolean despawn(String fromId, String byId, double amount);
public 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);
public boolean set(String accountId, String byId, double amount, Collection<String> categories);
public 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, Collection<String> categories, Object message);
boolean set(String accountId, String byId, double amount, String category, Object message);
boolean set(String accountId, String byId, double amount, Collection<String> categories);
boolean set(String accountId, String byId, double amount, String category);
boolean set(String accountId, String byId, double amount);
}

View File

@ -312,7 +312,7 @@ public class Mson implements Serializable
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);
extra.addAll(msons);
return this.extra(extra);
@ -996,7 +996,7 @@ public class Mson implements Serializable
Mson ret = this.text("");
List<Mson> msons = new ArrayList<Mson>();
List<Mson> msons = new ArrayList<>();
StringBuffer currentString = new StringBuffer();
Matcher matcher = pattern.matcher(this.getText());
while (matcher.find())
@ -1102,17 +1102,17 @@ public class Mson implements Serializable
{
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);
}
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);
}
// 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() == 1)
@ -1135,27 +1135,27 @@ public class Mson implements Serializable
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);
}
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());
}
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));
}
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());
}
public static Mson implodeCommaAndDot(final Collection<? extends Object> objects)
public static Mson implodeCommaAndDot(final Collection<?> objects)
{
return implodeCommaAndDot(objects, null);
}
public static Mson implodeCommaAnd(final Collection<? extends Object> objects)
public static Mson implodeCommaAnd(final Collection<?> objects)
{
return implodeCommaAnd(objects, null);
}

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore.mson;
public interface MsonReplacement
{
public Mson getReplacement(String match, Mson parent);
Mson getReplacement(String match, Mson parent);
}

View File

@ -37,7 +37,7 @@ public class Test
test("ofMson");
mson = mson(
new MassiveList<String>("hello ", "you!")
new MassiveList<>("hello ", "you!")
);
test("ofCollection");

View File

@ -79,7 +79,7 @@ public class NmsEntityGet18R1P extends NmsEntityGet
// 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)
{

View File

@ -83,7 +83,7 @@ public class NmsSkullMeta extends Mixin
}
// Return Ret
return new Couple<String, UUID>(retName, retId);
return new Couple<>(retName, retId);
}
}

View File

@ -4,5 +4,5 @@ import com.massivecraft.massivecore.mson.Mson;
public interface Msonifier<T>
{
public Mson toMson(T item, int index);
Mson toMson(T item, int index);
}

View File

@ -54,7 +54,7 @@ public class Pager<T>
if (ret != null) return ret;
MassiveCommand command = this.getCommand();
if (command != null) return new ArrayList<String>(command.getArgs());
if (command != null) return new ArrayList<>(command.getArgs());
return null;
}
@ -199,7 +199,7 @@ public class Pager<T>
}
else
{
items = new ArrayList<T>(this.getItems());
items = new ArrayList<>(this.getItems());
}
int index = number - 1;
@ -223,7 +223,7 @@ public class Pager<T>
public List<Mson> get()
{
// Create ret
List<Mson> ret = new ArrayList<Mson>();
List<Mson> ret = new ArrayList<>();
// Add title
ret.add(Txt.titleizeMson(this.getTitle(), this.size(), this.getNumber(), this.getCommand(), this.getArgs()));

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore.pager;
public interface Stringifier<T>
{
public String toString(T item, int index);
String toString(T item, int index);
}

View File

@ -382,8 +382,8 @@ public enum ParticleEffect {
*/
MOB_APPEARANCE("mobappearance", 41, 8);
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
private static final Map<Integer, ParticleEffect> ID_MAP = new HashMap<Integer, ParticleEffect>();
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<>();
private static final Map<Integer, ParticleEffect> ID_MAP = new HashMap<>();
private final String name;
private final int id;
private final int requiredVersion;
@ -405,7 +405,7 @@ public enum ParticleEffect {
* @param requiredVersion Version which is required (1.x)
* @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.id = id;
this.requiredVersion = requiredVersion;
@ -907,7 +907,7 @@ public enum ParticleEffect {
* @author DarkBlade12
* @since 1.7
*/
public static enum ParticleProperty {
public enum ParticleProperty {
/**
* The particle effect requires water to be displayed
*/
@ -923,7 +923,7 @@ public enum ParticleEffect {
/**
* The particle effect uses the offsets as color values
*/
COLORABLE;
COLORABLE
}
/**

View File

@ -382,7 +382,7 @@ public final class ReflectionUtils {
*
* @param path Path of the package
*/
private PackageType(String path) {
PackageType(String path) {
this.path = path;
}
@ -392,7 +392,7 @@ public final class ReflectionUtils {
* @param parent Parent package of the package
* @param path Path of the package
*/
private PackageType(PackageType parent, String path) {
PackageType(PackageType parent, String path) {
this(parent + "." + path);
}
@ -450,7 +450,7 @@ public final class ReflectionUtils {
DOUBLE(double.class, Double.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<?> reference;
@ -468,7 +468,7 @@ public final class ReflectionUtils {
* @param primitive Primitive 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.reference = reference;
}

Some files were not shown because too many files have changed in this diff Show More