Skip to content

Commit d6a5fa8

Browse files
renamed ListArguments to StringArguments
1 parent 6cf3f56 commit d6a5fa8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/main/java/com/datasiqn/commandcore/MainCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.datasiqn.commandcore;
22

3-
import com.datasiqn.commandcore.argument.ListArguments;
3+
import com.datasiqn.commandcore.argument.StringArguments;
44
import com.datasiqn.commandcore.command.Command;
55
import com.datasiqn.commandcore.command.TabComplete;
66
import com.datasiqn.commandcore.managers.CommandManager;
@@ -41,7 +41,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
4141
}
4242
List<String> listArgs = new ArrayList<>(Arrays.asList(args));
4343
listArgs.remove(0);
44-
Result<None, List<String>> output = cmd.execute(CommandCore.createContext(CommandCore.createSource(sender), cmd, args[0], new ListArguments(listArgs)));
44+
Result<None, List<String>> output = cmd.execute(CommandCore.createContext(CommandCore.createSource(sender), cmd, args[0], new StringArguments(listArgs)));
4545
output.ifError(messages -> {
4646
for (String message : messages) sender.sendMessage(ChatColor.RED + message);
4747
sender.sendMessage(ChatColor.GRAY + "Usage(s):");
@@ -69,7 +69,7 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull org.bu
6969
if (cmd == null || (cmd.getPermissionString() != null && !sender.hasPermission(cmd.getPermissionString()))) return new ArrayList<>();
7070
List<String> listArgs = new ArrayList<>(Arrays.asList(args));
7171
listArgs.remove(0);
72-
TabComplete complete = cmd.tabComplete(CommandCore.createContext(CommandCore.createSource(sender), cmd, args[0], new ListArguments(listArgs)));
72+
TabComplete complete = cmd.tabComplete(CommandCore.createContext(CommandCore.createSource(sender), cmd, args[0], new StringArguments(listArgs)));
7373
matchingString = complete.getMatchingString();
7474
tabComplete.addAll(complete.values());
7575
}

src/main/java/com/datasiqn/commandcore/argument/ListArguments.java renamed to src/main/java/com/datasiqn/commandcore/argument/StringArguments.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
import java.util.List;
88

99
/**
10-
* An implementation of {@code Arguments} that uses an internal {@code List<String>} to store all arguments
10+
* Represents a list of arguments that are already parsed
1111
*/
12-
public class ListArguments implements Arguments {
12+
public class StringArguments implements Arguments {
1313
protected final List<String> allArguments;
1414

1515
/**
1616
* Creates a new {@code ListArguments}
1717
* @param args The arguments in a string list
1818
*/
19-
public ListArguments(List<String> args) {
19+
public StringArguments(List<String> args) {
2020
allArguments = args;
2121
}
2222

@@ -26,7 +26,7 @@ public int size() {
2626
}
2727

2828
@Override
29-
public @NotNull <T> Result<T, String> get(int i, @NotNull ArgumentType<T> type) {
29+
public @NotNull <T> Result<T, String> getChecked(int i, @NotNull ArgumentType<T> type) {
3030
checkBounds(i);
3131
return type.parse(new StringArgumentReader(allArguments.get(i)));
3232
}

src/main/java/com/datasiqn/commandcore/command/builder/BuilderCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.datasiqn.commandcore.CommandCore;
44
import com.datasiqn.commandcore.argument.ArgumentReader;
55
import com.datasiqn.commandcore.argument.Arguments;
6-
import com.datasiqn.commandcore.argument.ListArguments;
6+
import com.datasiqn.commandcore.argument.StringArguments;
77
import com.datasiqn.commandcore.command.Command;
88
import com.datasiqn.commandcore.command.CommandContext;
99
import com.datasiqn.commandcore.command.TabComplete;
@@ -152,7 +152,7 @@ public boolean hasDescription() {
152152

153153
@Contract("_, _ -> new")
154154
private @NotNull CommandContext buildContext(@NotNull CommandContext context, @NotNull CurrentNode result) {
155-
return CommandCore.createContext(context.getSource(), context.getCommand(), context.getLabel(), new ListArguments(result.args));
155+
return CommandCore.createContext(context.getSource(), context.getCommand(), context.getLabel(), new StringArguments(result.args));
156156
}
157157

158158
private @NotNull Result<ApplicableNode, List<String>> checkApplicable(@NotNull ArgumentReader reader, @NotNull Set<CommandNode<?>> nodes) {

0 commit comments

Comments
 (0)