Class FlexItemGroup
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.ItemGroup
io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup
- All Implemented Interfaces:
Keyed
- Direct Known Subclasses:
NestedItemGroup
A
FlexItemGroup
is a ItemGroup
inside the SlimefunGuide
that can
be completely modified.
It cannot hold any SlimefunItem
but can be completely overridden
to perform any action upon being opened.- Author:
- TheBusyBiscuit
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
FlexItemGroup
(NamespacedKey key, ItemStack item) protected
FlexItemGroup
(NamespacedKey key, ItemStack item, int tier) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
add
(SlimefunItem item) Adds the givenSlimefunItem
to thisItemGroup
.final boolean
contains
(SlimefunItem item) This method returns whether a givenSlimefunItem
exists in thisItemGroup
.final List<SlimefunItem>
getItems()
Returns all instances ofSlimefunItem
bound to thisItemGroup
.final boolean
abstract boolean
isVisible
(Player p, PlayerProfile profile, SlimefunGuideMode layout) This method returns whether thisFlexItemGroup
is visible under the given context.abstract void
open
(Player p, PlayerProfile profile, SlimefunGuideMode layout) This method is called when aPlayer
opens thisFlexItemGroup
.final void
remove
(SlimefunItem item) Removes the givenSlimefunItem
from thisItemGroup
.Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.ItemGroup
equals, getAddon, getDisplayName, getItem, getKey, getTier, getUnlocalizedName, hashCode, isAccessible, isCrossAddonItemGroup, isHidden, isRegistered, register, setCrossAddonItemGroup, setTier, toString
-
Constructor Details
-
FlexItemGroup
-
FlexItemGroup
-
-
Method Details
-
isVisible
Description copied from class:ItemGroup
This method returns whether thisItemGroup
can be viewed by the givenPlayer
. EmptyItemGroups
will not be visible. This includesItemGroups
where everySlimefunItem
is disabled. If anItemGroup
is not accessible by thePlayer
, seeItemGroup.isAccessible(Player)
, this method will also return false. -
isVisible
@ParametersAreNonnullByDefault public abstract boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideMode layout) This method returns whether thisFlexItemGroup
is visible under the given context. Implementing this method gives full flexibility over who can see the ItemGroup when and where.- Parameters:
p
- ThePlayer
who opened hisSlimefunGuide
profile
- ThePlayerProfile
of thePlayer
layout
- TheSlimefunGuideMode
in which thisFlexItemGroup
is viewed- Returns:
- Whether to display this
FlexItemGroup
-
open
This method is called when aPlayer
opens thisFlexItemGroup
. This is an abstract method which needs to be implemented in order to determine what thisFlexItemGroup
should actually do as it cannot hold any items.- Parameters:
p
- ThePlayer
who wants to open thisFlexItemGroup
profile
- The correspondingPlayerProfile
for thatPlayer
layout
- The currentSlimefunGuideMode
-
add
Description copied from class:ItemGroup
Adds the givenSlimefunItem
to thisItemGroup
.- Overrides:
add
in classItemGroup
- Parameters:
item
- theSlimefunItem
that should be added to thisItemGroup
-
getItems
Description copied from class:ItemGroup
Returns all instances ofSlimefunItem
bound to thisItemGroup
. -
contains
Description copied from class:ItemGroup
This method returns whether a givenSlimefunItem
exists in thisItemGroup
.- Overrides:
contains
in classItemGroup
- Parameters:
item
- TheSlimefunItem
to find- Returns:
- Whether the given
SlimefunItem
was found in thisItemGroup
-
remove
Description copied from class:ItemGroup
Removes the givenSlimefunItem
from thisItemGroup
.- Overrides:
remove
in classItemGroup
- Parameters:
item
- theSlimefunItem
that should be removed from thisItemGroup
-