diff options
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/DynamicKeyCommand.kt | 38 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/DulkirConfig.kt | 9 |
3 files changed, 62 insertions, 9 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 91335f9..6cf8251 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -41,18 +41,20 @@ class DulkirMod { fun preInit(event: FMLPreInitializationEvent) { val directory = File(event.modConfigurationDirectory, "dulkirmod") directory.mkdirs() + val cch = ClientCommandHandler.instance // REGISTER COMMANDS HERE // Help Commands - ClientCommandHandler.instance.registerCommand(HelpCommand()) + cch.registerCommand(HelpCommand()) // General - ClientCommandHandler.instance.registerCommand(EnchantRuneCommand()) - ClientCommandHandler.instance.registerCommand(FairyCommand()) - ClientCommandHandler.instance.registerCommand(SettingsCommand()) - ClientCommandHandler.instance.registerCommand(JoinDungeonCommand()) - ClientCommandHandler.instance.registerCommand(LeapNameCommand()) - ClientCommandHandler.instance.registerCommand(HurtCamCommand()) - ClientCommandHandler.instance.registerCommand(FarmingControlSchemeCommand()) + cch.registerCommand(EnchantRuneCommand()) + cch.registerCommand(FairyCommand()) + cch.registerCommand(SettingsCommand()) + cch.registerCommand(JoinDungeonCommand()) + cch.registerCommand(LeapNameCommand()) + cch.registerCommand(HurtCamCommand()) + cch.registerCommand(FarmingControlSchemeCommand()) + cch.registerCommand(DynamicKeyCommand()) } @Mod.EventHandler @@ -122,6 +124,9 @@ class DulkirMod { if (keyBinds[2].isPressed) { FarmingControlSchemeCommand.toggleControls(); } + if (keyBinds[3].isPressed) { + TextUtils.sendMessage("/${DulkirConfig.dynamicCommandString}") + } } companion object { @@ -138,7 +143,8 @@ class DulkirMod { val keyBinds = arrayOf( KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"), KeyBinding("Toggle Selfie Setting", Keyboard.KEY_NONE, "Dulkir Mod"), - KeyBinding("Toggle Farming Controls", Keyboard.KEY_NONE, "Dulkir Mod") + KeyBinding("Toggle Farming Controls", Keyboard.KEY_NONE, "Dulkir Mod"), + KeyBinding("Dynamic Key", Keyboard.KEY_NONE, "Dulkir Mod") ) } 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 diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt index 760ba91..587c6ba 100644 --- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt +++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt @@ -141,6 +141,15 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf var cancelArmorGlint = false @Text( + name = "Dynamic Key Command", + description = "'/dk help' for more info", + category = "Random Beta Features", + subcategory = "Random Beta Features", + secure = false + ) + var dynamicCommandString = "" + + @Text( name = "Throttle Notifier String", description = "How do you want to tell people you are throttled?", category = "Dungeons", |