aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/command
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-05-09 00:19:57 -0500
committeringlettronald <inglettronald@gmail.com>2023-05-09 00:19:57 -0500
commitdac450a6bf943cd08d1acf91f64997f9644c0a57 (patch)
tree5c964ce2d6ff236b1e0c3f3a014dc09842e62f9e /src/main/kotlin/dulkirmod/command
parent4cf5ea047f6fec2fab562fd4f99a08b165cabbb3 (diff)
downloadDulkirMod-dac450a6bf943cd08d1acf91f64997f9644c0a57.tar.gz
DulkirMod-dac450a6bf943cd08d1acf91f64997f9644c0a57.tar.bz2
DulkirMod-dac450a6bf943cd08d1acf91f64997f9644c0a57.zip
Added Dynamic Command Key code
Diffstat (limited to 'src/main/kotlin/dulkirmod/command')
-rw-r--r--src/main/kotlin/dulkirmod/command/DynamicKeyCommand.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/command/DynamicKeyCommand.kt b/src/main/kotlin/dulkirmod/command/DynamicKeyCommand.kt
new file mode 100644
index 0000000..535ca2c
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/command/DynamicKeyCommand.kt
@@ -0,0 +1,38 @@
+package dulkirmod.command
+
+import dulkirmod.config.DulkirConfig
+import dulkirmod.utils.TextUtils
+import net.minecraft.command.CommandException
+import net.minecraft.command.ICommandSender
+
+class DynamicKeyCommand: ClientCommandBase("dk"){
+ @Throws(CommandException::class)
+ override fun processCommand(sender: ICommandSender, args: Array<String>) {
+ if (args.isEmpty()) {
+ TextUtils.info("§6Usage: /dk set <command args>")
+ return
+ }
+ if (args[0] == "help") {
+ TextUtils.info("§6§lDynamic Keybind Info")
+ TextUtils.info("§7 - There's a keybind setting inside your minecraft controls you can use in order" +
+ " to make a chat macro for a particular in game command. This only works for commands.", prefix = false)
+ TextUtils.info("§7 - Usage: /dk set <command args>", prefix = false)
+ TextUtils.info("§7 (i made this cuz I have a mouse button that i use for a bunch of different useful " +
+ "actions depending upon what I'm doing, so don't worry if this feature doesn't apply to you lol)", prefix = false)
+ return
+ }
+ if (args[0] == "set") {
+ val builder = StringBuilder()
+ for (i in 1 until args.size) {
+ if (i == args.size - 1)
+ builder.append(args[i])
+ else
+ builder.append("${args[i]} ")
+ }
+ TextUtils.info("§6Registered command: /${builder}")
+ DulkirConfig.dynamicCommandString = builder.toString()
+ return
+ }
+ TextUtils.info("§6Usage: /dk set <command args>")
+ }
+} \ No newline at end of file