]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/commands/CustomCommand.java
Setup for 1.14.4-Fabric
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / commands / CustomCommand.java
1 package com.irtimaled.bbor.client.commands;
2
3 import com.irtimaled.bbor.client.providers.CustomBeaconProvider;
4 import com.irtimaled.bbor.client.providers.CustomBoxProvider;
5 import com.irtimaled.bbor.client.providers.CustomLineProvider;
6 import com.irtimaled.bbor.client.providers.CustomSphereProvider;
7 import com.mojang.brigadier.CommandDispatcher;
8 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
9 import net.minecraft.server.command.CommandManager;
10 import net.minecraft.server.command.CommandSource;
11
12 public class CustomCommand {
13     private static final String COMMAND = "bbor:custom";
14     private static final String BOX = "box";
15     private static final String BEACON = "beacon";
16     private static final String LINE = "line";
17     private static final String SPHERE = "sphere";
18
19     public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
20         LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
21                 .then(BoxCommandBuilder.build(BOX))
22                 .then(BeaconCommandBuilder.build(BEACON))
23                 .then(LineCommandBuilder.build(LINE))
24                 .then(SphereCommandBuilder.build(SPHERE))
25                 .then(CommandManager.literal(ArgumentNames.CLEAR)
26                         .executes(context -> {
27                             CustomBoxProvider.clear();
28                             CustomBeaconProvider.clear();
29                             CustomLineProvider.clear();
30                             CustomSphereProvider.clear();
31
32                             CommandHelper.feedback(context, "bbor.commands.custom.cleared.all");
33                             return 0;
34                         }));
35         commandDispatcher.register(command);
36     }
37 }