aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-11-08 17:44:27 +1100
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-11-08 17:44:27 +1100
commit07403ec86c53f67b94d988b4c01a0afc2fdb2810 (patch)
treefba4b3c37b02c42267e03a07453d3941c98fd66d /src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java
parentfc4143dd3c892b11ae5f427fcecc22044ff98460 (diff)
parentec0660e41145d3d9ed479b3e697afddf8ddc8c4c (diff)
downloadnotenoughupdates-07403ec86c53f67b94d988b4c01a0afc2fdb2810.tar.gz
notenoughupdates-07403ec86c53f67b94d988b4c01a0afc2fdb2810.tar.bz2
notenoughupdates-07403ec86c53f67b94d988b4c01a0afc2fdb2810.zip
Merge branch 'beta'
uh yeah its pretty necessary guys
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java
index ae27be46..029e24db 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java
@@ -3,21 +3,36 @@ package io.github.moulberry.notenoughupdates.commands;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
+import net.minecraft.util.BlockPos;
+
+import java.util.ArrayList;
+import java.util.List;
public class SimpleCommand extends CommandBase {
private String commandName;
private ProcessCommandRunnable runnable;
+ private TabCompleteRunnable tabRunnable;
public SimpleCommand(String commandName, ProcessCommandRunnable runnable) {
this.commandName = commandName;
this.runnable = runnable;
}
+ public SimpleCommand(String commandName, ProcessCommandRunnable runnable, TabCompleteRunnable tabRunnable) {
+ this.commandName = commandName;
+ this.runnable = runnable;
+ this.tabRunnable = tabRunnable;
+ }
+
public abstract static class ProcessCommandRunnable {
public abstract void processCommand(ICommandSender sender, String[] args);
}
+ public abstract static class TabCompleteRunnable {
+ public abstract List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos);
+ }
+
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return true;
}
@@ -33,4 +48,9 @@ public class SimpleCommand extends CommandBase {
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
runnable.processCommand(sender, args);
}
+
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if(tabRunnable != null) return tabRunnable.tabComplete(sender, args, pos);
+ return null;
+ }
}