diff --git a/src/main/java/net/slqmy/template_paper_plugin/commands/GiveCustomItemCommand.java b/src/main/java/net/slqmy/template_paper_plugin/commands/GiveCustomItemCommand.java index 1a26b38a..03496af9 100644 --- a/src/main/java/net/slqmy/template_paper_plugin/commands/GiveCustomItemCommand.java +++ b/src/main/java/net/slqmy/template_paper_plugin/commands/GiveCustomItemCommand.java @@ -28,16 +28,13 @@ public GiveCustomItemCommand(TemplatePaperPlugin plugin) { String[] customItemIds = Stream.of(CustomItem.values()).map((customItem) -> customItem.name()).toArray(String[]::new); - Argument customItemArgument = new CustomArgument(new StringArgument(customItemArgumentNodeName), new CustomArgumentInfoParser<>() { - @Override - public CustomItem apply(CustomArgumentInfo info) throws CustomArgumentException { - String input = info.currentInput(); - - try { - return CustomItem.valueOf(input); - } catch (IllegalArgumentException exception) { - throw CustomArgumentException.fromAdventureComponent(plugin.getLanguageManager().getMessage(Message.UNKNOWN_CUSTOM_ITEM, info.sender(), input)); - } + Argument customItemArgument = new CustomArgument(new StringArgument(customItemArgumentNodeName), (CustomArgumentInfo info) -> { + String input = info.currentInput(); + + try { + return CustomItem.valueOf(input); + } catch (IllegalArgumentException exception) { + throw CustomArgumentException.fromAdventureComponent(plugin.getLanguageManager().getMessage(Message.UNKNOWN_CUSTOM_ITEM, info.sender(), input)); } }).includeSuggestions(ArgumentSuggestions.strings(customItemIds)); diff --git a/src/main/java/net/slqmy/template_paper_plugin/commands/SpawnCustomEntityCommand.java b/src/main/java/net/slqmy/template_paper_plugin/commands/SpawnCustomEntityCommand.java index 3457dc47..4dfbe610 100644 --- a/src/main/java/net/slqmy/template_paper_plugin/commands/SpawnCustomEntityCommand.java +++ b/src/main/java/net/slqmy/template_paper_plugin/commands/SpawnCustomEntityCommand.java @@ -28,16 +28,13 @@ public SpawnCustomEntityCommand(TemplatePaperPlugin plugin) { String[] customEntityIds = Stream.of(CustomEntity.values()).map((customEntity) -> customEntity.name()).toArray(String[]::new); - Argument customEntityArgument = new CustomArgument(new StringArgument(customEntityArgumentNodeName), new CustomArgumentInfoParser<>() { - @Override - public CustomEntity apply(CustomArgumentInfo info) throws CustomArgumentException { - String input = info.currentInput(); - - try { - return CustomEntity.valueOf(input); - } catch (IllegalArgumentException exception) { - throw CustomArgumentException.fromAdventureComponent(plugin.getLanguageManager().getMessage(Message.UNKNOWN_CUSTOM_ENTITY, info.sender(), input)); - } + Argument customEntityArgument = new CustomArgument(new StringArgument(customEntityArgumentNodeName), (CustomArgumentInfo info) -> { + String input = info.currentInput(); + + try { + return CustomEntity.valueOf(input); + } catch (IllegalArgumentException exception) { + throw CustomArgumentException.fromAdventureComponent(plugin.getLanguageManager().getMessage(Message.UNKNOWN_CUSTOM_ENTITY, info.sender(), input)); } }).includeSuggestions(ArgumentSuggestions.strings(customEntityIds));