Revert "add flags for the api"

This reverts commit cea6d51470.

Did not liked the idea after some thinking
This commit is contained in:
alexcrea 2025-07-10 16:26:58 +02:00
parent cea6d51470
commit 4c0c7a8c3b
Signed by: alexcrea
GPG key ID: E346CD16413450E3
14 changed files with 23 additions and 417 deletions

View file

@ -7,9 +7,6 @@ import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
/** /**
* A Builder for custom craft using anvil. * A Builder for custom craft using anvil.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class AnvilRecipeBuilder { public class AnvilRecipeBuilder {
@ -30,9 +27,6 @@ public class AnvilRecipeBuilder {
* Instantiates a new Anvil recipe builder. * Instantiates a new Anvil recipe builder.
* exact count default to true. * exact count default to true.
* xp level and linear cost per craft default to 0. * xp level and linear cost per craft default to 0.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param name The recipe name * @param name The recipe name
*/ */
@ -51,9 +45,6 @@ public class AnvilRecipeBuilder {
/** /**
* Gets the recipe name. * Gets the recipe name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return This recipe builder instance. * @return This recipe builder instance.
*/ */
@ -64,9 +55,6 @@ public class AnvilRecipeBuilder {
/** /**
* Sets the recipe name. * Sets the recipe name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param name The recipe name * @param name The recipe name
* @return This recipe builder instance. * @return This recipe builder instance.
@ -81,9 +69,6 @@ public class AnvilRecipeBuilder {
* <p> * <p>
* Exact count mean the recipe can only be crafted 1 by 1. * 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. * If set to false, then it will craft as much as possible in 1 go and will keep unused material onto the anvil inventory.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return If the recipe is exact count. * @return If the recipe is exact count.
*/ */
@ -96,9 +81,6 @@ public class AnvilRecipeBuilder {
* <p> * <p>
* Exact count mean the recipe can only be crafted 1 by 1. * 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. * If set to false, then it will craft as much as possible in 1 go and will keep unused material onto the anvil inventory.
* <p>
* 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 * @param exactCount If the recipe is exact count
* @return This recipe builder instance. * @return This recipe builder instance.
@ -110,9 +92,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the xp level cost per craft. (default 0) * Get the xp level cost per craft. (default 0)
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The xp level cost per craft * @return The xp level cost per craft
* @deprecated use {@link #getLevelCostPerCraft() getLevelCostPerCraft} instead * @deprecated use {@link #getLevelCostPerCraft() getLevelCostPerCraft} instead
@ -124,9 +103,6 @@ public class AnvilRecipeBuilder {
/** /**
* Sets the xp level cost per craft. * Sets the xp level cost per craft.
* <p>
* 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 * @param xpCostPerCraft The xp level cost per craft
* @return This recipe builder instance. * @return This recipe builder instance.
@ -139,9 +115,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the xp level cost per craft. (default 0) * Get the xp level cost per craft. (default 0)
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The xp level cost per craft * @return The xp level cost per craft
*/ */
@ -151,9 +124,6 @@ public class AnvilRecipeBuilder {
/** /**
* Sets the xp level cost per craft. * Sets the xp level cost per craft.
* <p>
* 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 * @param levelCostPerCraft The xp level cost per craft
* @return This recipe builder instance. * @return This recipe builder instance.
@ -165,9 +135,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the linear xp cost (not xp level cost) per craft. * Get the linear xp cost (not xp level cost) per craft.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The xp level cost per craft * @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. * Sets the linear xp cost (not xp level cost) per craft.
* <p>
* 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 * @param linearXpCostPerCraft The linear xp cost per craft
* @return This recipe builder instance. * @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 * If true will require the level that has at least the specified level of xp then on click remove only the necessary xp
* <p> * <p>
* linear xp cost are applied after level cost * linear xp cost are applied after level cost
* <p>
* 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 * @return if we should remove the exact amount of linear xp
*/ */
public boolean isRemoveExactLinearXp() { public boolean isRemoveExactLinearXp() {
@ -214,10 +174,6 @@ public class AnvilRecipeBuilder {
* <p> * <p>
* linear xp cost are applied after level cost * linear xp cost are applied after level cost
* @param removeExactLinearXp if we should remove the exact amount of linear xp * @param removeExactLinearXp if we should remove the exact amount of linear xp
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
*
* @return This recipe builder instance. * @return This recipe builder instance.
*/ */
public AnvilRecipeBuilder setRemoveExactLinearXp(boolean removeExactLinearXp) { public AnvilRecipeBuilder setRemoveExactLinearXp(boolean removeExactLinearXp) {
@ -228,9 +184,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the left item of the recipe. * Get the left item of the recipe.
* If null (default) then the recipe will not be able to be registered. * If null (default) then the recipe will not be able to be registered.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The left item * @return The left item
*/ */
@ -242,9 +195,6 @@ public class AnvilRecipeBuilder {
/** /**
* Set the left item. * Set the left item.
* If null (default) then the recipe will not be able to be registered. * If null (default) then the recipe will not be able to be registered.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param leftItem the left item * @param leftItem the left item
* @return This recipe builder instance. * @return This recipe builder instance.
@ -257,9 +207,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the recipe right item. * Get the recipe right item.
* null on default new instance. * null on default new instance.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The right item * @return The right item
*/ */
@ -271,9 +218,6 @@ public class AnvilRecipeBuilder {
/** /**
* Set the recipe right item. * Set the recipe right item.
* null on default new instance. * null on default new instance.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param rightItem the right item * @param rightItem the right item
* @return This recipe builder instance. * @return This recipe builder instance.
@ -286,9 +230,6 @@ public class AnvilRecipeBuilder {
/** /**
* Get the recipe result item. * Get the recipe result item.
* If null (default) then the recipe will not be able to be registered. * If null (default) then the recipe will not be able to be registered.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return The result item * @return The result item
*/ */
@ -300,9 +241,6 @@ public class AnvilRecipeBuilder {
/** /**
* Set the recipe result item. * Set the recipe result item.
* If null (default) then the recipe will not be able to be registered. * If null (default) then the recipe will not be able to be registered.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param resultItem The result item * @param resultItem The result item
* @return This recipe builder instance. * @return This recipe builder instance.
@ -315,9 +253,6 @@ public class AnvilRecipeBuilder {
/** /**
* Build the anvil custom recipe. * Build the anvil custom recipe.
* Should probably use {@link #registerIfAbsent() registerIfAbsent} or {@link ConflictAPI#addConflict(ConflictBuilder) addConflict}. * Should probably use {@link #registerIfAbsent() registerIfAbsent} or {@link ConflictAPI#addConflict(ConflictBuilder) addConflict}.
* <p>
* 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. * @return A new anvil custom recipe base on this builder.
*/ */
@ -338,9 +273,6 @@ public class AnvilRecipeBuilder {
/** /**
* Register this recipe if absent. * Register this recipe if absent.
* Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder)} * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder)}
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @return True if successful. * @return True if successful.
*/ */

View file

@ -15,9 +15,6 @@ import java.util.List;
/** /**
* Custom Anvil api for conflict registry. * Custom Anvil api for conflict registry.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ConflictAPI { public class ConflictAPI {
@ -32,9 +29,6 @@ public class ConflictAPI {
* Write and add a conflict. * Write and add a conflict.
* Will not write the conflict if it already exists. * Will not write the conflict if it already exists.
* Will not be successful if the conflict is empty. * Will not be successful if the conflict is empty.
* <p>
* 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 builder The conflict builder to be based on
* @return True if successful. * @return True if successful.
@ -47,9 +41,6 @@ public class ConflictAPI {
* Write and add a conflict. * Write and add a conflict.
* Will not write the conflict if it already exists. * Will not write the conflict if it already exists.
* Will not be successful if the conflict is empty. * Will not be successful if the conflict is empty.
* <p>
* 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 builder The conflict builder to be based on
* @param overrideDeleted If we should write even if the conflict was previously deleted. * @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. * Write a conflict to the config file and plan an update of conflicts.
* <p> * <p>
* You may want to use {@link #addConflict(ConflictBuilder)} instead as it is more performance in most case as this function will reload every conflict. * You may want to use {@link #addConflict(ConflictBuilder)} instead as it is more performance in most case as this function will reload every conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param builder the builder * @param builder the builder
* @return true if was written successfully. * @return true if was written successfully.
@ -94,9 +82,6 @@ public class ConflictAPI {
* Write a conflict to the config file. * Write a conflict to the config file.
* <p> * <p>
* You should use {@link #addConflict(ConflictBuilder)} or {@link #writeConflict(ConflictBuilder)} instead * You should use {@link #addConflict(ConflictBuilder)} or {@link #writeConflict(ConflictBuilder)} instead
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param builder The builder * @param builder The builder
* @param updatePlanned If we should plan a global update for conflicts * @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. * Extract every enchantment names from a builder.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param builder The builder storing the enchantments * @param builder The builder storing the enchantments
* @return Builder's stored enchantment. * @return Builder's stored enchantment.
@ -150,9 +132,6 @@ public class ConflictAPI {
/** /**
* Remove a conflict. * Remove a conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param conflict The conflict to remove * @param conflict The conflict to remove
* @return True if successful. * @return True if successful.
@ -174,9 +153,6 @@ public class ConflictAPI {
/** /**
* Prepare a task to save conflict configuration. * Prepare a task to save conflict configuration.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
*/ */
private static void prepareSaveTask() { private static void prepareSaveTask() {
if (saveChangeTask != null) return; if (saveChangeTask != null) return;
@ -189,9 +165,6 @@ public class ConflictAPI {
/** /**
* Prepare a task to reload every conflict. * Prepare a task to reload every conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
*/ */
private static void prepareUpdateTask() { private static void prepareUpdateTask() {
if (reloadChangeTask != null) return; if (reloadChangeTask != null) return;
@ -211,9 +184,6 @@ public class ConflictAPI {
/** /**
* Get every registered conflict. * Get every registered conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return An immutable collection of conflict. * @return An immutable collection of conflict.
*/ */

View file

@ -15,9 +15,6 @@ import java.util.Set;
/** /**
* A Builder for material conflict. * A Builder for material conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ConflictBuilder { public class ConflictBuilder {
@ -34,9 +31,6 @@ public class ConflictBuilder {
/** /**
* Instantiates a new Conflict builder. * Instantiates a new Conflict builder.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param name The conflict name * @param name The conflict name
* @param maxBeforeConflict Maximum number of conflicting enchantment before conflict is active * @param maxBeforeConflict Maximum number of conflicting enchantment before conflict is active
@ -56,9 +50,6 @@ public class ConflictBuilder {
/** /**
* Instantiates a new Conflict builder. * Instantiates a new Conflict builder.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param name The conflict name * @param name The conflict name
* @param source The conflict source * @param source The conflict source
@ -69,9 +60,6 @@ public class ConflictBuilder {
/** /**
* Instantiates a new Conflict builder. * Instantiates a new Conflict builder.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param name The conflict name * @param name The conflict name
*/ */
@ -81,9 +69,6 @@ public class ConflictBuilder {
/** /**
* Gets conflict source. * Gets conflict source.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The conflict source. * @return The conflict source.
*/ */
@ -94,9 +79,6 @@ public class ConflictBuilder {
/** /**
* Gets conflict source name. * Gets conflict source name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The conflict source name. * @return The conflict source name.
*/ */
@ -109,9 +91,6 @@ public class ConflictBuilder {
/** /**
* Gets conflict name. * Gets conflict name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The conflict name. * @return The conflict name.
*/ */
@ -122,9 +101,6 @@ public class ConflictBuilder {
/** /**
* Gets stored conflicting enchantment names. * Gets stored conflicting enchantment names.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The stored enchantment names. * @return The stored enchantment names.
*/ */
@ -135,9 +111,6 @@ public class ConflictBuilder {
/** /**
* Gets stored conflicting enchantment keys. * Gets stored conflicting enchantment keys.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The stored enchantment keys. * @return The stored enchantment keys.
*/ */
@ -148,9 +121,6 @@ public class ConflictBuilder {
/** /**
* Gets stored excluded group names. * Gets stored excluded group names.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return The stored group names. * @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. * That mean new enchantment will not be able to be added to the item and present enchantment will not have its level upgraded.
* <p> * <p>
* In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1. * In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1.
* <p>
* 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. * @return the max number of conflicting enchantment before conflict. 0 by default.
*/ */
@ -178,9 +145,6 @@ public class ConflictBuilder {
/** /**
* Sets conflict name. * Sets conflict name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param name The name * @param name The name
* @return This conflict builder instance. * @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. * That mean new enchantment will not be able to be added to the item and present enchantment will not have its level upgraded.
* <p> * <p>
* In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1. * In vanilla. material restriction have this value set to 0 and enchantment conflict set to 1.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param maxBeforeConflict The max before conflict * @param maxBeforeConflict The max before conflict
* @return This conflict builder instance. * @return This conflict builder instance.
@ -211,9 +172,6 @@ public class ConflictBuilder {
/** /**
* Add a conflicting enchantment by name. * Add a conflicting enchantment by name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantmentName The enchantment name * @param enchantmentName The enchantment name
* @return This conflict builder instance. * @return This conflict builder instance.
@ -226,9 +184,6 @@ public class ConflictBuilder {
/** /**
* Add a conflicting enchantment by key. * Add a conflicting enchantment by key.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantmentKey The enchantment key * @param enchantmentKey The enchantment key
* @return This conflict builder instance. * @return This conflict builder instance.
@ -241,9 +196,6 @@ public class ConflictBuilder {
/** /**
* Add a conflicting enchantment by instance. * Add a conflicting enchantment by instance.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantment The enchantment * @param enchantment The enchantment
* @return This conflict builder instance. * @return This conflict builder instance.
@ -256,9 +208,6 @@ public class ConflictBuilder {
/** /**
* Remove conflicting enchantment by name. * Remove conflicting enchantment by name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantmentName The enchantment name * @param enchantmentName The enchantment name
* @return This conflict builder instance. * @return This conflict builder instance.
@ -271,9 +220,6 @@ public class ConflictBuilder {
/** /**
* Remove conflicting enchantment by key. * Remove conflicting enchantment by key.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantmentKey The enchantment key * @param enchantmentKey The enchantment key
* @return This conflict builder instance. * @return This conflict builder instance.
@ -286,9 +232,6 @@ public class ConflictBuilder {
/** /**
* Remove enchantment by instance. * Remove enchantment by instance.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param enchantment The enchantment * @param enchantment The enchantment
* @return This conflict builder instance. * @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 * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment
* with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0.
* Then only pickaxe will be able to have efficiency. * Then only pickaxe will be able to have efficiency.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param groupName The group name * @param groupName The group name
* @return This conflict builder instance. * @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 * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment
* with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0.
* Then only pickaxe will be able to have efficiency. * Then only pickaxe will be able to have efficiency.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param group The group * @param group The group
* @return this conflict builder instance. * @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 * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment
* with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0.
* Then only pickaxe will be able to have efficiency. * Then only pickaxe will be able to have efficiency.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param groupName The group name * @param groupName The group name
* @return This conflict builder instance. * @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 * For example: If we exclude a material group containing every pickaxe and add efficiency enchantment
* with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0. * with {@link #setMaxBeforeConflict(int) maxBeforeConflict} set to 0.
* Then only pickaxe will be able to have efficiency. * Then only pickaxe will be able to have efficiency.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param group The group * @param group The group
* @return This conflict builder instance. * @return This conflict builder instance.
@ -390,9 +321,6 @@ public class ConflictBuilder {
/** /**
* Copy this conflict builder. * Copy this conflict builder.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return A copy of this conflict builder. * @return A copy of this conflict builder.
*/ */
@ -420,9 +348,6 @@ public class ConflictBuilder {
/** /**
* Build a new Enchant conflict group by this builder. * Build a new Enchant conflict group by this builder.
* <p>
* 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. * @return An Enchant conflict group with this builder parameters.
*/ */
@ -437,9 +362,6 @@ public class ConflictBuilder {
/** /**
* Register this conflict if not yet registered. * Register this conflict if not yet registered.
* Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder, boolean) ConflictAPI.addConflict(this, true)}} * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder, boolean) ConflictAPI.addConflict(this, true)}}
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return True if successful. * @return True if successful.
*/ */
@ -450,9 +372,6 @@ public class ConflictBuilder {
/** /**
* Register this conflict if not yet registered or deleted. * Register this conflict if not yet registered or deleted.
* Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder) ConflictAPI.addConflict(this)} * Equivalent to {@link ConflictAPI#addConflict(ConflictBuilder) ConflictAPI.addConflict(this)}
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @return True if successful. * @return True if successful.
*/ */
@ -462,9 +381,6 @@ public class ConflictBuilder {
/** /**
* Append builders stored enchantments into conflict. * Append builders stored enchantments into conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param conflict The conflict target * @param conflict The conflict target
*/ */
@ -485,9 +401,6 @@ public class ConflictBuilder {
/** /**
* Append an enchantment. * Append an enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param conflict The conflict target * @param conflict The conflict target
* @param enchantment The enchantment * @param enchantment The enchantment
@ -502,9 +415,6 @@ public class ConflictBuilder {
/** /**
* Append a list of enchantments. * Append a list of enchantments.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_CONFLICT_V1 ENCHANTMENT_CONFLICT_V1}
* *
* @param conflict The conflict target * @param conflict The conflict target
* @param enchantments List of enchantment to add * @param enchantments List of enchantment to add
@ -523,9 +433,6 @@ public class ConflictBuilder {
/** /**
* Extract group abstract material group. * Extract group abstract material group.
* <p>
* 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. * @return The abstract material group from the builder.
*/ */

View file

@ -13,9 +13,6 @@ import java.util.List;
/** /**
* Custom Anvil api for custom anvil recipes. * Custom Anvil api for custom anvil recipes.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class CustomAnvilRecipeApi { public class CustomAnvilRecipeApi {
@ -27,9 +24,6 @@ public class CustomAnvilRecipeApi {
/** /**
* Write and add a custom anvil recipe. * Write and add a custom anvil recipe.
* Will not write the recipe if it already exists. * Will not write the recipe if it already exists.
* <p>
* 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 builder The recipe builder to be based on
* @return True if successful. * @return True if successful.
@ -41,9 +35,6 @@ public class CustomAnvilRecipeApi {
/** /**
* Write and add a custom anvil recipe. * Write and add a custom anvil recipe.
* Will not write the recipe if it already exists. * Will not write the recipe if it already exists.
* <p>
* 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 builder The recipe builder to be based on
* @param overrideDeleted If we should write even if the recipe was previously deleted. * @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) // TODO remove by name and/or by builder (as name is keept) (and maybe create a get by name)
/** /**
* Remove a custom anvil recipe. * Remove a custom anvil recipe.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
* *
* @param recipe The recipe to remove * @param recipe The recipe to remove
* @return True if successful. * @return True if successful.
@ -115,9 +103,6 @@ public class CustomAnvilRecipeApi {
/** /**
* Prepare a task to save custom recipe configuration. * Prepare a task to save custom recipe configuration.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
*/ */
private static void prepareSaveTask() { private static void prepareSaveTask() {
if(saveChangeTask != null) return; if(saveChangeTask != null) return;
@ -130,10 +115,6 @@ public class CustomAnvilRecipeApi {
/** /**
* Get every registered recipes. * Get every registered recipes.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CUSTOM_RECIPE_V1 CUSTOM_RECIPE_V1}
*
* @return An immutable collection of recipes. * @return An immutable collection of recipes.
*/ */
@NotNull @NotNull

View file

@ -23,9 +23,6 @@ import java.util.Map;
/** /**
* Custom Anvil api for enchantment registry. * Custom Anvil api for enchantment registry.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class EnchantmentApi { public class EnchantmentApi {
@ -36,9 +33,6 @@ public class EnchantmentApi {
/** /**
* Register an enchantment. * Register an enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param enchantment The enchantment to register * @param enchantment The enchantment to register
* @return True if successful. * @return True if successful.
@ -62,9 +56,6 @@ public class EnchantmentApi {
/** /**
* Register an enchantment by minecraft registered enchantment instance. * Register an enchantment by minecraft registered enchantment instance.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param enchantment The enchantment to register * @param enchantment The enchantment to register
* @param defaultRarity The default rarity of the provided enchantment * @param defaultRarity The default rarity of the provided enchantment
@ -81,9 +72,6 @@ public class EnchantmentApi {
* Register an enchantment by minecraft registered enchantment instance. * Register an enchantment by minecraft registered enchantment instance.
* <p> * <p>
* Please note that this function assume the provided enchantment is registered into minecraft registry. * Please note that this function assume the provided enchantment is registered into minecraft registry.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param enchantment The enchantment to register * @param enchantment The enchantment to register
* @return True if successful. * @return True if successful.
@ -94,9 +82,6 @@ public class EnchantmentApi {
/** /**
* Unregister an enchantment. * Unregister an enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param enchantment The enchantment to unregister * @param enchantment The enchantment to unregister
* @return True if successful. * @return True if successful.
@ -115,9 +100,6 @@ public class EnchantmentApi {
/** /**
* Unregister an enchantment by its key. * Unregister an enchantment by its key.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param key The enchantment key to unregister * @param key The enchantment key to unregister
* @return True if successful. * @return True if successful.
@ -129,9 +111,6 @@ public class EnchantmentApi {
/** /**
* Unregister an enchantment by his bukkit enchantment. * Unregister an enchantment by his bukkit enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param enchantment The enchantment to unregister * @param enchantment The enchantment to unregister
* @return True if successful. * @return True if successful.
@ -142,9 +121,6 @@ public class EnchantmentApi {
/** /**
* Get by key an enchantment. * Get by key an enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param key The key used to fetch * @param key The key used to fetch
* @return The custom anvil enchantment of this key. null if not found. * @return The custom anvil enchantment of this key. null if not found.
@ -156,9 +132,6 @@ public class EnchantmentApi {
/** /**
* Get by name an enchantment. * Get by name an enchantment.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param name The name used to fetch * @param name The name used to fetch
* @return The custom anvil enchantment of this name. null if not found. * @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. * Get list of enchantment using the provided name.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
* *
* @param name The name used to fetch * @param name The name used to fetch
* @return List of custom anvil enchantments of this name. May be empty if not found. * @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. * Get every registered custom anvil enchantments.
* <p>
* 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. * @return An immutable map of enchantment key as map key and custom anvil enchantment as value.
*/ */
@NotNull @NotNull
@ -198,10 +164,6 @@ public class EnchantmentApi {
/** /**
* Write the default level and rarity configuration of the enchantment. * Write the default level and rarity configuration of the enchantment.
* <p>
* 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 enchantment The enchantment to write default configuration
* @param override If it should override old configuration * @param override If it should override old configuration
* @return Return false if override is false and a configuration exist. true otherwise. * @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. * Prepare a task to save custom recipe configuration.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
*/ */
private static void prepareSaveTask() { private static void prepareSaveTask() {
if(saveChangeTask != null) return; if(saveChangeTask != null) return;
@ -258,10 +217,6 @@ public class EnchantmentApi {
/** /**
* Add a bulk get operator. * Add a bulk get operator.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
*
* @param operation An optimised get enchantments operation * @param operation An optimised get enchantments operation
*/ */
public static void addBulkGet(@NotNull BulkGetEnchantOperation operation){ public static void addBulkGet(@NotNull BulkGetEnchantOperation operation){
@ -270,10 +225,6 @@ public class EnchantmentApi {
/** /**
* Add a bulk clean operator. * Add a bulk clean operator.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#ENCHANTMENT_REGISTER_V1 ENCHANTMENT_REGISTER_V1}
*
* @param operation An optimised clean enchantments operation * @param operation An optimised clean enchantments operation
*/ */
public static void addBulkClean(@NotNull BulkCleanEnchantOperation operation){ public static void addBulkClean(@NotNull BulkCleanEnchantOperation operation){

View file

@ -18,9 +18,6 @@ import java.util.*;
/** /**
* Custom Anvil api for material group registry. * Custom Anvil api for material group registry.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class MaterialGroupApi { public class MaterialGroupApi {
@ -35,9 +32,6 @@ public class MaterialGroupApi {
* Write and add a group. * Write and add a group.
* Will not write the group if it already exists. * Will not write the group if it already exists.
* Will not be successful if the group is empty. * Will not be successful if the group is empty.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
* *
* @param group The group to add * @param group The group to add
* @return true if successful. * @return true if successful.
@ -50,9 +44,6 @@ public class MaterialGroupApi {
* Write and add a group. * Write and add a group.
* Will not write the group if it already exists. * Will not write the group if it already exists.
* Will not be successful if the group is empty. * Will not be successful if the group is empty.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
* *
* @param group The group to add * @param group The group to add
* @param overrideDeleted If we should write even if the group was previously deleted. * @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. * Write a material group to the config file and plan an update of groups.
* <p> * <p>
* You may want to use {@link #addMaterialGroup(AbstractMaterialGroup)} instead as it is more performance in most case as this function will reload every conflict. * You may want to use {@link #addMaterialGroup(AbstractMaterialGroup)} instead as it is more performance in most case as this function will reload every conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
* *
* @param group the group to write * @param group the group to write
* @return true if was written successfully. * @return true if was written successfully.
@ -101,9 +89,6 @@ public class MaterialGroupApi {
* Write a material group to the config file. * Write a material group to the config file.
* <p> * <p>
* You should use {@link #addMaterialGroup(AbstractMaterialGroup)} or {@link #writeMaterialGroup(AbstractMaterialGroup)} instead * You should use {@link #addMaterialGroup(AbstractMaterialGroup)} or {@link #writeMaterialGroup(AbstractMaterialGroup)} instead
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
* *
* @param group the group to write * @param group the group to write
* @param updatePlanned if we should plan a global update for material groups * @param updatePlanned if we should plan a global update for material groups
@ -190,9 +175,6 @@ public class MaterialGroupApi {
* Remove a material group. * Remove a material group.
* Caution ! It will not be removed from depending conflict or other material group at runtime. * 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. * For that reason, it is not recommended to use this function.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
* *
* @param group The recipe to remove * @param group The recipe to remove
* @return True if the group was present. * @return True if the group was present.
@ -217,9 +199,6 @@ public class MaterialGroupApi {
/** /**
* Prepare a task to reload every conflict. * Prepare a task to reload every conflict.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
*/ */
private static void prepareSaveTask() { private static void prepareSaveTask() {
if (saveChangeTask != null) return; if (saveChangeTask != null) return;
@ -232,9 +211,6 @@ public class MaterialGroupApi {
/** /**
* Prepare a task to save configuration. * Prepare a task to save configuration.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#MATERIAL_GROUP_V1 MATERIAL_GROUP_V1}
*/ */
private static void prepareUpdateTask() { private static void prepareUpdateTask() {
if (reloadChangeTask != null) return; if (reloadChangeTask != null) return;
@ -252,9 +228,6 @@ public class MaterialGroupApi {
/** /**
* Get by name a group. * Get by name a group.
* <p>
* 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 * @param groupName the group name used to fetch
* @return the abstract group of this name. null if not found. * @return the abstract group of this name. null if not found.
@ -266,9 +239,6 @@ public class MaterialGroupApi {
/** /**
* Get every registered material groups. * Get every registered material groups.
* <p>
* 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. * @return An immutable map of group name as its key and group as mapped value.
*/ */

View file

@ -18,15 +18,11 @@ import java.util.List;
/** /**
* Custom Anvil api for unit repair. * Custom Anvil api for unit repair.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class UnitRepairApi { public class UnitRepairApi {
private UnitRepairApi() { private UnitRepairApi(){}
}
private static Object saveChangeTask = null; private static Object saveChangeTask = null;
@ -34,40 +30,31 @@ public class UnitRepairApi {
* Write and add a custom anvil unit repair recipe. * Write and add a custom anvil unit repair recipe.
* Will not write the recipe if it already exists or was deleted. * Will not write the recipe if it already exists or was deleted.
* Set the value to minecraft default value (0.25 = 25%) * Set the value to minecraft default value (0.25 = 25%)
* <p>
* 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 unit The unit material used to repair the bellow item.
* @param repairable The item to be repaired. * @param repairable The item to be repaired.
* @return true if successful. * @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); return addUnitRepair(unit, repairable, 0.25, false);
} }
/** /**
* Write and add a custom anvil unit repair recipe. * Write and add a custom anvil unit repair recipe.
* Will not write the recipe if it already exists or was deleted. * Will not write the recipe if it already exists or was deleted.
* <p>
* 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 unit The unit material used to repair the bellow item.
* @param repairable The item to be repaired. * @param repairable The item to be repaired.
* @param value The amount to be repaired by every unit. (1% = 0.01) * @param value The amount to be repaired by every unit. (1% = 0.01)
* @return true if successful. * @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); return addUnitRepair(unit, repairable, value, false);
} }
/** /**
* Write and add a custom anvil unit repair recipe. * Write and add a custom anvil unit repair recipe.
* Will not write the recipe if it already exists. * Will not write the recipe if it already exists.
* <p>
* 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 unit The unit material used to repair the bellow item.
* @param repairable The item to be repaired. * @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. * @param overrideDeleted If we should write even if the recipe was previously deleted.
* @return true if successful. * @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(); FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig();
String path = unit.name().toLowerCase() + "." + repairable.name().toLowerCase(); String path = unit.name().toLowerCase() + "." + repairable.name().toLowerCase();
if (!overrideDeleted && ConfigHolder.UNIT_REPAIR_HOLDER.isDeleted(path)) return false; if(!overrideDeleted && ConfigHolder.UNIT_REPAIR_HOLDER.isDeleted(path)) return false;
if (config.contains(path)) return false; if(config.contains(path)) return false;
// Set unit repair // Set unit repair
return setUnitRepair(unit, repairable, value); return setUnitRepair(unit, repairable, value);
@ -89,16 +76,13 @@ public class UnitRepairApi {
/** /**
* Write and add a custom anvil unit repair recipe. * Write and add a custom anvil unit repair recipe.
* Do not check if it previously existed or exist. * Do not check if it previously existed or exist.
* <p>
* 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 unit The unit material used to repair the bellow item.
* @param repairable The item to be repaired. * @param repairable The item to be repaired.
* @param value The amount to be repaired by every unit. (1% = 0.01) * @param value The amount to be repaired by every unit. (1% = 0.01)
* @return true if successful. * @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(); FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig();
String repairableName = repairable.name().toLowerCase(); String repairableName = repairable.name().toLowerCase();
@ -110,10 +94,10 @@ public class UnitRepairApi {
// Add to gui // Add to gui
UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance(); UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance();
if (repairConfigGui != null) { if(repairConfigGui != null) {
UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored(); UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored();
if (elementGui != null) elementGui.updateValueForGeneric(repairableName, true); if(elementGui != null) elementGui.updateValueForGeneric(repairableName, true);
repairConfigGui.updateValueForGeneric(unit, true); repairConfigGui.updateValueForGeneric(unit, true);
} }
@ -122,15 +106,12 @@ public class UnitRepairApi {
/** /**
* Remove a custom anvil unit repair recipe. * Remove a custom anvil unit repair recipe.
* <p>
* 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 unit The unit material used to repair the bellow item.
* @param repairable The item used to be repaired. * @param repairable The item used to be repaired.
* @return true if successful. * @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 // Delete every possible variation and save to file
String unitName = unit.name(); String unitName = unit.name();
String repairableName = repairable.name(); String repairableName = repairable.name();
@ -143,17 +124,17 @@ public class UnitRepairApi {
// Test if it was the last value of this section // Test if it was the last value of this section
boolean lastValue = false; boolean lastValue = false;
if (config.isConfigurationSection(unitName.toLowerCase())) { if(config.isConfigurationSection(unitName.toLowerCase())) {
ConfigurationSection section = config.getConfigurationSection(unitName.toLowerCase()); ConfigurationSection section = config.getConfigurationSection(unitName.toLowerCase());
if (section != null && section.getKeys(false).isEmpty()) { if(section != null && section.getKeys(false).isEmpty()) {
lastValue = true; lastValue = true;
config.set(unitName.toLowerCase(), null); config.set(unitName.toLowerCase(), null);
} }
} else if (config.isConfigurationSection(unitName.toUpperCase())) { } else if (config.isConfigurationSection(unitName.toUpperCase())) {
ConfigurationSection section = config.getConfigurationSection(unitName.toUpperCase()); ConfigurationSection section = config.getConfigurationSection(unitName.toUpperCase());
if (section != null && section.getKeys(false).isEmpty()) { if(section != null && section.getKeys(false).isEmpty()) {
lastValue = true; lastValue = true;
config.set(unitName.toUpperCase(), null); config.set(unitName.toUpperCase(), null);
} }
@ -167,11 +148,11 @@ public class UnitRepairApi {
// Remove from gui // Remove from gui
UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance(); UnitRepairConfigGui repairConfigGui = UnitRepairConfigGui.getCurrentInstance();
if (repairConfigGui != null) { if(repairConfigGui != null) {
UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored(); UnitRepairElementListGui elementGui = repairConfigGui.getInstanceOrCreate(unit).getStored();
if (elementGui != null) elementGui.removeGeneric(repairableName); if(elementGui != null) elementGui.removeGeneric(repairableName);
if (lastValue) { if(lastValue){
repairConfigGui.removeGeneric(unit); repairConfigGui.removeGeneric(unit);
} }
} }
@ -181,14 +162,11 @@ public class UnitRepairApi {
/** /**
* Prepare a task to save custom unit repair recipe configuration. * Prepare a task to save custom unit repair recipe configuration.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#UNIT_REPAIR_V1 UNIT_REPAIR_V1}
*/ */
private static void prepareSaveTask() { 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); ConfigHolder.UNIT_REPAIR_HOLDER.saveToDisk(true);
saveChangeTask = null; saveChangeTask = null;
}); });
@ -196,10 +174,6 @@ public class UnitRepairApi {
/** /**
* Get every unit repair recipes. * Get every unit repair recipes.
* <p>
* 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. * @return An immutable collection of unit repair recipes.
* <p> * <p>
* Each element of the provided triple represent a part of the recipe * Each element of the provided triple represent a part of the recipe
@ -210,27 +184,27 @@ public class UnitRepairApi {
* </ul> * </ul>
*/ */
@NotNull @NotNull
public static List<Triple<Material, Material, Double>> getUnitRepairs() { public static List<Triple<Material, Material, Double>> getUnitRepairs(){
List<Triple<Material, Material, Double>> mutableList = new ArrayList<>(); List<Triple<Material, Material, Double>> mutableList = new ArrayList<>();
FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig(); FileConfiguration config = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig();
for (String unitKey : config.getKeys(false)) { for (String unitKey : config.getKeys(false)) {
// Test if config section exist // Test if config section exist
if (!config.isConfigurationSection(unitKey)) continue; if(!config.isConfigurationSection(unitKey)) continue;
// Test if unit is a material // Test if unit is a material
Material unit = Material.getMaterial(unitKey.toUpperCase()); Material unit = Material.getMaterial(unitKey.toUpperCase());
if (unit == null) continue; if(unit == null) continue;
// Iterate over reparable items // Iterate over reparable items
ConfigurationSection section = config.getConfigurationSection(unitKey); ConfigurationSection section = config.getConfigurationSection(unitKey);
for (String repairableKey : section.getKeys(false)) { for (String repairableKey : section.getKeys(false)) {
// Test if value section exist // Test if value section exist
if (!section.isDouble(repairableKey)) continue; if(!section.isDouble(repairableKey)) continue;
// Test if repairable is valid a material // Test if repairable is valid a material
Material repairable = Material.getMaterial(repairableKey.toUpperCase()); Material repairable = Material.getMaterial(repairableKey.toUpperCase());
if (repairable == null) continue; if(repairable == null) continue;
// Add the values // Add the values
mutableList.add(new Triple<>(unit, repairable, section.getDouble(repairableKey))); mutableList.add(new Triple<>(unit, repairable, section.getDouble(repairableKey)));

View file

@ -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<CAApiFlags> 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<CAApiFlags> getCurrentFlags() {
return Collections.unmodifiableSet(CURRENT_FLAGS);
}
public boolean hasFlags(CAApiFlags... flag) {
return CURRENT_FLAGS.containsAll(List.of(flag));
}
}

View file

@ -19,9 +19,6 @@ import org.bukkit.event.HandlerList;
* {@link xyz.alexcrea.cuanvil.api.MaterialGroupApi MaterialGroupApi} * {@link xyz.alexcrea.cuanvil.api.MaterialGroupApi MaterialGroupApi}
* and {@link xyz.alexcrea.cuanvil.api.UnitRepairApi UnitRepairApi} * and {@link xyz.alexcrea.cuanvil.api.UnitRepairApi UnitRepairApi}
* to add/remove/edit configurations * to add/remove/edit configurations
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CONFIG_EVENTS_V1 CONFIG_EVENTS_V1}
*/ */
public class CAConfigReadyEvent extends Event { public class CAConfigReadyEvent extends Event {

View file

@ -13,9 +13,6 @@ import org.bukkit.event.HandlerList;
* (after configuration loading phase. see {@link CAConfigReadyEvent}) * (after configuration loading phase. see {@link CAConfigReadyEvent})
* <p> * <p>
* use {@link xyz.alexcrea.cuanvil.api.EnchantmentApi EnchantmentApi} to register and unregister your custom enchantments * use {@link xyz.alexcrea.cuanvil.api.EnchantmentApi EnchantmentApi} to register and unregister your custom enchantments
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#CONFIG_EVENTS_V1 CONFIG_EVENTS_V1}
*/ */
public class CAEnchantRegistryReadyEvent extends Event { public class CAEnchantRegistryReadyEvent extends Event {

View file

@ -18,9 +18,6 @@ import org.jetbrains.annotations.NotNull;
* for this event to be useful. * for this event to be useful.
* <p> * <p>
* There is also {@link CATreatAnvilResultEvent} that may be better for some use case. * There is also {@link CATreatAnvilResultEvent} that may be better for some use case.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
*/ */
public class CAClickResultBypassEvent extends Event implements Cancellable { public class CAClickResultBypassEvent extends Event implements Cancellable {

View file

@ -17,8 +17,6 @@ import org.jetbrains.annotations.NotNull;
* <p> * <p>
* It is also recommended that you read about {@link CAPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * It is also recommended that you read about {@link CAPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent}
* as your use case may be more prone to use theses. * as your use case may be more prone to use theses.
* <p>
* This is part of {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
*/ */
public class CAEarlyPreAnvilBypassEvent extends Event implements Cancellable { 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 * Get the bukkit pre anvil event causing this event
* <p>
* 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 * @return The pre anvil event causing to this event
*/ */

View file

@ -20,9 +20,6 @@ import org.jetbrains.annotations.NotNull;
* <p> * <p>
* It is also recommended that you read about {@link CAEarlyPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent} * It is also recommended that you read about {@link CAEarlyPreAnvilBypassEvent} and {@link CATreatAnvilResultEvent}
* as your use case may be more prone to use theses. * as your use case may be more prone to use theses.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
*/ */
public class CAPreAnvilBypassEvent extends Event implements Cancellable { public class CAPreAnvilBypassEvent extends Event implements Cancellable {

View file

@ -17,8 +17,6 @@ import xyz.alexcrea.cuanvil.util.AnvilUseType;
* and {@link CAEarlyPreAnvilBypassEvent} for your use case * and {@link CAEarlyPreAnvilBypassEvent} for your use case
* <p> * <p>
* A null result will cancel this pre anvil event * A null result will cancel this pre anvil event
* <p>
* This is part of {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class CATreatAnvilResultEvent extends Event { public class CATreatAnvilResultEvent extends Event {
@ -53,9 +51,6 @@ public class CATreatAnvilResultEvent extends Event {
/** /**
* Get the bukkit inventory click event causing to this event. * Get the bukkit inventory click event causing to this event.
* <p>
* 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. * @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. * Get the type of use source of the result.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
* *
* @return The craft use type. * @return The craft use type.
*/ */
@ -79,9 +71,6 @@ public class CATreatAnvilResultEvent extends Event {
* Get the current result * Get the current result
* <p> * <p>
* note that it will not be null unless another listener previously set it to null. * note that it will not be null unless another listener previously set it to null.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
* *
* @return The current result. * @return The current result.
*/ */
@ -93,9 +82,6 @@ public class CATreatAnvilResultEvent extends Event {
* Set the current result * Set the current result
* <p> * <p>
* note that a null result will cancel this anvil use. * note that a null result will cancel this anvil use.
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
* *
* @param result The new result * @param result The new result
*/ */
@ -116,9 +102,6 @@ public class CATreatAnvilResultEvent extends Event {
* <li>Item merge</li> * <li>Item merge</li>
* <li>Item rename</li> * <li>Item rename</li>
* </ul> * </ul>
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
* *
* @return The current cost. * @return The current cost.
*/ */
@ -139,9 +122,6 @@ public class CATreatAnvilResultEvent extends Event {
* <li>Item merge</li> * <li>Item merge</li>
* <li>Item rename</li> * <li>Item rename</li>
* </ul> * </ul>
* <p>
* This is part of
* {@link xyz.alexcrea.cuanvil.api.data.CAApiFlags#LISTENER_EVENTS_V1 LISTENER_EVENTS_V1}
* *
* @param levelCost The new cost. * @param levelCost The new cost.
*/ */