]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/commands/CustomCommand.java
Add support for custom line
[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.mojang.brigadier.CommandDispatcher;
7 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
8 import net.minecraft.command.Commands;
9 import net.minecraft.command.ISuggestionProvider;
10
11 public class CustomCommand {
12     private static final String COMMAND = "bbor:custom";
13     private static final String BOX = "box";
14     private static final String BEACON = "beacon";
15     private static final String LINE = "line";
16
17     public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
18         LiteralArgumentBuilder command = Commands.literal(COMMAND)
19                 .then(BoxCommandBuilder.build(BOX))
20                 .then(BeaconCommandBuilder.build(BEACON))
21                 .then(LineCommandBuilder.build(LINE))
22                 .then(Commands.literal(ArgumentNames.CLEAR)
23                         .executes(context -> {
24                             CustomBoxProvider.clear();
25                             CustomBeaconProvider.clear();
26                             CustomLineProvider.clear();
27
28                             CommandHelper.feedback(context, "bbor.commands.custom.cleared.all");
29                             return 0;
30                         }));
31         commandDispatcher.register(command);
32     }
33 }
34