mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Code cleaning
Most notable change: Remove redundant type parameters and replaced with <>. This is a small step to bring us closer to upstream parity.
This commit is contained in:
@ -40,7 +40,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class SimpleDispatcher implements Dispatcher {
|
||||
|
||||
private final Map<String, CommandMapping> commands = new HashMap<String, CommandMapping>();
|
||||
private final Map<String, CommandMapping> commands = new HashMap<>();
|
||||
private final SimpleDescription description = new SimpleDescription();
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ public class SimpleDispatcher implements Dispatcher {
|
||||
|
||||
@Override
|
||||
public Set<CommandMapping> getCommands() {
|
||||
return Collections.unmodifiableSet(new HashSet<CommandMapping>(commands.values()));
|
||||
return Collections.unmodifiableSet(new HashSet<>(commands.values()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +92,7 @@ public class SimpleDispatcher implements Dispatcher {
|
||||
|
||||
@Override
|
||||
public Set<String> getPrimaryAliases() {
|
||||
Set<String> aliases = new HashSet<String>();
|
||||
Set<String> aliases = new HashSet<>();
|
||||
for (CommandMapping mapping : getCommands()) {
|
||||
aliases.add(mapping.getPrimaryAlias());
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class SimpleDispatcher implements Dispatcher {
|
||||
if (split.length <= 1) {
|
||||
String prefix = split.length > 0 ? split[0] : "";
|
||||
|
||||
List<String> suggestions = new ArrayList<String>();
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
|
||||
for (CommandMapping mapping : getCommands()) {
|
||||
if (mapping.getCallable().testPermission(locals)) {
|
||||
@ -188,4 +188,4 @@ public class SimpleDispatcher implements Dispatcher {
|
||||
// Checking every perm in the class here was unnecessarily stupid
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public abstract class AParametricCallable implements CommandCallable {
|
||||
|
||||
if (!found) {
|
||||
if (unusedFlags == null) {
|
||||
unusedFlags = new HashSet<Character>();
|
||||
unusedFlags = new HashSet<>();
|
||||
}
|
||||
unusedFlags.add(flag);
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ public class FunctionParametricCallable extends AParametricCallable {
|
||||
|
||||
private final ParametricBuilder builder;
|
||||
private final ParameterData[] parameters;
|
||||
private final Set<Character> valueFlags = new HashSet<Character>();
|
||||
private final Set<Character> valueFlags = new HashSet<>();
|
||||
private final boolean anyFlags;
|
||||
private final Set<Character> legacyFlags = new HashSet<Character>();
|
||||
private final Set<Character> legacyFlags = new HashSet<>();
|
||||
private final SimpleDescription description = new SimpleDescription();
|
||||
private final String permission;
|
||||
private final Command command;
|
||||
@ -81,7 +81,7 @@ public class FunctionParametricCallable extends AParametricCallable {
|
||||
}
|
||||
|
||||
parameters = new ParameterData[paramParsables.size()];
|
||||
List<Parameter> userParameters = new ArrayList<Parameter>();
|
||||
List<Parameter> userParameters = new ArrayList<>();
|
||||
|
||||
// This helps keep tracks of @Nullables that appear in the middle of a list
|
||||
// of parameters
|
||||
@ -325,4 +325,4 @@ public class FunctionParametricCallable extends AParametricCallable {
|
||||
public String toString() {
|
||||
return command.aliases()[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,10 +65,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class ParametricBuilder {
|
||||
|
||||
private final Map<Type, Binding> bindings = new HashMap<Type, Binding>();
|
||||
private final Map<Type, Binding> bindings = new HashMap<>();
|
||||
private final Paranamer paranamer = new FaweParanamer();
|
||||
private final List<InvokeListener> invokeListeners = new ArrayList<InvokeListener>();
|
||||
private final List<ExceptionConverter> exceptionConverters = new ArrayList<ExceptionConverter>();
|
||||
private final List<InvokeListener> invokeListeners = new ArrayList<>();
|
||||
private final List<ExceptionConverter> exceptionConverters = new ArrayList<>();
|
||||
private Authorizer authorizer = new NullAuthorizer();
|
||||
private CommandCompleter defaultCompleter = new NullCompleter();
|
||||
|
||||
|
@ -55,9 +55,9 @@ public class ParametricCallable extends AParametricCallable {
|
||||
private final Object object;
|
||||
private final Method method;
|
||||
private final ParameterData[] parameters;
|
||||
private final Set<Character> valueFlags = new HashSet<Character>();
|
||||
private final Set<Character> valueFlags = new HashSet<>();
|
||||
private final boolean anyFlags;
|
||||
private final Set<Character> legacyFlags = new HashSet<Character>();
|
||||
private final Set<Character> legacyFlags = new HashSet<>();
|
||||
private final SimpleDescription description = new SimpleDescription();
|
||||
private final CommandPermissions commandPermissions;
|
||||
private final Command definition;
|
||||
@ -81,7 +81,7 @@ public class ParametricCallable extends AParametricCallable {
|
||||
Type[] types = method.getGenericParameterTypes();
|
||||
|
||||
parameters = new ParameterData[types.length];
|
||||
List<Parameter> userParameters = new ArrayList<Parameter>();
|
||||
List<Parameter> userParameters = new ArrayList<>();
|
||||
|
||||
// This helps keep tracks of @Nullables that appear in the middle of a list
|
||||
// of parameters
|
||||
@ -221,7 +221,7 @@ public class ParametricCallable extends AParametricCallable {
|
||||
|
||||
try {
|
||||
// preProcess handlers
|
||||
List<InvokeHandler> handlers = new ArrayList<InvokeHandler>();
|
||||
List<InvokeHandler> handlers = new ArrayList<>();
|
||||
for (InvokeListener listener : builder.getInvokeListeners()) {
|
||||
InvokeHandler handler = listener.createInvokeHandler();
|
||||
handlers.add(handler);
|
||||
@ -361,4 +361,4 @@ public class ParametricCallable extends AParametricCallable {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class CommandUsageBox extends StyledFragment {
|
||||
CommandListBox box = new CommandListBox(BBC.HELP_HEADER_SUBCOMMANDS.f());
|
||||
String prefix = !commandString.isEmpty() ? commandString + " " : "";
|
||||
|
||||
List<CommandMapping> list = new ArrayList<CommandMapping>(dispatcher.getCommands());
|
||||
List<CommandMapping> list = new ArrayList<>(dispatcher.getCommands());
|
||||
Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
|
||||
|
||||
for (CommandMapping mapping : list) {
|
||||
|
@ -83,7 +83,7 @@ public class ProgressIterator<V> implements Iterator<V>, ProgressObservable {
|
||||
* @return an instance
|
||||
*/
|
||||
public static <V> ProgressIterator<V> create(Iterator<V> iterator, int count) {
|
||||
return new ProgressIterator<V>(iterator, count);
|
||||
return new ProgressIterator<>(iterator, count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user