Add processing command, not working yet

This commit is contained in:
SemvdH
2025-10-19 01:11:23 +02:00
parent 7b8f801b73
commit 782f785637
3 changed files with 15 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ public class AddCoordinateCommandHandler implements CoordinatesCommandHandler {
/**
* Minimum arguments needed for adding a command: name, description, color
*/
private final int MIN_ARGS = 3;
private final int MIN_ARGS = 4;
@Override
public boolean handleCommand(CommandSender sender, String[] args) {
@@ -36,13 +36,13 @@ public class AddCoordinateCommandHandler implements CoordinatesCommandHandler {
}
return DatabaseManager.INSTANCE
.addCoordinate(args[0], // name
args[1], // description
.addCoordinate(args[1], // name
args[2], // description
new Coordinate.Position(playerLocation.getBlockX(), playerLocation.getBlockY(),
playerLocation.getBlockZ()), // position
playerWorld.getEnvironment().equals(World.Environment.NETHER), // nether
playerWorld.getName(), // world
MinecraftColor.fromString(args[2]) // color
MinecraftColor.fromString(args[3]) // color
);
}

View File

@@ -4,11 +4,20 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
public class CoordinatesCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return switch (label) {
TextComponent textComponent = new TextComponent("Got command " + command.getName() + " label " + label + " and args ");
for (String string : args) {
textComponent.addExtra(string);
}
sender.sendMessage(textComponent.getText());
return switch (args[0]) {
case "get" -> new GetCoordinatesCommandHandler().handleCommand(sender, args);
case "add" -> new AddCoordinateCommandHandler().handleCommand(sender, args);
default -> false;

View File

@@ -5,4 +5,4 @@ version: 0.1
commands:
ic-coords:
description: Main command for the coordinates
usage: /ic-coords get|add
usage: /ic-coords get | add