diff options
author | inglettronald <inglettronald@gmail.com> | 2023-06-10 21:38:38 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-06-10 21:38:38 -0500 |
commit | f3f6da9f50edfbe9ed3be42fa16146210e60fbf3 (patch) | |
tree | 96c54aa7de1bd2d79d062ad0f787e46c88034a83 /src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt | |
parent | 22508bb83e8d5846a7a68dd5346e8a2013e1c710 (diff) | |
download | DulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.tar.gz DulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.tar.bz2 DulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.zip |
yeah I'm not documenting this today
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt b/src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt new file mode 100644 index 0000000..f253957 --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/commands/DynamicKeyCommand.kt @@ -0,0 +1,48 @@ +package com.dulkirfabric.commands + +import com.dulkirfabric.util.TextUtils +import com.mojang.brigadier.CommandDispatcher +import com.mojang.brigadier.arguments.StringArgumentType +import com.mojang.brigadier.builder.LiteralArgumentBuilder +import com.mojang.brigadier.builder.RequiredArgumentBuilder +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource +import net.minecraft.command.CommandRegistryAccess + +object DynamicKeyCommand { + var command = "" + fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) { + dispatcher.register( + LiteralArgumentBuilder.literal<FabricClientCommandSource>("dk") + .executes { context -> + TextUtils.info("§6Usage: /dk set <command>") + TextUtils.info("§6For more information about this command, run /dk help") + return@executes 0 + } + .then( + LiteralArgumentBuilder.literal<FabricClientCommandSource>("set") + .then( + RequiredArgumentBuilder.argument<FabricClientCommandSource, String>("command", RestArgumentType) + .executes { context -> + command = StringArgumentType.getString(context, "command") + command = command.removePrefix("/") + TextUtils.info("§6§lCommand Registered: §7$command") + return@executes 1 + } + ) + ) + .then( + LiteralArgumentBuilder.literal<FabricClientCommandSource>("help") + .executes { + TextUtils.info("§6§lDynamic Keybind Info") + TextUtils.info("§7 - There's a keybind setting inside your Dulkir Config 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@executes 2 + } + ) + ) + } + +}
\ No newline at end of file |