From b01ccfc537c7fe45b631721be23a934d9eab8f5e Mon Sep 17 00:00:00 2001 From: Kristian Knarvik Date: Wed, 27 Nov 2024 23:06:33 +0100 Subject: [PATCH] Finishes the ActionCost implementation --- pom.xml | 2 +- .../blacksmith/command/CostCommand.java | 65 ++++++ .../blacksmith/config/SettingValueType.java | 5 + .../scrapper/GlobalScrapperSettings.java | 9 - .../config/scrapper/ScrapperSetting.java | 4 +- .../blacksmith/container/ActionCost.java | 189 ++++++++++++++---- .../blacksmith/manager/EconomyManager.java | 14 ++ .../blacksmith/trait/ScrapperTrait.java | 3 +- .../util/TabCompleteValuesHelper.java | 2 + .../blacksmith/util/TypeValidationHelper.java | 3 +- 10 files changed, 242 insertions(+), 54 deletions(-) create mode 100644 src/main/java/net/knarcraft/blacksmith/command/CostCommand.java diff --git a/pom.xml b/pom.xml index d374efa..50e7e4f 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ org.spigotmc spigot-api - 1.20.6-R0.1-SNAPSHOT + 1.21.3-R0.1-SNAPSHOT provided diff --git a/src/main/java/net/knarcraft/blacksmith/command/CostCommand.java b/src/main/java/net/knarcraft/blacksmith/command/CostCommand.java new file mode 100644 index 0000000..d602385 --- /dev/null +++ b/src/main/java/net/knarcraft/blacksmith/command/CostCommand.java @@ -0,0 +1,65 @@ +package net.knarcraft.blacksmith.command; + +import net.knarcraft.blacksmith.BlacksmithPlugin; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabExecutor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class CostCommand implements TabExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] arguments) { + //TODO: Whenever a cost is specified (not for the per-material and per-enchantment costs), allow either a simple + // cost or an ActionCost. When loading costs, first try and parse a double. If not, parse an ActionCost object. + // TODO: The command should look like "blacksmithEdit