forked from DFOnline/CodeClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandManager.java
More file actions
50 lines (46 loc) · 1.8 KB
/
CommandManager.java
File metadata and controls
50 lines (46 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dev.dfonline.codeclient.command;
import com.mojang.brigadier.CommandDispatcher;
import dev.dfonline.codeclient.command.impl.*;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.CommandRegistryAccess;
import java.util.List;
public class CommandManager {
private static final List<Command> COMMANDS = List.of(
new CommandAbort(),
new CommandAuth(),
new CommandCalc(),
new CommandCCConfig(),
new CommandConfirmCC(),
new CommandDelete(),
new CommandDFGive(),
new CommandFixCC(),
new CommandGetActionDump(),
new CommandGetSize(),
new CommandGetSpawn(),
new CommandItemData(),
new CommandJump(),
new CommandJumpToFreeSpot(),
new CommandLoad(),
new CommandName(),
new CommandNode(),
new CommandPing(),
new CommandPreview(),
new CommandSave(),
new CommandScanFor(),
new CommandScanPlot(),
new CommandSearch(),
new CommandSwap(),
new CommandTemplatePlacer(),
new CommandUuid(),
new CommandWidthDump(),
new CommandWorldPlot()
);
public static void init(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
COMMANDS.forEach(command -> {
if (command.name() == null || command.name().isEmpty() || command.name().contains(" ")) {
throw new IllegalStateException("Command name cannot be null, empty, or include whitespace. At class: " + command.getClass().getSimpleName());
}
command.register(dispatcher, registryAccess);
});
}
}