diff options
| author | Arslaan Pathan <[email protected]> | 2026-09-26 17:19:52 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-09-26 17:19:52 +1200 |
| commit | fe3b3d2905043cd18c7b659796b34f97530b89ca (patch) | |
| tree | c01c58edd04f2449ab2046c9d44fb6662f5b9efa /src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java | |
| parent | 59960ce97abf61d2e46d43aa9fca2042f74b5981 (diff) | |
| download | arslaansmagichax-fe3b3d2905043cd18c7b659796b34f97530b89ca.tar.xz arslaansmagichax-fe3b3d2905043cd18c7b659796b34f97530b89ca.zip | |
commands are overrated anyway (purge all commands because fabric 26.2 doesnt have another handler)
Diffstat (limited to 'src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java')
| -rw-r--r-- | src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java b/src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java deleted file mode 100644 index 60e6b52..0000000 --- a/src/main/java/com/arslaancodes/arslaansmagichax/commands/ModuleToggleCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.commands.CommandBuildContext; -import net.minecraft.network.chat.Component; -import com.arslaancodes.arslaansmagichax.modules.ModuleManager; - -public class ModuleToggleCommand { - public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandBuildContext access) { - dispatcher.register( - ClientCommandManager.literal("module") - .then( - ClientCommandManager.literal("toggle") - .then( - ClientCommandManager.argument("moduleName", StringArgumentType.word()) - .suggests(new ModuleSuggestionProvider()) - .executes(ModuleToggleCommand::run) - ) - ) - ); - } - - private static int run(CommandContext<FabricClientCommandSource> context) throws CommandSyntaxException { - String moduleName = StringArgumentType.getString(context, "moduleName"); - - ModuleManager.getAllModules().stream() - .filter(m -> m.getName().equalsIgnoreCase(moduleName)) - .findFirst() - .ifPresentOrElse(module -> { - module.toggle(); - context.getSource().sendFeedback(Component.literal( - "Toggled module " + module.getName() + " to " + (module.isEnabled() ? "ON" : "OFF") - )); - }, () -> context.getSource().sendError(Component.literal("Module not found: " + moduleName))); - - return 1; - } -} |
