Add help command

This commit is contained in:
SemvdH
2026-02-05 20:23:28 +01:00
parent 69dc87b718
commit ec00b18282
4 changed files with 29 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ public class CoordinatesCommand implements CommandExecutor{
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);
case "map" -> new GetMapCommandHandler().handleCommand(sender, args); case "map" -> new GetMapCommandHandler().handleCommand(sender, args);
case "help" -> new HelpCommandHandler().handleCommand(sender, args);
default -> false; default -> false;
}; };
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import nl.interestingcorner.core.MinecraftColor; import nl.interestingcorner.core.MinecraftColor;
public class GetMapCommandHandler implements CoordinatesCommandHandler { public class GetMapCommandHandler implements CoordinatesCommandHandler {
public static final String MAP_ITEM_NAME = MinecraftColor.LIGHT_PURPLE + "Map of Coordinates"; public static final String MAP_ITEM_NAME = MinecraftColor.LIGHT_PURPLE.toColorCode() + "Map of Coordinates";
public static final String MAP_ITEM_LORE = MinecraftColor.AQUA.toColorCode() + "This will take you anywhere!"; public static final String MAP_ITEM_LORE = MinecraftColor.AQUA.toColorCode() + "This will take you anywhere!";
@Override @Override

View File

@@ -0,0 +1,26 @@
package nl.interestingcorner.coordinates.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import nl.interestingcorner.core.MinecraftColor;
public class HelpCommandHandler implements CoordinatesCommandHandler {
@Override
public boolean handleCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) {
player.sendMessage(MinecraftColor.LIGHT_PURPLE.toColorCode() + "IC-Coords plugin commands:");
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords map" + MinecraftColor.WHITE.toColorCode() + " - Get a special map that you can use to teleport between coordinates");
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords get [world]" + MinecraftColor.WHITE.toColorCode() + " - Show all coordinates. Add a world name to filter by world.");
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords add <name> <description> [color]" + MinecraftColor.WHITE.toColorCode() + " - Add a new coordinate at you current location with a name, description, and color. If no color is specified, the color will be white");
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords help" + MinecraftColor.WHITE.toColorCode() + " - Show this help message");
return true;
} else {
sender.sendMessage("This command can only be used by a player.");
return false;
}
}
}

View File

@@ -7,4 +7,4 @@ depend: [IC-core]
commands: commands:
ic-coords: ic-coords:
description: Main command for the coordinates description: Main command for the coordinates
usage: /ic-coords get | add | map usage: /ic-coords get | add | map | help. To add a command, use /ic-coords add "name" "description" <color>.