Object CustomCrafterAPI
-
- All Implemented Interfaces:
public class CustomCrafterAPI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumCustomCrafterAPI.VersionTypeRepresents the release stage of the Custom Crafter API.
Use CustomCrafterAPI.VERSION_TYPE to get the current release stage.
if (CustomCrafterAPI.VERSION_TYPE != CustomCrafterAPI.VersionType.STABLE) { logger.warning("CustomCrafter API is not a stable release: ${CustomCrafterAPI.VERSION_TYPE}") }public enumCustomCrafterAPI.NameStrictLevelRestriction level for recipe name duplication, applied during recipe registration.
Introduced to prevent confusion when multiple recipes are displayed simultaneously.
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerMAJOR_VERSIONpublic final static IntegerMINOR_VERSIONpublic final static IntegerPATCH_VERSIONpublic final static StringAPI_VERSIONprivate final CustomCrafterAPI.VersionTypeVERSION_TYPEpublic final static Set<String>AUTHORSpublic final static BooleanDEFAULT_RESULT_GIVE_CANCELpublic final static MaterialDEFAULT_BASE_BLOCKpublic final static BooleanDEFAULT_USE_MULTIPLE_RESULT_CANDIDATE_FEATUREpublic final static BooleanDEFAULT_USE_CUSTOM_CRAFT_UIpublic final static IntegerDEFAULT_BASE_BLOCK_SIDEpublic final static CraftUIDesignerDEFAULT_CRAFT_UI_DESIGNERpublic final static CustomCrafterAPI.NameStrictLevelDEFAULT_RECIPE_NAME_STRICT_LEVELpublic final static AllCandidateUIDesignerDEFAULT_ALL_CANDIDATE_UI_DESIGNERpublic final static CustomCrafterAPIINSTANCE
-
Method Summary
Modifier and Type Method Description final static BooleanhasFullCompatibility(String version)Checks full-compatibilityThis function will be removed in 6.0.0. final static BooleangetResultGiveCancel()Returns a boolean value that means the Custom Crafter API give result items to players or not. final static UnitsetResultGiveCancel(Boolean v, Boolean calledAsync)Sets a boolean value that means the Custom Crafter API give result items to players or not. final static UnitsetResultGiveCancel(Boolean v)Sets a boolean value that means the Custom Crafter API give result items to players or not. final static MaterialgetBaseBlock()Gets a base block type. final static UnitsetBaseBlock(Material type, Boolean calledAsync)Sets base block with given material. final static UnitsetBaseBlock(Material type)Sets base block with given material. final static BooleangetUseMultipleResultCandidateFeature()Returns a boolean value that means 'multiple result candidate' feature enabled or not. final static UnitsetUseMultipleResultCandidateFeature(Boolean v, Boolean calledAsync)Sets 'multiple result candidate' feature enables or not. final static UnitsetUseMultipleResultCandidateFeature(Boolean v)Sets 'multiple result candidate' feature enables or not. final static BooleangetUseCustomCraftUI()Returns a boolean value that means 'Custom Craft UI open' enabled or not. final static UnitsetUseCustomCraftUI(Boolean v, Boolean calledAsync)Sets 'Custom Craft UI open' enables or not. final static UnitsetUseCustomCraftUI(Boolean v)Sets 'Custom Craft UI open' enables or not. final static BooleansetBaseBlockSideSize(Integer size, Boolean calledAsync)Sets base block's side size. final static BooleansetBaseBlockSideSize(Integer size)Sets base block's side size. final static IntegergetBaseBlockSideSize()Gets the base block's side size. final static CraftUIDesignergetCraftUIDesigner()Returns a current CraftUI designer. final static UnitsetCraftUIDesigner(CraftUIDesigner designer, Boolean calledAsync)Sets a new CraftUI designer if a specified is valid. final static UnitsetCraftUIDesigner(CraftUIDesigner designer)Sets a new CraftUI designer if a specified is valid. final static Set<String>getRegisteredRecipeNames()Returns a set of all registered recipe names. final static List<CRecipe>getRegisteredRecipeFromName(Function1<String, Boolean> filter)Returns registered recipes whose names satisfy the given filter predicate. final static List<CRecipe>getRegisteredRecipeFromName(String recipeName)Returns registered recipes whose names exactly match the given string. final static List<CRecipe>getRegisteredRecipeFromPlugin(JavaPlugin plugin)Returns recipes that are registered by given plugin instance. final static CustomCrafterAPI.NameStrictLevelgetRecipeNameStrictLevel()Returns current recipe-name-strict-level final static UnitsetRecipeNameStrictLevel(CustomCrafterAPI.NameStrictLevel level, Boolean calledAsync)Sets the recipe name strict level. final static UnitsetRecipeNameStrictLevel(CustomCrafterAPI.NameStrictLevel level)Sets the recipe name strict level. final static List<CRecipe>getRecipes()Returns an immutable list of all registered recipes. final static UnitregisterRecipe(List<CRecipe> recipes, JavaPlugin plugin, Boolean calledAsync)Registers the provided recipes and fires RegisterCustomRecipeEvent. final static UnitregisterRecipe(List<CRecipe> recipes, JavaPlugin plugin)Registers the provided recipes and fires RegisterCustomRecipeEvent. final static UnitregisterRecipe(List<CRecipe> recipes)Registers the provided recipes and fires RegisterCustomRecipeEvent. final static UnitunregisterRecipe(String name, JavaPlugin plugin, Boolean calledAsync)Unregisters recipes that match the specified conditions. final static UnitunregisterRecipe(String name, JavaPlugin plugin)Unregisters recipes that match the specified conditions. final static UnitunregisterRecipe(String name)Unregisters recipes that match the specified conditions. final static UnitunregisterRecipe()Unregisters recipes that match the specified conditions. final static UnitunregisterAllRecipes(Boolean calledAsync)Unregisters all registered recipes. final static AllCandidateUIDesignergetAllCandidateUIDesigner()Returns current AllCandidateUIDesigner final static UnitsetAllCandidateUIDesigner(AllCandidateUIDesigner designer)Sets the AllCandidateUIDesigner. final CustomCrafterAPI.VersionTypegetVERSION_TYPE()Release stage of the Custom Crafter API. -
-
Method Detail
-
hasFullCompatibility
@Deprecated(message = "Removal for 6.0.0. Use 'VersionType' and (MAJOR|MINOR|PATCH)_VERSION instead.", replaceWith = @ReplaceWith(expression = "MAJOR_VERSION"), level = DeprecationLevel.WARNING) final static Boolean hasFullCompatibility(String version)
Checks full-compatibility
This function will be removed in 6.0.0. Use MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION for version comparison, and VERSION_TYPE to check the release stage.
// Check Example in your plugin @Override fun onEnable() { if (!CustomCrafterAPI.hasFullCompatibility("5.0.15")) { println("This plugin has not full-compatibility with loaded CustomCrafter.") println("Loaded Version: ${CustomCrafterAPI.API_VERSION}") Bukkit.pluginManager.disablePlugin(this) return } }- Parameters:
version- CustomCrafter version string that is used by your plugin.- Since:
5.0.13
-
getResultGiveCancel
final static Boolean getResultGiveCancel()
Returns a boolean value that means the Custom Crafter API give result items to players or not.
- Returns:
Boolean Give or not
- Since:
5.0.11
-
setResultGiveCancel
@JvmOverloads() final static Unit setResultGiveCancel(Boolean v, Boolean calledAsync)
Sets a boolean value that means the Custom Crafter API give result items to players or not.
You have to set this to true if you want to give result items processing in your plugin.
Default =
false- Parameters:
v- Give or notcalledAsync- Called from async processing or not.- Since:
5.0.11
-
setResultGiveCancel
@JvmOverloads() final static Unit setResultGiveCancel(Boolean v)
Sets a boolean value that means the Custom Crafter API give result items to players or not.
You have to set this to true if you want to give result items processing in your plugin.
Default =
false- Parameters:
v- Give or not- Since:
5.0.11
-
getBaseBlock
final static Material getBaseBlock()
Gets a base block type.
- Returns:
Material base block type
- Since:
5.0.9
-
setBaseBlock
@JvmOverloads() final static Unit setBaseBlock(Material type, Boolean calledAsync)
Sets base block with given material.
If a given material is not a block type, throws IllegalArgumentException.
- Parameters:
type- base block typecalledAsync- Called from async processing or not.- Since:
5.0.9
-
setBaseBlock
@JvmOverloads() final static Unit setBaseBlock(Material type)
Sets base block with given material.
If a given material is not a block type, throws IllegalArgumentException.
- Parameters:
type- base block type- Since:
5.0.9
-
getUseMultipleResultCandidateFeature
final static Boolean getUseMultipleResultCandidateFeature()
Returns a boolean value that means 'multiple result candidate' feature enabled or not.
true: If the system gets some result candidates, shows all candidates to a player.false: The API provides only a first matched item. (no prompt)
- Returns:
Boolean Enabled or not
- Since:
5.0.11 (original 5.0.8)
-
setUseMultipleResultCandidateFeature
@JvmOverloads() final static Unit setUseMultipleResultCandidateFeature(Boolean v, Boolean calledAsync)
Sets 'multiple result candidate' feature enables or not.
true: If the system gets some result candidates, shows all candidates to a player.false: The API provides only a first matched item. (no prompt)
- Parameters:
v- Multiple result candidate feature enable or notcalledAsync- Called from async processing or not.- Since:
5.0.11 (original 5.0.8)
-
setUseMultipleResultCandidateFeature
@JvmOverloads() final static Unit setUseMultipleResultCandidateFeature(Boolean v)
Sets 'multiple result candidate' feature enables or not.
true: If the system gets some result candidates, shows all candidates to a player.false: The API provides only a first matched item. (no prompt)
- Parameters:
v- Multiple result candidate feature enable or not- Since:
5.0.11 (original 5.0.8)
-
getUseCustomCraftUI
final static Boolean getUseCustomCraftUI()
Returns a boolean value that means 'Custom Craft UI open' enabled or not.
- Returns:
Boolean Enabled or not
- Since:
5.0.13-1
-
setUseCustomCraftUI
@JvmOverloads() final static Unit setUseCustomCraftUI(Boolean v, Boolean calledAsync)
Sets 'Custom Craft UI open' enables or not.
- Parameters:
v- Enable or notcalledAsync- Called from async processing or not.- Since:
5.0.13-1
-
setUseCustomCraftUI
@JvmOverloads() final static Unit setUseCustomCraftUI(Boolean v)
Sets 'Custom Craft UI open' enables or not.
- Parameters:
v- Enable or not- Since:
5.0.13-1
-
setBaseBlockSideSize
@JvmOverloads() final static Boolean setBaseBlockSideSize(Integer size, Boolean calledAsync)
Sets base block's side size.
Default size = 3.
-
setBaseBlockSideSize
@JvmOverloads() final static Boolean setBaseBlockSideSize(Integer size)
Sets base block's side size.
Default size = 3.
-
getBaseBlockSideSize
final static Integer getBaseBlockSideSize()
Gets the base block's side size.
- Returns:
Int current side size
-
getCraftUIDesigner
final static CraftUIDesigner getCraftUIDesigner()
Returns a current CraftUI designer.
- Returns:
- Since:
5.0.16
-
setCraftUIDesigner
@JvmOverloads() final static Unit setCraftUIDesigner(CraftUIDesigner designer, Boolean calledAsync)
Sets a new CraftUI designer if a specified is valid.
- Parameters:
designer- New CraftUI designercalledAsync- Called from async processing or not.- Since:
5.0.16
-
setCraftUIDesigner
@JvmOverloads() final static Unit setCraftUIDesigner(CraftUIDesigner designer)
Sets a new CraftUI designer if a specified is valid.
- Parameters:
designer- New CraftUI designer- Since:
5.0.16
-
getRegisteredRecipeNames
final static Set<String> getRegisteredRecipeNames()
Returns a set of all registered recipe names.
- Returns:
Set set of registered recipe names (
Set<String>)- Since:
5.2.0
-
getRegisteredRecipeFromName
final static List<CRecipe> getRegisteredRecipeFromName(Function1<String, Boolean> filter)
Returns registered recipes whose names satisfy the given filter predicate.
- Parameters:
filter- Predicate applied to each recipe name; matching recipes are included- Returns:
List list of matched recipes (
List<CRecipe>)- Since:
5.2.0
-
getRegisteredRecipeFromName
final static List<CRecipe> getRegisteredRecipeFromName(String recipeName)
Returns registered recipes whose names exactly match the given string.
- Parameters:
recipeName- Exact recipe name to search for- Returns:
List list of matched recipes (
List<CRecipe>)- Since:
5.2.0
-
getRegisteredRecipeFromPlugin
final static List<CRecipe> getRegisteredRecipeFromPlugin(JavaPlugin plugin)
Returns recipes that are registered by given plugin instance.
- Parameters:
plugin- Search plugin instance- Returns:
List list of matched recipes (
List<CRecipe>)- Since:
5.2.0
-
getRecipeNameStrictLevel
final static CustomCrafterAPI.NameStrictLevel getRecipeNameStrictLevel()
Returns current recipe-name-strict-level
- Returns:
NameStrictLevel current level
- Since:
5.2.0
-
setRecipeNameStrictLevel
@JvmOverloads() final static Unit setRecipeNameStrictLevel(CustomCrafterAPI.NameStrictLevel level, Boolean calledAsync)
Sets the recipe name strict level.
The level can only change in the stricter direction; loosening is not permitted.
- Parameters:
level- Target strict level to applycalledAsync- Called from async processing or not.- Since:
5.2.0
-
setRecipeNameStrictLevel
@JvmOverloads() final static Unit setRecipeNameStrictLevel(CustomCrafterAPI.NameStrictLevel level)
Sets the recipe name strict level.
The level can only change in the stricter direction; loosening is not permitted.
- Parameters:
level- Target strict level to apply- Since:
5.2.0
-
getRecipes
final static List<CRecipe> getRecipes()
Returns an immutable list of all registered recipes.
The returned list cannot be modified.
-
registerRecipe
@JvmOverloads() final static Unit registerRecipe(List<CRecipe> recipes, JavaPlugin plugin, Boolean calledAsync)
Registers the provided recipes and fires RegisterCustomRecipeEvent.
- Parameters:
recipes- Recipes to registerplugin- Plugin instance registering the recipescalledAsync- Called from async processing or not.
-
registerRecipe
@JvmOverloads() final static Unit registerRecipe(List<CRecipe> recipes, JavaPlugin plugin)
Registers the provided recipes and fires RegisterCustomRecipeEvent.
- Parameters:
recipes- Recipes to registerplugin- Plugin instance registering the recipes
-
registerRecipe
@JvmOverloads() final static Unit registerRecipe(List<CRecipe> recipes)
Registers the provided recipes and fires RegisterCustomRecipeEvent.
- Parameters:
recipes- Recipes to register
-
unregisterRecipe
@JvmOverloads() final static Unit unregisterRecipe(String name, JavaPlugin plugin, Boolean calledAsync)
Unregisters recipes that match the specified conditions.
If both name and plugin are
null, all registered recipes are unregistered.- Parameters:
name- Target recipe name to filter by.plugin- Plugin instance to filter by registering plugin.calledAsync- Called from async processing or not.
-
unregisterRecipe
@JvmOverloads() final static Unit unregisterRecipe(String name, JavaPlugin plugin)
Unregisters recipes that match the specified conditions.
If both name and plugin are
null, all registered recipes are unregistered.- Parameters:
name- Target recipe name to filter by.plugin- Plugin instance to filter by registering plugin.
-
unregisterRecipe
@JvmOverloads() final static Unit unregisterRecipe(String name)
Unregisters recipes that match the specified conditions.
If both name and plugin are
null, all registered recipes are unregistered.- Parameters:
name- Target recipe name to filter by.
-
unregisterRecipe
@JvmOverloads() final static Unit unregisterRecipe()
Unregisters recipes that match the specified conditions.
If both name and plugin are
null, all registered recipes are unregistered.
-
unregisterAllRecipes
final static Unit unregisterAllRecipes(Boolean calledAsync)
Unregisters all registered recipes.
- Parameters:
calledAsync- Called from async processing or not.- Since:
5.0.16
-
getAllCandidateUIDesigner
final static AllCandidateUIDesigner getAllCandidateUIDesigner()
Returns current AllCandidateUIDesigner
- Returns:
AllCandidateUIDesigner current designer
- Since:
5.2.0
-
setAllCandidateUIDesigner
final static Unit setAllCandidateUIDesigner(AllCandidateUIDesigner designer)
Sets the AllCandidateUIDesigner.
Throws an exception if the AllCandidateUIDesigner.Baked produced by calling AllCandidateUIDesigner.bakeWithEmptyContext on designer fails AllCandidateUIDesigner.Baked.isValid.
- Parameters:
designer- The new designer to set- Since:
5.2.0
-
getVERSION_TYPE
final CustomCrafterAPI.VersionType getVERSION_TYPE()
Release stage of the Custom Crafter API.
- Since:
5.2.0
-
-
-
-