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
47 lines (43 loc) · 1.71 KB
/
Copy pathCommandManager.java
File metadata and controls
47 lines (43 loc) · 1.71 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
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 CommandCCConfig(),
new CommandConfirmCC(),
new CommandDelete(),
new CommandDFGive(),
new CommandFixCC(),
new CommandGetActionDump(),
new CommandGetSize(),
new CommandGetSpawn(),
new CommandJump(),
new CommandJumpToFreeSpot(),
new CommandLoad(),
new CommandNode(),
new CommandPing(),
new CommandSave(),
new CommandScanFor(),
new CommandScanPlot(),
new CommandSearch(),
new CommandSwap(),
new CommandTemplatePlacer(),
new CommandWidthDump(),
new CommandWorldPlot(),
new CommandUuid(),
new CommandName()
);
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);
});
}
}