import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.ServerCommandSource;
class BeaconCommandBuilder {
private static final String LEVEL = "level";
- static LiteralArgumentBuilder<CommandSource> build(String command) {
- return Commands.literal(command)
- .then(Commands.literal(ArgumentNames.ADD)
- .then(Commands.argument(ArgumentNames.POS, Arguments.coords())
- .then(Commands.argument(LEVEL, Arguments.integer(1, 4))
+ static LiteralArgumentBuilder<ServerCommandSource> build(String command) {
+ return CommandManager.literal(command)
+ .then(CommandManager.literal(ArgumentNames.ADD)
+ .then(CommandManager.argument(ArgumentNames.POS, Arguments.coords())
+ .then(CommandManager.argument(LEVEL, Arguments.integer(1, 4))
.executes(BeaconCommandBuilder::addBeacon)))
- .then(Commands.argument(LEVEL, Arguments.integer(1, 4))
+ .then(CommandManager.argument(LEVEL, Arguments.integer(1, 4))
.executes(BeaconCommandBuilder::addBeacon)))
- .then(Commands.literal(ArgumentNames.CLEAR)
+ .then(CommandManager.literal(ArgumentNames.CLEAR)
.executes(context -> {
CustomBeaconProvider.clear();
CommandHelper.feedback(context, "bbor.commands.beacon.cleared.all");
return 0;
})
- .then(Commands.argument(ArgumentNames.POS, Arguments.coords())
+ .then(CommandManager.argument(ArgumentNames.POS, Arguments.coords())
.executes(context -> {
Coords coords = Arguments.getCoords(context, ArgumentNames.POS);
boolean removed = CustomBeaconProvider.remove(coords);
})));
}
- private static int addBeacon(CommandContext<CommandSource> context) throws CommandSyntaxException {
+ private static int addBeacon(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
Coords coords = Arguments.getCoords(context, ArgumentNames.POS);
int level = Arguments.getInteger(context, LEVEL);