Package com.marcusslover.plus.lib.item
Class Canvas.PopulatorContext<T>
java.lang.Object
com.marcusslover.plus.lib.item.Canvas.PopulatorContext<T>
- Type Parameters:
T- the type of the elements
- Enclosing class:
Canvas
Represents the context of the population.
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 TypeMethodDescription@NotNull Canvas.PopulatorContext<T> content(@NotNull org.bukkit.entity.Player player, @NotNull Canvas.PopulatorContext.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.PopulatorContext.Populator<?> populator) @NotNull Canvas.PopulatorContext<T> viewStrategy(@Nullable Canvas.PopulatorContext.DefaultViewStrategy defaultViewStrategy) Set the view strategy.@NotNull Canvas.PopulatorContext<T> viewStrategy(@Nullable Canvas.PopulatorContext.ViewStrategy viewStrategy) Set the view strategy.
-
Constructor Details
-
PopulatorContext
public PopulatorContext()
-
-
Method Details
-
viewStrategy
@NotNull public @NotNull Canvas.PopulatorContext<T> viewStrategy(@Nullable @Nullable Canvas.PopulatorContext.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 @NotNull Canvas.PopulatorContext<T> viewStrategy(@Nullable @Nullable Canvas.PopulatorContext.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.PopulatorContext.Populator<?> populator) -
content
@NotNull public @NotNull Canvas.PopulatorContext<T> content(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Canvas.PopulatorContext.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
-