diff --git a/src/main/java/fr/themode/demo/commands/EntitySelectorCommand.java b/src/main/java/fr/themode/demo/commands/EntitySelectorCommand.java index 1af4b5168..be4c52878 100644 --- a/src/main/java/fr/themode/demo/commands/EntitySelectorCommand.java +++ b/src/main/java/fr/themode/demo/commands/EntitySelectorCommand.java @@ -7,7 +7,7 @@ import net.minestom.server.command.builder.arguments.ArgumentType; import net.minestom.server.command.builder.arguments.minecraft.ArgumentEntities; import net.minestom.server.entity.Entity; -import java.util.ArrayList; +import java.util.List; public class EntitySelectorCommand extends Command { @@ -21,6 +21,6 @@ public class EntitySelectorCommand extends Command { } private void executor(CommandSender commandSender, Arguments arguments) { - ArrayList entities = arguments.getEntities("entities"); + List entities = arguments.getEntities("entities"); } } diff --git a/src/main/java/net/minestom/server/command/CommandManager.java b/src/main/java/net/minestom/server/command/CommandManager.java index adcc9eca4..4b9e4290e 100644 --- a/src/main/java/net/minestom/server/command/CommandManager.java +++ b/src/main/java/net/minestom/server/command/CommandManager.java @@ -378,7 +378,7 @@ public class CommandManager { return literalNode; } - private List toNodes(Argument argument, boolean executable) { + private List toNodes(Argument argument, boolean executable) { List nodes = new ArrayList<>(); /*DeclareCommandsPacket.Node testNode = simpleArgumentNode(nodes, argument, executable); @@ -515,7 +515,7 @@ public class CommandManager { return nodes; } - private byte getNumberProperties(ArgumentNumber argumentNumber) { + private byte getNumberProperties(ArgumentNumber argumentNumber) { byte result = 0; if (argumentNumber.hasMin()) result += 1; @@ -525,7 +525,7 @@ public class CommandManager { } private DeclareCommandsPacket.Node simpleArgumentNode(List nodes, - Argument argument, boolean executable) { + Argument argument, boolean executable) { DeclareCommandsPacket.Node argumentNode = new DeclareCommandsPacket.Node(); nodes.add(argumentNode); diff --git a/src/main/java/net/minestom/server/command/builder/Arguments.java b/src/main/java/net/minestom/server/command/builder/Arguments.java index edbf9a030..2f8fa2021 100644 --- a/src/main/java/net/minestom/server/command/builder/Arguments.java +++ b/src/main/java/net/minestom/server/command/builder/Arguments.java @@ -11,13 +11,13 @@ import net.minestom.server.utils.math.FloatRange; import net.minestom.server.utils.math.IntRange; import net.minestom.server.utils.time.UpdateOption; -import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public class Arguments { - private Map args = new HashMap<>(); + private final Map args = new HashMap<>(); public Structure getStructure(String id) { return (Structure) getObject(id); @@ -87,8 +87,8 @@ public class Arguments { return (FloatRange) getObject(id); } - public ArrayList getEntities(String id) { - return (ArrayList) getObject(id); + public List getEntities(String id) { + return (List) getObject(id); } public Object getObject(String id) { diff --git a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentTime.java b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentTime.java index bf6ea7bcc..cb43caa29 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentTime.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentTime.java @@ -29,7 +29,7 @@ public class ArgumentTime extends Argument { value = value.substring(0, value.length() - 1); try { // Check if value is a number - Integer.valueOf(value); + Integer.parseInt(value); return SUCCESS; } catch (NumberFormatException e) { @@ -49,7 +49,7 @@ public class ArgumentTime extends Argument { timeUnit = TimeUnit.TICK; } value = value.substring(0, value.length() - 1); - final int time = Integer.valueOf(value); + final int time = Integer.parseInt(value); return new UpdateOption(time, timeUnit); } diff --git a/src/main/java/net/minestom/server/command/builder/arguments/number/ArgumentNumber.java b/src/main/java/net/minestom/server/command/builder/arguments/number/ArgumentNumber.java index 89572bf68..4c572ff1b 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/number/ArgumentNumber.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/number/ArgumentNumber.java @@ -5,7 +5,7 @@ import net.minestom.server.command.builder.arguments.Argument; import java.math.BigDecimal; import java.util.regex.Pattern; -public abstract class ArgumentNumber extends Argument { +public abstract class ArgumentNumber extends Argument { public static final int NOT_NUMBER_ERROR = 1; public static final int RANGE_ERROR = 2; @@ -17,19 +17,19 @@ public abstract class ArgumentNumber extends Argument { super(id, false); } - public ArgumentNumber min(T value) { + public ArgumentNumber min(T value) { this.min = value; this.hasMin = true; return this; } - public ArgumentNumber max(T value) { + public ArgumentNumber max(T value) { this.max = value; this.hasMax = true; return this; } - public ArgumentNumber between(T min, T max) { + public ArgumentNumber between(T min, T max) { this.min = min; this.max = max; this.hasMin = true;