Class PlanetRecipes

java.lang.Object
ua.mcchickenstudio.opencreative.planets.PlanetRecipes

public class PlanetRecipes extends Object

PlanetRecipes

This class represents planet's recipes registry, that has methods to register and unregister recipe.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlanetRecipes(@NotNull Planet planet)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.Recipe recipe)
    Registers recipe, or replaces old one with specified new.
    void
    Removes all recipes and destroys them.
    void
    clearForPlayer(@NotNull org.bukkit.entity.Player player)
    Removes all recipes from player.
    int
    Returns amount of all recipes.
    @NotNull String
    getFullKey(@NotNull String name)
    Returns full namespaced key for recipe with specified name.
    @Nullable org.bukkit.NamespacedKey
    getRecipe(@NotNull String name)
    Returns recipe's namespaced key.
    void
    removeRecipe(@NotNull String name)
    Unregisters recipe from registry and removes it from players.
    void
    removeRecipe(@NotNull org.bukkit.NamespacedKey recipe)
    Unregisters recipe from registry and takes it from players.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlanetRecipes

      public PlanetRecipes(@NotNull @NotNull Planet planet)
  • Method Details

    • addRecipe

      public void addRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.Recipe recipe)
      Registers recipe, or replaces old one with specified new.
      Parameters:
      key - key of recipe (must start with "oc_recipe_WORLDID").
      recipe - recipe to register.
    • removeRecipe

      public void removeRecipe(@NotNull @NotNull String name)
      Unregisters recipe from registry and removes it from players.
      Parameters:
      name - name of recipe.
    • removeRecipe

      public void removeRecipe(@NotNull @NotNull org.bukkit.NamespacedKey recipe)
      Unregisters recipe from registry and takes it from players.
      Parameters:
      recipe - namespaced key of recipe.
    • getRecipe

      @Nullable public @Nullable org.bukkit.NamespacedKey getRecipe(@NotNull @NotNull String name)
      Returns recipe's namespaced key.
      Parameters:
      name - name of recipe.
      Returns:
      recipe's namespaced key, or null - if not found.
    • clear

      public void clear()
      Removes all recipes and destroys them.
    • clearForPlayer

      public void clearForPlayer(@NotNull @NotNull org.bukkit.entity.Player player)
      Removes all recipes from player.
      Parameters:
      player - player to remove recipes.
    • getAmount

      public int getAmount()
      Returns amount of all recipes.
      Returns:
      amount of recipes.
    • getFullKey

      @NotNull public @NotNull String getFullKey(@NotNull @NotNull String name)
      Returns full namespaced key for recipe with specified name.
      Parameters:
      name - name of recipe.
      Returns:
      namespaced key ("oc_recipe_PLANETID_NAME")