From 4c0c7a8c3b4c479ca8f536a9943369b3f4628697 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Thu, 10 Jul 2025 16:26:58 +0200 Subject: [PATCH] Revert "add flags for the api" This reverts commit cea6d5147062a97d83a0ee4d2f8570a8ca2d82da. Did not liked the idea after some thinking --- .../cuanvil/api/AnvilRecipeBuilder.java | 68 -------------- .../xyz/alexcrea/cuanvil/api/ConflictAPI.java | 30 ------ .../alexcrea/cuanvil/api/ConflictBuilder.java | 93 ------------------- .../cuanvil/api/CustomAnvilRecipeApi.java | 19 ---- .../alexcrea/cuanvil/api/EnchantmentApi.java | 49 ---------- .../cuanvil/api/MaterialGroupApi.java | 30 ------ .../alexcrea/cuanvil/api/UnitRepairApi.java | 72 +++++--------- .../alexcrea/cuanvil/api/data/CAApiFlags.java | 42 --------- .../cuanvil/api/event/CAConfigReadyEvent.java | 3 - .../event/CAEnchantRegistryReadyEvent.java | 3 - .../listener/CAClickResultBypassEvent.java | 3 - .../listener/CAEarlyPreAnvilBypassEvent.java | 5 - .../event/listener/CAPreAnvilBypassEvent.java | 3 - .../listener/CATreatAnvilResultEvent.java | 20 ---- 14 files changed, 23 insertions(+), 417 deletions(-) delete mode 100644 src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java b/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java index ee7e50c..4292fa0 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/AnvilRecipeBuilder.java @@ -7,9 +7,6 @@ import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe; /** * A Builder for custom craft using anvil. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} */ @SuppressWarnings("unused") public class AnvilRecipeBuilder { @@ -30,9 +27,6 @@ public class AnvilRecipeBuilder { * Instantiates a new Anvil recipe builder. * exact count default to true. * xp level and linear cost per craft default to 0. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param name The recipe name */ @@ -51,9 +45,6 @@ public class AnvilRecipeBuilder { /** * Gets the recipe name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return This recipe builder instance. */ @@ -64,9 +55,6 @@ public class AnvilRecipeBuilder { /** * Sets the recipe name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param name The recipe name * @return This recipe builder instance. @@ -81,9 +69,6 @@ public class AnvilRecipeBuilder { *

* Exact count mean the recipe can only be crafted 1 by 1. * If set to false, then it will craft as much as possible in 1 go and will keep unused material onto the anvil inventory. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return If the recipe is exact count. */ @@ -96,9 +81,6 @@ public class AnvilRecipeBuilder { *

* Exact count mean the recipe can only be crafted 1 by 1. * If set to false, then it will craft as much as possible in 1 go and will keep unused material onto the anvil inventory. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param exactCount If the recipe is exact count * @return This recipe builder instance. @@ -110,9 +92,6 @@ public class AnvilRecipeBuilder { /** * Get the xp level cost per craft. (default 0) - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The xp level cost per craft * @deprecated use {@link #getLevelCostPerCraft() getLevelCostPerCraft} instead @@ -124,9 +103,6 @@ public class AnvilRecipeBuilder { /** * Sets the xp level cost per craft. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param xpCostPerCraft The xp level cost per craft * @return This recipe builder instance. @@ -139,9 +115,6 @@ public class AnvilRecipeBuilder { /** * Get the xp level cost per craft. (default 0) - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The xp level cost per craft */ @@ -151,9 +124,6 @@ public class AnvilRecipeBuilder { /** * Sets the xp level cost per craft. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param levelCostPerCraft The xp level cost per craft * @return This recipe builder instance. @@ -165,9 +135,6 @@ public class AnvilRecipeBuilder { /** * Get the linear xp cost (not xp level cost) per craft. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The xp level cost per craft */ @@ -177,9 +144,6 @@ public class AnvilRecipeBuilder { /** * Sets the linear xp cost (not xp level cost) per craft. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param linearXpCostPerCraft The linear xp cost per craft * @return This recipe builder instance. @@ -196,10 +160,6 @@ public class AnvilRecipeBuilder { * If true will require the level that has at least the specified level of xp then on click remove only the necessary xp *

* linear xp cost are applied after level cost - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} - * * @return if we should remove the exact amount of linear xp */ public boolean isRemoveExactLinearXp() { @@ -214,10 +174,6 @@ public class AnvilRecipeBuilder { *

* linear xp cost are applied after level cost * @param removeExactLinearXp if we should remove the exact amount of linear xp - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} - * * @return This recipe builder instance. */ public AnvilRecipeBuilder setRemoveExactLinearXp(boolean removeExactLinearXp) { @@ -228,9 +184,6 @@ public class AnvilRecipeBuilder { /** * Get the left item of the recipe. * If null (default) then the recipe will not be able to be registered. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The left item */ @@ -242,9 +195,6 @@ public class AnvilRecipeBuilder { /** * Set the left item. * If null (default) then the recipe will not be able to be registered. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param leftItem the left item * @return This recipe builder instance. @@ -257,9 +207,6 @@ public class AnvilRecipeBuilder { /** * Get the recipe right item. * null on default new instance. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The right item */ @@ -271,9 +218,6 @@ public class AnvilRecipeBuilder { /** * Set the recipe right item. * null on default new instance. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param rightItem the right item * @return This recipe builder instance. @@ -286,9 +230,6 @@ public class AnvilRecipeBuilder { /** * Get the recipe result item. * If null (default) then the recipe will not be able to be registered. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return The result item */ @@ -300,9 +241,6 @@ public class AnvilRecipeBuilder { /** * Set the recipe result item. * If null (default) then the recipe will not be able to be registered. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param resultItem The result item * @return This recipe builder instance. @@ -315,9 +253,6 @@ public class AnvilRecipeBuilder { /** * Build the anvil custom recipe. * Should probably use {@link #registerIfAbsent() registerIfAbsent} or {@link ConflictAPI#addConflict(ConflictBuilder) addConflict}. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return A new anvil custom recipe base on this builder. */ @@ -338,9 +273,6 @@ public class AnvilRecipeBuilder { /** * Register this recipe if absent. * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder)} - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @return True if successful. */ diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java index acf8d01..fe2715e 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java @@ -15,9 +15,6 @@ import java.util.List; /** * Custom Anvil api for conflict registry. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} */ @SuppressWarnings("unused") public class ConflictAPI { @@ -32,9 +29,6 @@ public class ConflictAPI { * Write and add a conflict. * Will not write the conflict if it already exists. * Will not be successful if the conflict is empty. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param builder The conflict builder to be based on * @return True if successful. @@ -47,9 +41,6 @@ public class ConflictAPI { * Write and add a conflict. * Will not write the conflict if it already exists. * Will not be successful if the conflict is empty. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param builder The conflict builder to be based on * @param overrideDeleted If we should write even if the conflict was previously deleted. @@ -79,9 +70,6 @@ public class ConflictAPI { * Write a conflict to the config file and plan an update of conflicts. *

* You may want to use {@link #addConflict(ConflictBuilder)} instead as it is more performance in most case as this function will reload every conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param builder the builder * @return true if was written successfully. @@ -94,9 +82,6 @@ public class ConflictAPI { * Write a conflict to the config file. *

* You should use {@link #addConflict(ConflictBuilder)} or {@link #writeConflict(ConflictBuilder)} instead - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param builder The builder * @param updatePlanned If we should plan a global update for conflicts @@ -131,9 +116,6 @@ public class ConflictAPI { /** * Extract every enchantment names from a builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param builder The builder storing the enchantments * @return Builder's stored enchantment. @@ -150,9 +132,6 @@ public class ConflictAPI { /** * Remove a conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param conflict The conflict to remove * @return True if successful. @@ -174,9 +153,6 @@ public class ConflictAPI { /** * Prepare a task to save conflict configuration. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} */ private static void prepareSaveTask() { if (saveChangeTask != null) return; @@ -189,9 +165,6 @@ public class ConflictAPI { /** * Prepare a task to reload every conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} */ private static void prepareUpdateTask() { if (reloadChangeTask != null) return; @@ -211,9 +184,6 @@ public class ConflictAPI { /** * Get every registered conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return An immutable collection of conflict. */ diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java index c77ad39..f662140 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java @@ -15,9 +15,6 @@ import java.util.Set; /** * A Builder for material conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} */ @SuppressWarnings("unused") public class ConflictBuilder { @@ -34,9 +31,6 @@ public class ConflictBuilder { /** * Instantiates a new Conflict builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param name The conflict name * @param maxBeforeConflict Maximum number of conflicting enchantment before conflict is active @@ -56,9 +50,6 @@ public class ConflictBuilder { /** * Instantiates a new Conflict builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param name The conflict name * @param source The conflict source @@ -69,9 +60,6 @@ public class ConflictBuilder { /** * Instantiates a new Conflict builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param name The conflict name */ @@ -81,9 +69,6 @@ public class ConflictBuilder { /** * Gets conflict source. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The conflict source. */ @@ -94,9 +79,6 @@ public class ConflictBuilder { /** * Gets conflict source name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The conflict source name. */ @@ -109,9 +91,6 @@ public class ConflictBuilder { /** * Gets conflict name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The conflict name. */ @@ -122,9 +101,6 @@ public class ConflictBuilder { /** * Gets stored conflicting enchantment names. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The stored enchantment names. */ @@ -135,9 +111,6 @@ public class ConflictBuilder { /** * Gets stored conflicting enchantment keys. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The stored enchantment keys. */ @@ -148,9 +121,6 @@ public class ConflictBuilder { /** * Gets stored excluded group names. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The stored group names. */ @@ -166,9 +136,6 @@ public class ConflictBuilder { * That mean new enchantment will not be able to be added to the item and present enchantment will not have its level upgraded. *

* In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return the max number of conflicting enchantment before conflict. 0 by default. */ @@ -178,9 +145,6 @@ public class ConflictBuilder { /** * Sets conflict name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param name The name * @return This conflict builder instance. @@ -197,9 +161,6 @@ public class ConflictBuilder { * That mean new enchantment will not be able to be added to the item and present enchantment will not have its level upgraded. *

* In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param maxBeforeConflict The max before conflict * @return This conflict builder instance. @@ -211,9 +172,6 @@ public class ConflictBuilder { /** * Add a conflicting enchantment by name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantmentName The enchantment name * @return This conflict builder instance. @@ -226,9 +184,6 @@ public class ConflictBuilder { /** * Add a conflicting enchantment by key. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantmentKey The enchantment key * @return This conflict builder instance. @@ -241,9 +196,6 @@ public class ConflictBuilder { /** * Add a conflicting enchantment by instance. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantment The enchantment * @return This conflict builder instance. @@ -256,9 +208,6 @@ public class ConflictBuilder { /** * Remove conflicting enchantment by name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantmentName The enchantment name * @return This conflict builder instance. @@ -271,9 +220,6 @@ public class ConflictBuilder { /** * Remove conflicting enchantment by key. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantmentKey The enchantment key * @return This conflict builder instance. @@ -286,9 +232,6 @@ public class ConflictBuilder { /** * Remove enchantment by instance. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param enchantment The enchantment * @return This conflict builder instance. @@ -308,9 +251,6 @@ public class ConflictBuilder { * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * Then only pickaxe will be able to have efficiency. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param groupName The group name * @return This conflict builder instance. @@ -331,9 +271,6 @@ public class ConflictBuilder { * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * Then only pickaxe will be able to have efficiency. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param group The group * @return this conflict builder instance. @@ -353,9 +290,6 @@ public class ConflictBuilder { * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * Then only pickaxe will be able to have efficiency. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param groupName The group name * @return This conflict builder instance. @@ -376,9 +310,6 @@ public class ConflictBuilder { * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * Then only pickaxe will be able to have efficiency. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param group The group * @return This conflict builder instance. @@ -390,9 +321,6 @@ public class ConflictBuilder { /** * Copy this conflict builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return A copy of this conflict builder. */ @@ -420,9 +348,6 @@ public class ConflictBuilder { /** * Build a new Enchant conflict group by this builder. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return An Enchant conflict group with this builder parameters. */ @@ -437,9 +362,6 @@ public class ConflictBuilder { /** * Register this conflict if not yet registered. * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder, boolean) ConflictAPI.addConflict(this, true)}} - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return True if successful. */ @@ -450,9 +372,6 @@ public class ConflictBuilder { /** * Register this conflict if not yet registered or deleted. * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder) ConflictAPI.addConflict(this)} - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return True if successful. */ @@ -462,9 +381,6 @@ public class ConflictBuilder { /** * Append builders stored enchantments into conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param conflict The conflict target */ @@ -485,9 +401,6 @@ public class ConflictBuilder { /** * Append an enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param conflict The conflict target * @param enchantment The enchantment @@ -502,9 +415,6 @@ public class ConflictBuilder { /** * Append a list of enchantments. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @param conflict The conflict target * @param enchantments List of enchantment to add @@ -523,9 +433,6 @@ public class ConflictBuilder { /** * Extract group abstract material group. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1} * * @return The abstract material group from the builder. */ diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/CustomAnvilRecipeApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/CustomAnvilRecipeApi.java index b923888..8f80aa3 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/CustomAnvilRecipeApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/CustomAnvilRecipeApi.java @@ -13,9 +13,6 @@ import java.util.List; /** * Custom Anvil api for custom anvil recipes. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} */ @SuppressWarnings("unused") public class CustomAnvilRecipeApi { @@ -27,9 +24,6 @@ public class CustomAnvilRecipeApi { /** * Write and add a custom anvil recipe. * Will not write the recipe if it already exists. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param builder The recipe builder to be based on * @return True if successful. @@ -41,9 +35,6 @@ public class CustomAnvilRecipeApi { /** * Write and add a custom anvil recipe. * Will not write the recipe if it already exists. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param builder The recipe builder to be based on * @param overrideDeleted If we should write even if the recipe was previously deleted. @@ -90,9 +81,6 @@ public class CustomAnvilRecipeApi { // TODO remove by name and/or by builder (as name is keept) (and maybe create a get by name) /** * Remove a custom anvil recipe. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} * * @param recipe The recipe to remove * @return True if successful. @@ -115,9 +103,6 @@ public class CustomAnvilRecipeApi { /** * Prepare a task to save custom recipe configuration. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} */ private static void prepareSaveTask() { if(saveChangeTask != null) return; @@ -130,10 +115,6 @@ public class CustomAnvilRecipeApi { /** * Get every registered recipes. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1} - * * @return An immutable collection of recipes. */ @NotNull diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java index d87bc2a..76f1ac2 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java @@ -23,9 +23,6 @@ import java.util.Map; /** * Custom Anvil api for enchantment registry. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} */ @SuppressWarnings("unused") public class EnchantmentApi { @@ -36,9 +33,6 @@ public class EnchantmentApi { /** * Register an enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param enchantment The enchantment to register * @return True if successful. @@ -62,9 +56,6 @@ public class EnchantmentApi { /** * Register an enchantment by minecraft registered enchantment instance. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param enchantment The enchantment to register * @param defaultRarity The default rarity of the provided enchantment @@ -81,9 +72,6 @@ public class EnchantmentApi { * Register an enchantment by minecraft registered enchantment instance. *

* Please note that this function assume the provided enchantment is registered into minecraft registry. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param enchantment The enchantment to register * @return True if successful. @@ -94,9 +82,6 @@ public class EnchantmentApi { /** * Unregister an enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param enchantment The enchantment to unregister * @return True if successful. @@ -115,9 +100,6 @@ public class EnchantmentApi { /** * Unregister an enchantment by its key. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param key The enchantment key to unregister * @return True if successful. @@ -129,9 +111,6 @@ public class EnchantmentApi { /** * Unregister an enchantment by his bukkit enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param enchantment The enchantment to unregister * @return True if successful. @@ -142,9 +121,6 @@ public class EnchantmentApi { /** * Get by key an enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param key The key used to fetch * @return The custom anvil enchantment of this key. null if not found. @@ -156,9 +132,6 @@ public class EnchantmentApi { /** * Get by name an enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param name The name used to fetch * @return The custom anvil enchantment of this name. null if not found. @@ -172,9 +145,6 @@ public class EnchantmentApi { /** * Get list of enchantment using the provided name. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} * * @param name The name used to fetch * @return List of custom anvil enchantments of this name. May be empty if not found. @@ -185,10 +155,6 @@ public class EnchantmentApi { /** * Get every registered custom anvil enchantments. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} - * @return An immutable map of enchantment key as map key and custom anvil enchantment as value. */ @NotNull @@ -198,10 +164,6 @@ public class EnchantmentApi { /** * Write the default level and rarity configuration of the enchantment. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} - * * @param enchantment The enchantment to write default configuration * @param override If it should override old configuration * @return Return false if override is false and a configuration exist. true otherwise. @@ -243,9 +205,6 @@ public class EnchantmentApi { /** * Prepare a task to save custom recipe configuration. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} */ private static void prepareSaveTask() { if(saveChangeTask != null) return; @@ -258,10 +217,6 @@ public class EnchantmentApi { /** * Add a bulk get operator. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} - * * @param operation An optimised get enchantments operation */ public static void addBulkGet(@NotNull BulkGetEnchantOperation operation){ @@ -270,10 +225,6 @@ public class EnchantmentApi { /** * Add a bulk clean operator. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1} - * * @param operation An optimised clean enchantments operation */ public static void addBulkClean(@NotNull BulkCleanEnchantOperation operation){ diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/MaterialGroupApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/MaterialGroupApi.java index 7474174..48dd500 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/MaterialGroupApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/MaterialGroupApi.java @@ -18,9 +18,6 @@ import java.util.*; /** * Custom Anvil api for material group registry. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} */ @SuppressWarnings("unused") public class MaterialGroupApi { @@ -35,9 +32,6 @@ public class MaterialGroupApi { * Write and add a group. * Will not write the group if it already exists. * Will not be successful if the group is empty. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param group The group to add * @return true if successful. @@ -50,9 +44,6 @@ public class MaterialGroupApi { * Write and add a group. * Will not write the group if it already exists. * Will not be successful if the group is empty. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param group The group to add * @param overrideDeleted If we should write even if the group was previously deleted. @@ -86,9 +77,6 @@ public class MaterialGroupApi { * Write a material group to the config file and plan an update of groups. *

* You may want to use {@link #addMaterialGroup(AbstractMaterialGroup)} instead as it is more performance in most case as this function will reload every conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param group the group to write * @return true if was written successfully. @@ -101,9 +89,6 @@ public class MaterialGroupApi { * Write a material group to the config file. *

* You should use {@link #addMaterialGroup(AbstractMaterialGroup)} or {@link #writeMaterialGroup(AbstractMaterialGroup)} instead - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param group the group to write * @param updatePlanned if we should plan a global update for material groups @@ -190,9 +175,6 @@ public class MaterialGroupApi { * Remove a material group. * Caution ! It will not be removed from depending conflict or other material group at runtime. * For that reason, it is not recommended to use this function. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param group The recipe to remove * @return True if the group was present. @@ -217,9 +199,6 @@ public class MaterialGroupApi { /** * Prepare a task to reload every conflict. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} */ private static void prepareSaveTask() { if (saveChangeTask != null) return; @@ -232,9 +211,6 @@ public class MaterialGroupApi { /** * Prepare a task to save configuration. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} */ private static void prepareUpdateTask() { if (reloadChangeTask != null) return; @@ -252,9 +228,6 @@ public class MaterialGroupApi { /** * Get by name a group. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @param groupName the group name used to fetch * @return the abstract group of this name. null if not found. @@ -266,9 +239,6 @@ public class MaterialGroupApi { /** * Get every registered material groups. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1} * * @return An immutable map of group name as its key and group as mapped value. */ diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/UnitRepairApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/UnitRepairApi.java index 14d87bf..bc50c16 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/UnitRepairApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/UnitRepairApi.java @@ -18,15 +18,11 @@ import java.util.List; /** * Custom Anvil api for unit repair. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} */ @SuppressWarnings("unused") public class UnitRepairApi { - private UnitRepairApi() { - } + private UnitRepairApi(){} private static Object saveChangeTask = null; @@ -34,40 +30,31 @@ public class UnitRepairApi { * Write and add a custom anvil unit repair recipe. * Will not write the recipe if it already exists or was deleted. * Set the value to minecraft default value (0.25 = 25%) - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} * * @param unit The unit material used to repair the bellow item. * @param repairable The item to be repaired. * @return true if successful. */ - public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable) { + public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable){ return addUnitRepair(unit, repairable, 0.25, false); } /** * Write and add a custom anvil unit repair recipe. * Will not write the recipe if it already exists or was deleted. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} * * @param unit The unit material used to repair the bellow item. * @param repairable The item to be repaired. * @param value The amount to be repaired by every unit. (1% = 0.01) * @return true if successful. */ - public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value) { + public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value){ return addUnitRepair(unit, repairable, value, false); } /** * Write and add a custom anvil unit repair recipe. * Will not write the recipe if it already exists. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} * * @param unit The unit material used to repair the bellow item. * @param repairable The item to be repaired. @@ -75,12 +62,12 @@ public class UnitRepairApi { * @param overrideDeleted If we should write even if the recipe was previously deleted. * @return true if successful. */ - public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value, boolean overrideDeleted) { + public static boolean addUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value, boolean overrideDeleted){ FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig(); String path = unit.name().toLowerCase() + "." + repairable.name().toLowerCase(); - if (!overrideDeleted && ConfigHolder.UNIT_REPAIR_HOLDER.isDeleted(path)) return false; - if (config.contains(path)) return false; + if(!overrideDeleted && ConfigHolder.UNIT_REPAIR_HOLDER.isDeleted(path)) return false; + if(config.contains(path)) return false; // Set unit repair return setUnitRepair(unit, repairable, value); @@ -89,16 +76,13 @@ public class UnitRepairApi { /** * Write and add a custom anvil unit repair recipe. * Do not check if it previously existed or exist. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} * * @param unit The unit material used to repair the bellow item. * @param repairable The item to be repaired. * @param value The amount to be repaired by every unit. (1% = 0.01) * @return true if successful. */ - public static boolean setUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value) { + public static boolean setUnitRepair(@NotNull Material unit, @NotNull Material repairable, double value){ FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig(); String repairableName = repairable.name().toLowerCase(); @@ -110,10 +94,10 @@ public class UnitRepairApi { // Add to gui UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance(); - if (repairConfigGui != null) { + if(repairConfigGui != null) { UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored(); - if (elementGui != null) elementGui.updateValueForGeneric(repairableName, true); + if(elementGui != null) elementGui.updateValueForGeneric(repairableName, true); repairConfigGui.updateValueForGeneric(unit, true); } @@ -122,15 +106,12 @@ public class UnitRepairApi { /** * Remove a custom anvil unit repair recipe. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} * * @param unit The unit material used to repair the bellow item. * @param repairable The item used to be repaired. * @return true if successful. */ - public static boolean removeUnitRepair(@NotNull Material unit, @NotNull Material repairable) { + public static boolean removeUnitRepair(@NotNull Material unit, @NotNull Material repairable){ // Delete every possible variation and save to file String unitName = unit.name(); String repairableName = repairable.name(); @@ -143,17 +124,17 @@ public class UnitRepairApi { // Test if it was the last value of this section boolean lastValue = false; - if (config.isConfigurationSection(unitName.toLowerCase())) { + if(config.isConfigurationSection(unitName.toLowerCase())) { ConfigurationSection section = config.getConfigurationSection(unitName.toLowerCase()); - if (section != null && section.getKeys(false).isEmpty()) { + if(section != null && section.getKeys(false).isEmpty()) { lastValue = true; config.set(unitName.toLowerCase(), null); } } else if (config.isConfigurationSection(unitName.toUpperCase())) { ConfigurationSection section = config.getConfigurationSection(unitName.toUpperCase()); - if (section != null && section.getKeys(false).isEmpty()) { + if(section != null && section.getKeys(false).isEmpty()) { lastValue = true; config.set(unitName.toUpperCase(), null); } @@ -167,11 +148,11 @@ public class UnitRepairApi { // Remove from gui UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance(); - if (repairConfigGui != null) { + if(repairConfigGui != null) { UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored(); - if (elementGui != null) elementGui.removeGeneric(repairableName); - if (lastValue) { + if(elementGui != null) elementGui.removeGeneric(repairableName); + if(lastValue){ repairConfigGui.removeGeneric(unit); } } @@ -181,14 +162,11 @@ public class UnitRepairApi { /** * Prepare a task to save custom unit repair recipe configuration. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} */ private static void prepareSaveTask() { - if (saveChangeTask != null) return; + if(saveChangeTask != null) return; - saveChangeTask = DependencyManager.scheduler.scheduleGlobally(CustomAnvil.instance, () -> { + saveChangeTask = DependencyManager.scheduler.scheduleGlobally(CustomAnvil.instance, ()->{ ConfigHolder.UNIT_REPAIR_HOLDER.saveToDisk(true); saveChangeTask = null; }); @@ -196,10 +174,6 @@ public class UnitRepairApi { /** * Get every unit repair recipes. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1} - * * @return An immutable collection of unit repair recipes. *

* Each element of the provided triple represent a part of the recipe @@ -210,27 +184,27 @@ public class UnitRepairApi { * */ @NotNull - public static List> getUnitRepairs() { + public static List> getUnitRepairs(){ List> mutableList = new ArrayList<>(); FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig(); for (String unitKey : config.getKeys(false)) { // Test if config section exist - if (!config.isConfigurationSection(unitKey)) continue; + if(!config.isConfigurationSection(unitKey)) continue; // Test if unit is a material Material unit = Material.getMaterial(unitKey.toUpperCase()); - if (unit == null) continue; + if(unit == null) continue; // Iterate over reparable items ConfigurationSection section = config.getConfigurationSection(unitKey); for (String repairableKey : section.getKeys(false)) { // Test if value section exist - if (!section.isDouble(repairableKey)) continue; + if(!section.isDouble(repairableKey)) continue; // Test if repairable is valid a material Material repairable = Material.getMaterial(repairableKey.toUpperCase()); - if (repairable == null) continue; + if(repairable == null) continue; // Add the values mutableList.add(new Triple<>(unit, repairable, section.getDouble(repairableKey))); diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java b/src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java deleted file mode 100644 index c8d6e3a..0000000 --- a/src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java +++ /dev/null @@ -1,42 +0,0 @@ -package xyz.alexcrea.cuanvil.api.data; - -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; -import java.util.Set; - -public enum CAApiFlags { - - ENCHANTMENT_REGISTER_V1, - ENCHANTMENT_CONFLICT_V1, - CUSTOM_RECIPE_V1, - UNIT_REPAIR_V1, - - MATERIAL_GROUP_V1, - - CONFIG_EVENTS_V1, - LISTENER_EVENTS_V1, - ; - - private static final Set CURRENT_FLAGS = EnumSet.of( - ENCHANTMENT_REGISTER_V1, - ENCHANTMENT_CONFLICT_V1, - CUSTOM_RECIPE_V1, - UNIT_REPAIR_V1, - - MATERIAL_GROUP_V1, - - CONFIG_EVENTS_V1, - LISTENER_EVENTS_V1 - ); - - public static Set getCurrentFlags() { - return Collections.unmodifiableSet(CURRENT_FLAGS); - } - - public boolean hasFlags(CAApiFlags... flag) { - return CURRENT_FLAGS.containsAll(List.of(flag)); - } - - -} diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/CAConfigReadyEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/CAConfigReadyEvent.java index d2fd770..67d27a8 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/CAConfigReadyEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/CAConfigReadyEvent.java @@ -19,9 +19,6 @@ import org.bukkit.event.HandlerList; * {@link xyz.alexcrea.cuanvil.api.MaterialGroupApi MaterialGroupApi} * and {@link xyz.alexcrea.cuanvil.api.UnitRepairApi UnitRepairApi} * to add/remove/edit configurations - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CONFIG_EVENTS_V1 CONFIG_EVENTS_V1} */ public class CAConfigReadyEvent extends Event { diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/event/CAEnchantRegistryReadyEvent.java b/src/main/java/xyz/alexcrea/cuanvil/api/event/CAEnchantRegistryReadyEvent.java index 9f4507c..3ffe372 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/event/CAEnchantRegistryReadyEvent.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/event/CAEnchantRegistryReadyEvent.java @@ -13,9 +13,6 @@ import org.bukkit.event.HandlerList; * (after configuration loading phase. see {@link CAConfigReadyEvent}) *

* use {@link xyz.alexcrea.cuanvil.api.EnchantmentApi EnchantmentApi} to register and unregister your custom enchantments - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CONFIG_EVENTS_V1 CONFIG_EVENTS_V1} */ public class CAEnchantRegistryReadyEvent extends Event { 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 f81f08e..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 @@ -18,9 +18,6 @@ import org.jetbrains.annotations.NotNull; * for this event to be useful. *

* There is also {@link CATreatAnvilResultEvent} that may be better for some use case. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} */ 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 50831b1..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 @@ -17,8 +17,6 @@ import org.jetbrains.annotations.NotNull; *

* It is also recommended that you read about {@link CAPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * as your use case may be more prone to use theses. - *

- * This is part of {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} */ public class CAEarlyPreAnvilBypassEvent extends Event implements Cancellable { @@ -50,9 +48,6 @@ public class CAEarlyPreAnvilBypassEvent extends Event implements Cancellable { /** * Get the bukkit pre anvil event causing this event - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @return The pre anvil event causing to this event */ 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 521e7b8..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 @@ -20,9 +20,6 @@ import org.jetbrains.annotations.NotNull; *

* It is also recommended that you read about {@link CAEarlyPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * as your use case may be more prone to use theses. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} */ public class CAPreAnvilBypassEvent extends Event implements Cancellable { 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 dce0727..1675d1a 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 @@ -17,8 +17,6 @@ import xyz.alexcrea.cuanvil.util.AnvilUseType; * and {@link CAEarlyPreAnvilBypassEvent} for your use case *

* A null result will cancel this pre anvil event - *

- * This is part of {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} */ @SuppressWarnings("unused") public class CATreatAnvilResultEvent extends Event { @@ -53,9 +51,6 @@ public class CATreatAnvilResultEvent extends Event { /** * Get the bukkit inventory click event causing to this event. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @return The click event causing to this event. */ @@ -65,9 +60,6 @@ public class CATreatAnvilResultEvent extends Event { /** * Get the type of use source of the result. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @return The craft use type. */ @@ -79,9 +71,6 @@ public class CATreatAnvilResultEvent extends Event { * Get the current result *

* note that it will not be null unless another listener previously set it to null. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @return The current result. */ @@ -93,9 +82,6 @@ public class CATreatAnvilResultEvent extends Event { * Set the current result *

* note that a null result will cancel this anvil use. - *

- * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @param result The new result */ @@ -116,9 +102,6 @@ public class CATreatAnvilResultEvent extends Event { *

  • Item merge
  • *
  • Item rename
  • * - *

    - * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @return The current cost. */ @@ -139,9 +122,6 @@ public class CATreatAnvilResultEvent extends Event { *

  • Item merge
  • *
  • Item rename
  • * - *

    - * This is part of - * {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1} * * @param levelCost The new cost. */