mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
add flags for the api
This commit is contained in:
parent
7ee6ab0376
commit
cea6d51470
14 changed files with 417 additions and 23 deletions
|
|
@ -7,6 +7,9 @@ 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 {
|
||||||
|
|
@ -27,6 +30,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -45,6 +51,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,6 +64,9 @@ 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.
|
||||||
|
|
@ -69,6 +81,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -81,6 +96,9 @@ 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.
|
||||||
|
|
@ -92,6 +110,9 @@ 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
|
||||||
|
|
@ -103,6 +124,9 @@ 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.
|
||||||
|
|
@ -115,6 +139,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -124,6 +151,9 @@ 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.
|
||||||
|
|
@ -135,6 +165,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -144,6 +177,9 @@ 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.
|
||||||
|
|
@ -160,6 +196,10 @@ 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() {
|
||||||
|
|
@ -174,6 +214,10 @@ 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) {
|
||||||
|
|
@ -184,6 +228,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -195,6 +242,9 @@ 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.
|
||||||
|
|
@ -207,6 +257,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -218,6 +271,9 @@ 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.
|
||||||
|
|
@ -230,6 +286,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -241,6 +300,9 @@ 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.
|
||||||
|
|
@ -253,6 +315,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -273,6 +338,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ 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 {
|
||||||
|
|
@ -29,6 +32,9 @@ 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.
|
||||||
|
|
@ -41,6 +47,9 @@ 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.
|
||||||
|
|
@ -70,6 +79,9 @@ 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.
|
||||||
|
|
@ -82,6 +94,9 @@ 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
|
||||||
|
|
@ -116,6 +131,9 @@ 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.
|
||||||
|
|
@ -132,6 +150,9 @@ 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.
|
||||||
|
|
@ -153,6 +174,9 @@ 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;
|
||||||
|
|
@ -165,6 +189,9 @@ 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;
|
||||||
|
|
@ -184,6 +211,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ 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 {
|
||||||
|
|
@ -31,6 +34,9 @@ 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
|
||||||
|
|
@ -50,6 +56,9 @@ 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
|
||||||
|
|
@ -60,6 +69,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -69,6 +81,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,6 +94,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,6 +109,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,6 +122,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -111,6 +135,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -121,6 +148,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -136,6 +166,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -145,6 +178,9 @@ 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.
|
||||||
|
|
@ -161,6 +197,9 @@ 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.
|
||||||
|
|
@ -172,6 +211,9 @@ 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.
|
||||||
|
|
@ -184,6 +226,9 @@ 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.
|
||||||
|
|
@ -196,6 +241,9 @@ 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.
|
||||||
|
|
@ -208,6 +256,9 @@ 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.
|
||||||
|
|
@ -220,6 +271,9 @@ 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.
|
||||||
|
|
@ -232,6 +286,9 @@ 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.
|
||||||
|
|
@ -251,6 +308,9 @@ 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.
|
||||||
|
|
@ -271,6 +331,9 @@ 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.
|
||||||
|
|
@ -290,6 +353,9 @@ 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.
|
||||||
|
|
@ -310,6 +376,9 @@ 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.
|
||||||
|
|
@ -321,6 +390,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -348,6 +420,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -362,6 +437,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -372,6 +450,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -381,6 +462,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -401,6 +485,9 @@ 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
|
||||||
|
|
@ -415,6 +502,9 @@ 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
|
||||||
|
|
@ -433,6 +523,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ 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 {
|
||||||
|
|
@ -24,6 +27,9 @@ 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.
|
||||||
|
|
@ -35,6 +41,9 @@ 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.
|
||||||
|
|
@ -81,6 +90,9 @@ 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.
|
||||||
|
|
@ -103,6 +115,9 @@ 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;
|
||||||
|
|
@ -115,6 +130,10 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ 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 {
|
||||||
|
|
@ -33,6 +36,9 @@ 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.
|
||||||
|
|
@ -56,6 +62,9 @@ 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
|
||||||
|
|
@ -72,6 +81,9 @@ 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.
|
||||||
|
|
@ -82,6 +94,9 @@ 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.
|
||||||
|
|
@ -100,6 +115,9 @@ 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.
|
||||||
|
|
@ -111,6 +129,9 @@ 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.
|
||||||
|
|
@ -121,6 +142,9 @@ 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.
|
||||||
|
|
@ -132,6 +156,9 @@ 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.
|
||||||
|
|
@ -145,6 +172,9 @@ 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.
|
||||||
|
|
@ -155,6 +185,10 @@ 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
|
||||||
|
|
@ -164,6 +198,10 @@ 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.
|
||||||
|
|
@ -205,6 +243,9 @@ 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;
|
||||||
|
|
@ -217,6 +258,10 @@ 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){
|
||||||
|
|
@ -225,6 +270,10 @@ 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){
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ 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 {
|
||||||
|
|
@ -32,6 +35,9 @@ 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.
|
||||||
|
|
@ -44,6 +50,9 @@ 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.
|
||||||
|
|
@ -77,6 +86,9 @@ 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.
|
||||||
|
|
@ -89,6 +101,9 @@ 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
|
||||||
|
|
@ -175,6 +190,9 @@ 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.
|
||||||
|
|
@ -199,6 +217,9 @@ 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;
|
||||||
|
|
@ -211,6 +232,9 @@ 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;
|
||||||
|
|
@ -228,6 +252,9 @@ 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.
|
||||||
|
|
@ -239,6 +266,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,15 @@ 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;
|
||||||
|
|
||||||
|
|
@ -30,6 +34,9 @@ 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.
|
||||||
|
|
@ -42,6 +49,9 @@ 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.
|
||||||
|
* <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.
|
||||||
|
|
@ -55,6 +65,9 @@ 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.
|
* 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.
|
||||||
|
|
@ -76,6 +89,9 @@ 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.
|
||||||
|
|
@ -106,6 +122,9 @@ 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.
|
||||||
|
|
@ -162,6 +181,9 @@ 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;
|
||||||
|
|
@ -174,6 +196,10 @@ 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
|
||||||
|
|
|
||||||
42
src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java
Normal file
42
src/main/java/xyz/alexcrea/cuanvil/api/data/CAApiFlags.java
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,9 @@ 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 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ 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 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ 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 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ 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 {
|
||||||
|
|
||||||
|
|
@ -48,6 +50,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ 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 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ 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 {
|
||||||
|
|
@ -51,6 +53,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,6 +65,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,6 +79,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,6 +93,9 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,6 +116,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -122,6 +139,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue