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 * Minimum arguments needed for adding a command: name, description, color
*/ */
private final int MIN_ARGS = 3; private final int MIN_ARGS = 4;
@Override @Override
public boolean handleCommand(CommandSender sender, String[] args) { public boolean handleCommand(CommandSender sender, String[] args) {
@@ -36,13 +36,13 @@ public class AddCoordinateCommandHandler implements CoordinatesCommandHandler {
} }
return DatabaseManager.INSTANCE return DatabaseManager.INSTANCE
.addCoordinate(args[0], // name .addCoordinate(args[1], // name
args[1], // description args[2], // description
new Coordinate.Position(playerLocation.getBlockX(), playerLocation.getBlockY(), new Coordinate.Position(playerLocation.getBlockX(), playerLocation.getBlockY(),
playerLocation.getBlockZ()), // position playerLocation.getBlockZ()), // position
playerWorld.getEnvironment().equals(World.Environment.NETHER), // nether playerWorld.getEnvironment().equals(World.Environment.NETHER), // nether
playerWorld.getName(), // world 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.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
public class CoordinatesCommand implements CommandExecutor{ public class CoordinatesCommand implements CommandExecutor{
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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 "get" -> new GetCoordinatesCommandHandler().handleCommand(sender, args);
case "add" -> new AddCoordinateCommandHandler().handleCommand(sender, args); case "add" -> new AddCoordinateCommandHandler().handleCommand(sender, args);
default -> false; default -> false;

View File

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