summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/config/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config/commands')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java4
2 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index b87961a2c..73b6cb46d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.features.misc.CollectionTracker
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil
+import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures
import at.hannibal2.skyhanni.features.slayer.SlayerItemProfitTracker
import at.hannibal2.skyhanni.test.PacketTest
import at.hannibal2.skyhanni.test.SkyHanniConfigSearchResetCommand
@@ -105,6 +106,11 @@ object Commands {
registerCommand("skyhanni", "Opens the main SkyHanni config", openMainMenu)
registerCommand("ff", "Opens the Farming Fortune Guide") { openFortuneGuide() }
registerCommand("shcommands", "Shows this list") { commandHelp(it) }
+ registerCommand0("shdefaultoptions", "Select default options", {
+ DefaultConfigFeatures.onCommand(
+ it.getOrNull(0) ?: "null", it.getOrNull(1) ?: "null"
+ )
+ }, DefaultConfigFeatures::onComplete)
}
private fun usersNormal() {
@@ -308,8 +314,24 @@ object Commands {
config.outdatedItems.clear()
}
- private fun registerCommand(name: String, description: String, function: (Array<String>) -> Unit) {
- ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function)))
+ private fun registerCommand(
+ name: String,
+ description: String,
+ function: (Array<String>) -> Unit
+ ) = registerCommand0(name, description, function)
+
+ private fun registerCommand0(
+ name: String,
+ description: String,
+ function: (Array<String>) -> Unit,
+ autoComplete: ((Array<String>) -> List<String>) = { listOf() }
+ ) {
+ ClientCommandHandler.instance.registerCommand(
+ SimpleCommand(
+ name,
+ createCommand(function),
+ { a, b, c -> autoComplete(b) })
+ )
commands.add(CommandInfo(name, description, currentCategory))
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
index fa2c310de..9ff8ade64 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
@@ -32,9 +32,9 @@ public class SimpleCommand extends CommandBase {
public abstract void processCommand(ICommandSender sender, String[] args);
}
- public abstract static class TabCompleteRunnable {
+ public interface TabCompleteRunnable {
- public abstract List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos);
+ List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos);
}
public boolean canCommandSenderUseCommand(ICommandSender sender) {