Enum Class ItemsGroup

java.lang.Object
java.lang.Enum<ItemsGroup>
ua.mcchickenstudio.opencreative.settings.items.ItemsGroup
All Implemented Interfaces:
Serializable, Comparable<ItemsGroup>, Constable

public enum ItemsGroup extends Enum<ItemsGroup>

ItemsGroup

This enum represents OpenCreative+ items, that will be given on some player actions: joining the lobby, connecting to world, entering the coding world.

Groups (or kits) contain default item pairs (slots and items), but they can be overridden by changing settings in config.

To set player's inventory to items from group, use setItems(Player) method.

  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Items, that will be given, when world's owner enters build mode.
    Coding blocks and other coding items, that will be given, when world's developer enters the coding world.
    Coding blocks and other coding items, that will be given, when world's owner enters the coding world.
    Lobby items, that will be given, when player joins the lobby.
    Items, that will be given, when world's owner enters play mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable ItemsGroup
    getById(@NotNull String id)
    Returns items group by text.
    @NotNull List<org.bukkit.inventory.ItemStack>
    getItems(@NotNull org.bukkit.entity.Player player)
    Returns list of items, created for player to give manually.
    @NotNull List<ItemPair>
    Returns list of pairs with slots and items.
    boolean
    giveItem(@NotNull org.bukkit.entity.Player player, int slot)
    Gives player an item, that was got from items group.
    void
    removeItems(@NotNull org.bukkit.entity.Player player)
    Removes items from player inventory, if player has them.
    void
    setItems(@NotNull org.bukkit.entity.Player player)
    Sets items in player inventory.
    void
    setItemsIfAbsent(@NotNull org.bukkit.entity.Player player)
    Sets items in player inventory, if player doesn't have them.
    static ItemsGroup
    Returns the enum constant of this class with the specified name.
    static ItemsGroup[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • LOBBY

      public static final ItemsGroup LOBBY
      Lobby items, that will be given, when player joins the lobby. Should contain world browsers items.
    • BUILD_OWNER

      public static final ItemsGroup BUILD_OWNER
      Items, that will be given, when world's owner enters build mode. Should contain world settings item and maybe some build tools?
    • PLAY_OWNER

      public static final ItemsGroup PLAY_OWNER
      Items, that will be given, when world's owner enters play mode.
    • CODING

      public static final ItemsGroup CODING
      Coding blocks and other coding items, that will be given, when world's developer enters the coding world.
    • CODING_OWNER

      public static final ItemsGroup CODING_OWNER
      Coding blocks and other coding items, that will be given, when world's owner enters the coding world. Should contain world settings item.
  • Method Details

    • values

      public static ItemsGroup[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ItemsGroup valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getById

      @Nullable public static @Nullable ItemsGroup getById(@NotNull @NotNull String id)
      Returns items group by text.
      Parameters:
      id - id to get items group.
      Returns:
      items group, or null - if not exists.
    • getPairs

      @NotNull public @NotNull List<ItemPair> getPairs()
      Returns list of pairs with slots and items.
      Returns:
      pairs of items.
    • getItems

      @NotNull public @NotNull List<org.bukkit.inventory.ItemStack> getItems(@NotNull @NotNull org.bukkit.entity.Player player)
      Returns list of items, created for player to give manually. Empty items are not included.
      Parameters:
      player - player to get items.
      Returns:
      list of items.
    • setItems

      public void setItems(@NotNull @NotNull org.bukkit.entity.Player player)
      Sets items in player inventory.

      Recommended to clear player's inventory before doing this.

      Parameters:
      player - player to set items.
    • setItemsIfAbsent

      public void setItemsIfAbsent(@NotNull @NotNull org.bukkit.entity.Player player)
      Sets items in player inventory, if player doesn't have them.

      Recommended to clear player's inventory before doing this.

      Parameters:
      player - player to set items.
    • removeItems

      public void removeItems(@NotNull @NotNull org.bukkit.entity.Player player)
      Removes items from player inventory, if player has them.
      Parameters:
      player - player to remove items.
    • giveItem

      public boolean giveItem(@NotNull @NotNull org.bukkit.entity.Player player, int slot)
      Gives player an item, that was got from items group.
      Parameters:
      player - player to give item.
      slot - slot of item.
      Returns:
      true - if given, false - if item not exists by slot.