From d7405eed87e873699a18a56cc423061126895ffc Mon Sep 17 00:00:00 2001 From: Krakenied Date: Wed, 13 Mar 2024 12:12:04 +0100 Subject: Clarity changes to smithing task type + docs Related to https://github.com/LMBishop/Quests/pull/627 --- .../quests/bukkit/tasktype/type/SmithingTaskType.java | 11 ++++++++++- docs/task-types/smithing-(task-type).md | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/SmithingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/SmithingTaskType.java index 44b5a124..600a19cf 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/SmithingTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/SmithingTaskType.java @@ -36,7 +36,14 @@ public final class SmithingTaskType extends BukkitTaskType { super.addConfigValidator(TaskUtils.useItemStackConfigValidator(this, "item")); super.addConfigValidator(TaskUtils.useIntegerConfigValidator(this, "data")); super.addConfigValidator(TaskUtils.useBooleanConfigValidator(this, "exact-match")); + + if (plugin.getVersionSpecificHandler().getMinecraftVersion() < 20) { + return; + } + + super.addConfigValidator(TaskUtils.useRequiredConfigValidator(this, "mode")); super.addConfigValidator(TaskUtils.useAcceptedValuesConfigValidator(this, Arrays.asList( + "any", // for clarity reasons we want the user to specify the mode on 1.20+ "transform", "trim" ), "mode")); @@ -85,9 +92,11 @@ public final class SmithingTaskType extends BukkitTaskType { Task task = pendingTask.task(); TaskProgress taskProgress = pendingTask.taskProgress(); + // null on versions lower than 1.20 if (recipeType != null) { final String mode = (String) task.getConfigValue("mode"); - if (!recipeType.equals(mode)) { + + if (!recipeType.equals(mode) && !"any".equals(mode)) { super.debug("Specific mode is required, but the actual mode '" + recipeType + "' does not match, continuing...", quest.getId(), task.getId(), player.getUniqueId()); continue; } diff --git a/docs/task-types/smithing-(task-type).md b/docs/task-types/smithing-(task-type).md index d5f43177..7379c138 100644 --- a/docs/task-types/smithing-(task-type).md +++ b/docs/task-types/smithing-(task-type).md @@ -20,7 +20,7 @@ Smith a certain number of items using a smithing table. |---------------|--------------------------------------------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `amount` | The number of items to smith. | Integer | Yes | \- | \- | | `item` | The specific item to smith. | Material, or ItemStack | No | \- | Accepts standard [item definition](../configuration/defining-items). Please see [this list](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html) (1.13+) or [this list](https://helpch.at/docs/1.12.2/org/bukkit/Material.html) (1.8-1.12) for material names. If this is not specified, any item will count. | -| `mode` | The specific mode of smithing. | String | Yes | \- | One of: `transform`, `trim`. | +| `mode` | The specific mode of smithing. | String | 1.20+ | \- | One of: `any`, `transform`, `trim`. | | `worlds` | Worlds which should count towards the progress. | List of world names | No | \- | \- | | `exact-match` | Whether the item should exactly match what is defined. | Boolean | No | true | \- | -- cgit v1.2.3-70-g09d2