Enum Class ItemsGroup
- All Implemented Interfaces:
Serializable, Comparable<ItemsGroup>, Constable
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 ConstantsEnum ConstantDescriptionItems, 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 TypeMethodDescriptionstatic @Nullable ItemsGroupReturns 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.getPairs()Returns list of pairs with slots and items.booleangiveItem(@NotNull org.bukkit.entity.Player player, int slot) Gives player an item, that was got from items group.voidremoveItems(@NotNull org.bukkit.entity.Player player) Removes items from player inventory, if player has them.voidsetItems(@NotNull org.bukkit.entity.Player player) Sets items in player inventory.voidsetItemsIfAbsent(@NotNull org.bukkit.entity.Player player) Sets items in player inventory, if player doesn't have them.static ItemsGroupReturns the enum constant of this class with the specified name.static ItemsGroup[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LOBBY
Lobby items, that will be given, when player joins the lobby. Should contain world browsers items. -
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
Items, that will be given, when world's owner enters play mode. -
CODING
Coding blocks and other coding items, that will be given, when world's developer enters the coding world. -
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
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
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 nameNullPointerException- if the argument is null
-
getById
Returns items group by text.- Parameters:
id- id to get items group.- Returns:
- items group, or null - if not exists.
-
getPairs
-
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.
-