Package com.marcusslover.plus.lib.item
Class Canvas.BasicPopulator<T>
java.lang.Object
com.marcusslover.plus.lib.item.Canvas.BasicPopulator<T>
- Type Parameters:
T- the type of the elements
- Enclosing class:
Canvas
A basic populator implementation.
It holds the elements and the canvas.
It also holds the view strategy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefault view strategies.static interfacePopulates one element and provides the player with the button.static interfaceHolds the strategy on how to populate the elements on the canvas. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontent(@NotNull org.bukkit.entity.Player player, @NotNull Canvas.BasicPopulator.Populator<T> populator) Modify how the elements are populated on the canvas.@NotNull Canvasend()Return to the canvas.voidupdateContent(@NotNull org.bukkit.entity.Player player, Canvas.BasicPopulator.Populator<?> populator) viewStrategy(@Nullable Canvas.BasicPopulator.DefaultViewStrategy defaultViewStrategy) Set the view strategy.viewStrategy(@Nullable Canvas.BasicPopulator.ViewStrategy viewStrategy) Set the view strategy.
-
Constructor Details
-
BasicPopulator
public BasicPopulator()
-
-
Method Details
-
viewStrategy
@NotNull public Canvas.BasicPopulator<T> viewStrategy(@Nullable @Nullable Canvas.BasicPopulator.DefaultViewStrategy defaultViewStrategy) Set the view strategy. Works only with the default view strategies.- Parameters:
defaultViewStrategy- the view strategy- Returns:
- the populator context
-
viewStrategy
@NotNull public Canvas.BasicPopulator<T> viewStrategy(@Nullable @Nullable Canvas.BasicPopulator.ViewStrategy viewStrategy) Set the view strategy.- Parameters:
viewStrategy- A custom view strategy.- Returns:
- The populator context.
-
updateContent
public void updateContent(@NotNull @NotNull org.bukkit.entity.Player player, Canvas.BasicPopulator.Populator<?> populator) -
content
@NotNull public Canvas.BasicPopulator<T> content(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Canvas.BasicPopulator.Populator<T> populator) Modify how the elements are populated on the canvas. The populator is called for each element. Additionally, add the page manipulation buttons.- Parameters:
player- the playerpopulator- the populator- Returns:
- the populator context
-
end
Return to the canvas.- Returns:
- the canvas
-