diff --git a/pom.xml b/pom.xml
index 408e103..059222d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.github.alathra
SiegeEngines
- 0.4.0
+ 0.5.0
jar
SiegeEngines
diff --git a/src/main/java/com/github/alathra/siegeengines/command/SiegeEnginesCommand.java b/src/main/java/com/github/alathra/siegeengines/command/SiegeEnginesCommand.java
index e7980dd..eee8644 100644
--- a/src/main/java/com/github/alathra/siegeengines/command/SiegeEnginesCommand.java
+++ b/src/main/java/com/github/alathra/siegeengines/command/SiegeEnginesCommand.java
@@ -30,6 +30,7 @@ public class SiegeEnginesCommand {
.withShortDescription("Example command.")
.withPermission("siegeengines.command")
.withSubcommands(
+ commandGet(),
commandGetAll(),
commandReload()
)
@@ -41,6 +42,22 @@ public class SiegeEnginesCommand {
sender.sendMessage(ColorParser.of("Incorrect usage, /SiegeEngines get, /SiegeEngines reload").build());
}
+ private CommandAPICommand commandGet() {
+ return new CommandAPICommand("get")
+ .withPermission("siegeengines.command.get")
+ .withArguments(
+ new StringArgument("equipmentid")
+ .replaceSuggestions(
+ ArgumentSuggestions.strings(
+ DefinedEquipment.values().stream().map(gunnerEquipment -> gunnerEquipment.EquipmentId).toList()
+ )
+ ),
+ new PlayerArgument("target")
+ .setOptional(true)
+ )
+ .executesPlayer(this::onGet);
+ }
+
private CommandAPICommand commandGetAll() {
return new CommandAPICommand("getAll")
.withPermission("siegeengines.command.getAll")
@@ -53,6 +70,20 @@ public class SiegeEnginesCommand {
.executesPlayer(this::onReload);
}
+ private void onGet(CommandSender sender, CommandArguments args) throws WrapperCommandSyntaxException {
+ if (!(args.get("equipmentid") instanceof String equipmentId))
+ throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("Invalid equipment id specified.").build());
+
+ Player player = (Player) args.getOptional("target").orElse(sender);
+
+ for (GunnerEquipment gunnerEquipment : DefinedEquipment.values()) {
+ if (gunnerEquipment.equals(equipmentId)) {
+ giveEquipment(player, gunnerEquipment);
+ break;
+ }
+ }
+ }
+
private void onGetAll(CommandSender sender, CommandArguments args) throws WrapperCommandSyntaxException {
if (!(sender instanceof Player player))
throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("Only players can use this command.").build());