Skip to content

Commit

Permalink
New action
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Sep 10, 2024
1 parent 1c21096 commit 831d220
Show file tree
Hide file tree
Showing 2 changed files with 366 additions and 313 deletions.
12 changes: 9 additions & 3 deletions patches/server/0006-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,10 @@ index 0000000000000000000000000000000000000000..59c98fa51afd4fd305852d14509b06f8
+}
diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgument.java b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java
new file mode 100644
index 0000000000000000000000000000000000000000..2f0e6671dd8bfe4f320eab92c5f5bbc10abc3b05
index 0000000000000000000000000000000000000000..0bccbf7816ef621316f0da4911ec112f4753f88e
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java
@@ -0,0 +1,49 @@
@@ -0,0 +1,55 @@
+package org.leavesmc.leaves.command;
+
+import org.jetbrains.annotations.NotNull;
Expand All @@ -988,17 +988,23 @@ index 0000000000000000000000000000000000000000..2f0e6671dd8bfe4f320eab92c5f5bbc1
+
+public class CommandArgument {
+
+ public static final CommandArgument EMPTY = new CommandArgument();
+
+ private final List<CommandArgumentType<?>> argumentTypes;
+ private final List<List<String>> tabComplete;
+
+ public CommandArgument(CommandArgumentType<?>... argumentTypes) {
+ private CommandArgument(CommandArgumentType<?>... argumentTypes) {
+ this.argumentTypes = List.of(argumentTypes);
+ this.tabComplete = new ArrayList<>();
+ for (int i = 0; i < argumentTypes.length; i++) {
+ tabComplete.add(new ArrayList<>());
+ }
+ }
+
+ public static CommandArgument of(CommandArgumentType<?>... argumentTypes) {
+ return new CommandArgument(argumentTypes);
+ }
+
+ public List<String> tabComplete(int n) {
+ if (tabComplete.size() > n) {
+ return tabComplete.get(n);
Expand Down
Loading

0 comments on commit 831d220

Please sign in to comment.