diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index befd510..663bb9b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "v1.x.x", "v2.x.x" ] + branches: [ "v1.x.x", "v2.x.x", "v3.x.x" ] pull_request: - branches: [ "v1.x.x", "v2.x.x" ] + branches: [ "v1.x.x", "v2.x.x", "v3.x.x" ] release: types: [published] diff --git a/build.gradle.kts b/build.gradle.kts index 3619c05..214a49f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,7 @@ plugins { } group = "xyz.alexcrea" -version = "1.17.5" +version = "2.0.0" val isDevBuild = System.getenv("SMALL_COMMIT_HASH") != null val isPreRelease = System.getenv("IS_GITHUB_PRERELEASE") == "true" diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java b/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java index 4292fa0..c4a52da 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java @@ -90,29 +90,6 @@ public class AnvilRecipeBuilder { return this; } - /** - * Get the xp level cost per craft. (default 0) - * - * @return The xp level cost per craft - * @deprecated use {@link #getLevelCostPerCraft() getLevelCostPerCraft} instead - */ - @Deprecated(since = "1.13.0") - public int getXpCostPerCraft() { - return getLevelCostPerCraft(); - } - - /** - * Sets the xp level cost per craft. - * - * @param xpCostPerCraft The xp level cost per craft - * @return This recipe builder instance. - * @deprecated use {@link #setLevelCostPerCraft(int) setLevelCostPerCraft} instead - */ - @Deprecated(since = "1.13.0") - public AnvilRecipeBuilder setXpCostPerCraft(int xpCostPerCraft) { - return setLevelCostPerCraft(xpCostPerCraft); - } - /** * Get the xp level cost per craft. (default 0) * diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java index 1460766..df0ccfb 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java @@ -387,7 +387,7 @@ public class ConflictBuilder { */ protected void appendEnchantments(@NotNull EnchantConflictGroup conflict) { for (String enchantmentName : getEnchantmentNames()) { - if (appendEnchantments(conflict, EnchantmentApi.getListByName(enchantmentName)) == 0) { + if (appendEnchantments(conflict, EnchantmentApi.getByName(enchantmentName)) == 0) { CustomAnvil.instance.getLogger().warning("Could not find enchantment " + enchantmentName + " for conflict " + getName()); ConflictAPI.logConflictOrigin(this); } diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java index ac98225..c291d7c 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java @@ -131,27 +131,14 @@ public class EnchantmentApi { return CAEnchantment.getByKey(key); } - /** - * Get by name an enchantment. - * - * @param name The name used to fetch - * @return The custom anvil enchantment of this name. null if not found. - * @deprecated use {@link #getListByName(String)} - */ - @Deprecated(since = "1.6.3") - @Nullable - public static CAEnchantment getByName(@NotNull String name){ - return CAEnchantment.getByName(name); - } - /** * Get list of enchantment using the provided name. * * @param name The name used to fetch * @return List of custom anvil enchantments of this name. May be empty if not found. */ - public static List getListByName(@NotNull String name){ - return CAEnchantment.getListByName(name); + public static List getByName(@NotNull String name){ + return CAEnchantment.getByName(name); } /** diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAClickResultBypassEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAClickResultBypassEvent.java index fe5e199..a27c65e 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAClickResultBypassEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAClickResultBypassEvent.java @@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull; * Most of the time you would likely need {@link CAPreAnvilBypassEvent} or {@link CAEarlyPreAnvilBypassEvent} * for this event to be useful. *

- * There is also {@link CATreatAnvilResult2Event} that may be better for some use case. + * There is also {@link CATreatAnvilResultEvent} that may be better for some use case. */ public class CAClickResultBypassEvent extends Event implements Cancellable { diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAEarlyPreAnvilBypassEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAEarlyPreAnvilBypassEvent.java index e92b4cd..2fbd275 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAEarlyPreAnvilBypassEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAEarlyPreAnvilBypassEvent.java @@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull; *

* You should also use {@link CAClickResultBypassEvent} if you want to use this event for something useful. *

- * It is also recommended that you read about {@link CAPreAnvilBypassEvent} and {@link CATreatAnvilResult2Event} + * It is also recommended that you read about {@link CAPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * as your use case may be more prone to use theses. */ public class CAEarlyPreAnvilBypassEvent extends Event implements Cancellable { diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAPreAnvilBypassEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAPreAnvilBypassEvent.java index 9103a4b..18334e3 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAPreAnvilBypassEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CAPreAnvilBypassEvent.java @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull; *

* You should also use {@link CAClickResultBypassEvent} if you want to use this event for something useful. *

- * It is also recommended that you read about {@link CAEarlyPreAnvilBypassEvent} and {@link CATreatAnvilResult2Event} + * It is also recommended that you read about {@link CAEarlyPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * as your use case may be more prone to use theses. */ public class CAPreAnvilBypassEvent extends Event implements Cancellable { diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResult2Event.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResult2Event.java deleted file mode 100644 index 5d534d9..0000000 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResult2Event.java +++ /dev/null @@ -1,191 +0,0 @@ -package xyz.alexcrea.cuanvil.api.event.listener; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.view.AnvilView; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import xyz.alexcrea.cuanvil.anvil.AnvilCost; -import xyz.alexcrea.cuanvil.anvil.AnvilUseType; - -/** - * Called after custom anvil processed the click on the result on the anvil inventory. - * This event should be used to modify the result of an anvil use. - *

- * You may also want to check {@link CAClickResultBypassEvent}, - * {@link CAPreAnvilBypassEvent} - * and {@link CAEarlyPreAnvilBypassEvent} for your use case - *

- * A null result will cancel this event - */ -@SuppressWarnings({"unused", "UnstableApiUsage"}) -public class CATreatAnvilResult2Event extends Event { - - private static final HandlerList HANDLERS = new HandlerList(); - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public @NotNull HandlerList getHandlers() { - return HANDLERS; - } - - @NotNull - private final AnvilView view; - - private final AnvilUseType useType; - - @Nullable - private final ItemStack left; - @Nullable - private final ItemStack right; - - @Nullable - private ItemStack result; - - private final AnvilCost cost; - - public CATreatAnvilResult2Event( - @NotNull AnvilView view, - AnvilUseType useType, - @Nullable ItemStack result, - AnvilCost cost) { - this.view = view; - this.useType = useType; - - this.left = view.getItem(0); - this.right = view.getItem(1); - this.result = result; - this.cost = cost; - } - - /** - * Get the bukkit inventory view. - * - * @return The inventory view of this event. - */ - public @NotNull AnvilView getView() { - return view; - } - - - /** - * Get the type of use source of the result. - * - * @return The craft use type. - */ - public AnvilUseType getUseType() { - return useType; - } - - /** - * Get the left item of the anvil use - * - * @return the left item - */ - public @Nullable ItemStack getLeftItem() { - return left; - } - - /** - * Get the right item of the anvil use - * - * @return the right item - */ - public @Nullable ItemStack getRightItem() { - return right; - } - - /** - * Get the current result - *

- * note that it will not be null unless another listener previously set it to null. - * - * @return The current result. - */ - public @Nullable ItemStack getResult() { - return result; - } - - /** - * Set the current result - *

- * note that a null result will cancel this anvil use. - * - * @param result The new result - */ - public void setResult(@Nullable ItemStack result) { - this.result = result; - } - - /** - * Get the level cost displayed on the anvil. - *

Important note:

- * the final price are re calculated on click for the following use case: - * - * This value will be used as final price for: - *
  • Item merge
  • - *
  • Item rename
  • - * - * - * @return The current cost. - * @deprecated use #{@link #getCost()} instead - */ - @Deprecated(forRemoval = true, since = "1.17.0") - public int getLevelCost() { - return cost.asXpCost(); - } - - /** - * Set the level cost displayed on the anvil. - *

    Important note:

    - * the final price are re calculated on click for the following use case: - * - * This value will be used as final price for: - *
  • Item merge
  • - *
  • Item rename
  • - * - * - * @param levelCost The new cost. - * @deprecated use #{@link #getCost()} and set value on this instead - */ - @Deprecated(forRemoval = true, since = "1.17.0") - public void setLevelCost(int levelCost) { - cost.setGeneric(levelCost - cost.getGeneric() - cost.asXpCost()); - } - - /** - * Allow access to the current cost of the event - * Note that modifying this object will change the event resulting cost - * - *

    Important note:

    - * the final price are re calculated on click for the following use case: - * - * This value will be used as final price for: - *
  • Item merge
  • - *
  • Item rename
  • - * - * @return the current anvil cost - */ - public AnvilCost getCost() { - return cost; - } -} diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResultEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResultEvent.java index 80965b5..703a282 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResultEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/listener/CATreatAnvilResultEvent.java @@ -2,8 +2,8 @@ package xyz.alexcrea.cuanvil.api.event.listener; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.view.AnvilView; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import xyz.alexcrea.cuanvil.anvil.AnvilCost; @@ -17,13 +17,9 @@ import xyz.alexcrea.cuanvil.anvil.AnvilUseType; * {@link CAPreAnvilBypassEvent} * and {@link CAEarlyPreAnvilBypassEvent} for your use case *

    - * A null result will cancel this pre anvil event - * - * @deprecated Prepare anvil Event cannot be provided as it can be called on result and therefore not have prepared anvil event - * use {@link CATreatAnvilResult2Event} instead + * A null result will cancel this event */ -@SuppressWarnings("unused") -@Deprecated(forRemoval = true, since = "1.17.0") +@SuppressWarnings({"unused", "UnstableApiUsage"}) public class CATreatAnvilResultEvent extends Event { private static final HandlerList HANDLERS = new HandlerList(); @@ -38,31 +34,44 @@ public class CATreatAnvilResultEvent extends Event { } @NotNull - private final PrepareAnvilEvent event; + private final AnvilView view; private final AnvilUseType useType; + @Nullable + private final ItemStack left; + @Nullable + private final ItemStack right; + @Nullable private ItemStack result; private final AnvilCost cost; - public CATreatAnvilResultEvent(@NotNull PrepareAnvilEvent event, AnvilUseType useType, @Nullable ItemStack result, AnvilCost cost) { - this.event = event; + public CATreatAnvilResultEvent( + @NotNull AnvilView view, + AnvilUseType useType, + @Nullable ItemStack result, + AnvilCost cost) { + this.view = view; this.useType = useType; + + this.left = view.getItem(0); + this.right = view.getItem(1); this.result = result; this.cost = cost; } /** - * Get the bukkit inventory click event causing to this event. + * Get the bukkit inventory view. * - * @return The click event causing to this event. + * @return The inventory view of this event. */ - public @NotNull PrepareAnvilEvent getEvent() { - return event; + public @NotNull AnvilView getView() { + return view; } + /** * Get the type of use source of the result. * @@ -72,6 +81,24 @@ public class CATreatAnvilResultEvent extends Event { return useType; } + /** + * Get the left item of the anvil use + * + * @return the left item + */ + public @Nullable ItemStack getLeftItem() { + return left; + } + + /** + * Get the right item of the anvil use + * + * @return the right item + */ + public @Nullable ItemStack getRightItem() { + return right; + } + /** * Get the current result *

    @@ -94,50 +121,6 @@ public class CATreatAnvilResultEvent extends Event { this.result = result; } - /** - * Get the level cost displayed on the anvil. - *

    Important note:

    - * the final price are re calculated on click for the following use case: - * - * This value will be used as final price for: - *
  • Item merge
  • - *
  • Item rename
  • - * - * - * @return The current cost. - * @deprecated use #{@link #getCost()} instead - */ - @Deprecated(forRemoval = true, since = "1.17.0") - public int getLevelCost() { - return cost.asXpCost(); - } - - /** - * Set the level cost displayed on the anvil. - *

    Important note:

    - * the final price are re calculated on click for the following use case: - * - * This value will be used as final price for: - *
  • Item merge
  • - *
  • Item rename
  • - * - * - * @param levelCost The new cost. - * @deprecated use #{@link #getCost()} and set value on this instead - */ - @Deprecated(forRemoval = true, since = "1.17.0") - public void setLevelCost(int levelCost) { - cost.setGeneric(levelCost - cost.getGeneric() - cost.asXpCost()); - } - /** * Allow access to the current cost of the event * Note that modifying this object will change the event resulting cost @@ -158,5 +141,4 @@ public class CATreatAnvilResultEvent extends Event { public AnvilCost getCost() { return cost; } - } diff --git a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java index ea657ac..5c747fa 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java +++ b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java @@ -225,25 +225,14 @@ public interface CAEnchantment { return CAEnchantmentRegistry.getInstance().getByKey(key); } - /** - * Gets the enchantment by the provided name. - * @param name Name to fetch. - * @return Registered enchantment. null if absent. - * - * @deprecated use {@link #getListByName(String)} - */ - @Deprecated(since = "1.6.3") - static @Nullable CAEnchantment getByName(@NotNull String name){ - return CAEnchantmentRegistry.getInstance().getByName(name); - } - /** * Gets list of enchantment using the provided name. + * * @param name Name to fetch. * @return List of registered enchantment. */ - static List getListByName(@NotNull String name){ - return CAEnchantmentRegistry.getInstance().getListByName(name); + static List getByName(@NotNull String name){ + return CAEnchantmentRegistry.getInstance().getByName(name); } } diff --git a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java index 854ed55..ec83616 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java +++ b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java @@ -155,22 +155,6 @@ public class CAEnchantmentRegistry { return byKeyMap.get(key); } - /** - * Gets the enchantment by the provided name. - * - * @param name Name to fetch. - * @return Registered enchantment. null if absent. - * @deprecated use {@link #getListByName(String)} - */ - @Deprecated(since = "1.6.3") - @Nullable - public CAEnchantment getByName(@NotNull String name) { - List enchantments = getListByName(name); - if (enchantments.isEmpty()) return null; - - return enchantments.get(0); - } - /** * Gets list of enchantment using the provided name. * @@ -178,7 +162,7 @@ public class CAEnchantmentRegistry { * @return List of registered enchantment. */ @NotNull - public List getListByName(@NotNull String name) { + public List getByName(@NotNull String name) { return byNameMap.getOrDefault(name, Collections.emptyList()); } diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/DependencyManager.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/DependencyManager.kt index 3558bcf..50743d8 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/DependencyManager.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/DependencyManager.kt @@ -10,13 +10,13 @@ import org.bukkit.entity.Player import org.bukkit.event.inventory.InventoryClickEvent import org.bukkit.event.inventory.PrepareAnvilEvent import org.bukkit.inventory.ItemStack -import xyz.alexcrea.cuanvil.anvil.AnvilCost import org.bukkit.inventory.view.AnvilView +import xyz.alexcrea.cuanvil.anvil.AnvilCost import xyz.alexcrea.cuanvil.anvil.AnvilUseType import xyz.alexcrea.cuanvil.api.event.listener.CAClickResultBypassEvent import xyz.alexcrea.cuanvil.api.event.listener.CAEarlyPreAnvilBypassEvent import xyz.alexcrea.cuanvil.api.event.listener.CAPreAnvilBypassEvent -import xyz.alexcrea.cuanvil.api.event.listener.CATreatAnvilResult2Event +import xyz.alexcrea.cuanvil.api.event.listener.CATreatAnvilResultEvent import xyz.alexcrea.cuanvil.config.ConfigHolder import xyz.alexcrea.cuanvil.dependency.datapack.DataPackDependency import xyz.alexcrea.cuanvil.dependency.gui.GenericExternGuiTester @@ -237,7 +237,7 @@ object DependencyManager { useType: AnvilUseType, cost: AnvilCost ): ItemStack? { - val treatEvent = CATreatAnvilResult2Event(view, useType, result, cost) + val treatEvent = CATreatAnvilResultEvent(view, useType, result, cost) try { unsafeTryTreatAnvilResult(treatEvent) return treatEvent.result @@ -247,7 +247,7 @@ object DependencyManager { } } - private fun unsafeTryTreatAnvilResult(event: CATreatAnvilResult2Event) { + private fun unsafeTryTreatAnvilResult(event: CATreatAnvilResultEvent) { Bukkit.getPluginManager().callEvent(event) excellentEnchantsCompatibility?.treatAnvilResult(event) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/economy/VaultEconomyManager.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/economy/VaultEconomyManager.kt index 058485e..23d22b5 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/economy/VaultEconomyManager.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/economy/VaultEconomyManager.kt @@ -1,3 +1,5 @@ +@file:Suppress("DEPRECATION") + package xyz.alexcrea.cuanvil.dependency.economy import net.milkbowl.vault.economy.Economy diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/plugins/ExcellentEnchantsDependency.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/plugins/ExcellentEnchantsDependency.kt index d3d46cc..9370dec 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/plugins/ExcellentEnchantsDependency.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/dependency/plugins/ExcellentEnchantsDependency.kt @@ -8,7 +8,7 @@ import org.bukkit.event.inventory.PrepareAnvilEvent import org.bukkit.inventory.ItemStack import org.bukkit.plugin.RegisteredListener import xyz.alexcrea.cuanvil.api.EnchantmentApi -import xyz.alexcrea.cuanvil.api.event.listener.CATreatAnvilResult2Event +import xyz.alexcrea.cuanvil.api.event.listener.CATreatAnvilResultEvent import xyz.alexcrea.cuanvil.enchant.wrapped.CAEEPreV5Enchantment import xyz.alexcrea.cuanvil.enchant.wrapped.CAEEV5Enchantment import xyz.alexcrea.cuanvil.enchant.wrapped.CAEEV5_4Enchantment @@ -222,7 +222,7 @@ class ExcellentEnchantsDependency { return handleRechargeMethod.invoke(this.usedAnvilListener, event, first, second) as Boolean } - fun treatAnvilResult(event: CATreatAnvilResult2Event) { + fun treatAnvilResult(event: CATreatAnvilResultEvent) { val result = event.result ?: return val first: ItemStack = treatInput(event.leftItem) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt index 61dd1cb..794e4ba 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt @@ -178,7 +178,7 @@ class EnchantConflictManager { } } - return CAEnchantment.getListByName(enchantName) + return CAEnchantment.getByName(enchantName) } diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt index d863981..3dcc1f2 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt @@ -9,8 +9,6 @@ import org.bukkit.GameMode import org.bukkit.NamespacedKey import org.bukkit.entity.HumanEntity import org.bukkit.entity.Player -import org.bukkit.inventory.AnvilInventory -import org.bukkit.inventory.InventoryView import org.bukkit.inventory.ItemStack import org.bukkit.inventory.meta.Repairable import org.bukkit.inventory.view.AnvilView @@ -67,7 +65,6 @@ object AnvilXpUtil { // Try first just in case another plugin, or the test need this view.maximumRepairCost = maximumRepairCost view.repairCost = anvilCost - // TODO for 2.x.x use anvil view & set directly there /* Because Minecraft likes to have the final say in the repair cost displayed * we need to wait for the event to end before overriding it, this ensures that diff --git a/src/test/java/xyz/alexcrea/cuanvil/util/AnvilFuseTestUtil.java b/src/test/java/xyz/alexcrea/cuanvil/util/AnvilFuseTestUtil.java index 6f5c7bb..9fb7290 100644 --- a/src/test/java/xyz/alexcrea/cuanvil/util/AnvilFuseTestUtil.java +++ b/src/test/java/xyz/alexcrea/cuanvil/util/AnvilFuseTestUtil.java @@ -70,7 +70,7 @@ public class AnvilFuseTestUtil { List enchantments = new ArrayList<>(); for (String enchantmentName : enchantmentNames) { - List enchantmentList = CAEnchantment.getListByName(enchantmentName); + List enchantmentList = CAEnchantment.getByName(enchantmentName); Assertions.assertNotEquals(0, enchantmentList.size(), "Could not find enchantment \"" + enchantmentName + "\"");