Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import net.ornithemc.osl.commands.api.client.ClientCommandEvents;
import net.ornithemc.osl.commands.api.client.ClientCommands;
import net.ornithemc.osl.commands.api.client.command.ClientCommandSource;
import net.ornithemc.osl.commands.api.client.command.HelpCommand;
import net.ornithemc.osl.commands.api.command.SharedSuggestionProvider;
import net.ornithemc.osl.commands.impl.BrigadierCommandsImpl;
import net.ornithemc.osl.commands.impl.client.command.HelpCommand;

public final class ClientCommandsImpl {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.ornithemc.osl.commands.api.client.command;
package net.ornithemc.osl.commands.impl.client.command;

import java.util.List;
import java.util.Map;
Expand All @@ -16,21 +16,28 @@
import com.mojang.brigadier.tree.CommandNode;

import net.ornithemc.osl.commands.api.client.ClientCommands;
import net.ornithemc.osl.commands.api.client.command.ClientCommandSource;
import net.ornithemc.osl.text.api.TextComponents;

public final class HelpCommand {

private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(TextComponents.translatable("commands.help.failed"));

public static void register(CommandDispatcher<ClientCommandSource> dispatcher) {
LiteralArgumentBuilder<ClientCommandSource> command = ClientCommands
LiteralArgumentBuilder<ClientCommandSource> mainCommand = ClientCommands
.literal("osl-client-commands");
LiteralArgumentBuilder<ClientCommandSource> shortCommand = ClientCommands
.literal("occ");

LiteralArgumentBuilder<ClientCommandSource> help = ClientCommands
.literal("help")
.executes(HelpCommand::giveHelp)
.then(ClientCommands
.argument("command", StringArgumentType.greedyString())
.executes(HelpCommand::giveCommandHelp));

dispatcher.register(command);
CommandNode<ClientCommandSource> command = dispatcher.register(mainCommand.then(help));
dispatcher.register(shortCommand.redirect(command));
}

private static int giveHelp(CommandContext<ClientCommandSource> ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.ornithemc.osl.commands.api.client.ClientCommandEvents;
import net.ornithemc.osl.commands.api.client.ClientCommands;
import net.ornithemc.osl.commands.api.client.command.ClientCommandSource;
import net.ornithemc.osl.commands.api.client.command.HelpCommand;
import net.ornithemc.osl.commands.impl.client.command.HelpCommand;
import net.ornithemc.osl.text.api.ClickEvent;
import net.ornithemc.osl.text.api.HoverEvent;
import net.ornithemc.osl.text.api.TextColor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.ornithemc.osl.commands.api.client.command;
package net.ornithemc.osl.commands.impl.client.command;

import java.util.Map;

Expand All @@ -15,21 +15,28 @@
import com.mojang.brigadier.tree.CommandNode;

import net.ornithemc.osl.commands.api.client.ClientCommands;
import net.ornithemc.osl.commands.api.client.command.ClientCommandSource;
import net.ornithemc.osl.text.api.TextComponents;

public final class HelpCommand {

private static final SimpleCommandExceptionType ERROR_FAILED = new SimpleCommandExceptionType(TextComponents.translatable("commands.help.failed"));

public static void register(CommandDispatcher<ClientCommandSource> dispatcher) {
LiteralArgumentBuilder<ClientCommandSource> command = ClientCommands
LiteralArgumentBuilder<ClientCommandSource> mainCommand = ClientCommands
.literal("osl-client-commands");
LiteralArgumentBuilder<ClientCommandSource> shortCommand = ClientCommands
.literal("occ");

LiteralArgumentBuilder<ClientCommandSource> help = ClientCommands
.literal("help")
.executes(HelpCommand::giveHelp)
.then(ClientCommands
.argument("command", StringArgumentType.greedyString())
.executes(HelpCommand::giveCommandHelp));

dispatcher.register(command);
CommandNode<ClientCommandSource> command = dispatcher.register(mainCommand.then(help));
dispatcher.register(shortCommand.redirect(command));
}

private static int giveHelp(CommandContext<ClientCommandSource> ctx) {
Expand Down
Loading