Class PageRequest
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.pagination.source.PageRequest
Immutable description of one page load issued by a paginator; safe to share across threads.
offset and pageSize are the authoritative query
bounds — a backing store should fetch with LIMIT pageSize OFFSET offset.
page is informational only: scroll paginators advance one element per page, so
deriving the offset as (page - 1) * pageSize is wrong for them.
playerId identifies who the page is loaded for and plugin owns the load.
viewer is the live Player the settle dispatcher uses to route the settle to
the viewer's region thread (Folia) or the main thread (legacy). All three are null
only for engine-external test usage — requests dispatched by the built-in paginators always
populate them.
-
Constructor Summary
ConstructorsConstructorDescriptionPageRequest(int page, int pageSize, int offset, @Nullable UUID playerId, @Nullable org.bukkit.plugin.Plugin plugin, @Nullable org.bukkit.entity.Player viewer) Creates a page request. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the global element offset of the first item on the requested page — together withgetPageSize()the authoritative query bound:LIMIT pageSize OFFSET offset.intgetPage()Returns the 1-indexed page being requested.intReturns the maximum number of items the requested page can display.@Nullable UUIDplayerId()Returns the unique id of the player the page is being loaded for.@Nullable org.bukkit.plugin.Pluginplugin()Returns the plugin that owns the load.@Nullable org.bukkit.entity.Playerviewer()Returns the live viewer the settle dispatcher uses to route the settle to the correct region thread.
-
Constructor Details
-
PageRequest
public PageRequest(int page, int pageSize, int offset, @Nullable @Nullable UUID playerId, @Nullable @Nullable org.bukkit.plugin.Plugin plugin, @Nullable @Nullable org.bukkit.entity.Player viewer) Creates a page request.- Parameters:
page- the 1-indexed page being requested; informational onlypageSize- the maximum number of items the requested page can displayoffset- the global element offset of the first item on the requested pageplayerId- the player the page is being loaded for, ornullonly for engine-external test usageplugin- the plugin owning the load, ornullonly for engine-external test usageviewer- the livePlayerthe settle dispatcher routes the settle for;nullonly for engine-external test usage, in which case the settle runs inline on the completing thread
-
-
Method Details
-
getPage
public int getPage()Returns the 1-indexed page being requested. Informational only — scroll paginators slide one element per page, so the offset must never be derived from it.- Returns:
- the 1-indexed page
-
getPageSize
public int getPageSize()Returns the maximum number of items the requested page can display.- Returns:
- the page size
-
getOffset
public int getOffset()Returns the global element offset of the first item on the requested page — together withgetPageSize()the authoritative query bound:LIMIT pageSize OFFSET offset.- Returns:
- the element offset
-
playerId
Returns the unique id of the player the page is being loaded for.- Returns:
- the player id, or
nullonly for engine-external test usage
-
plugin
@Nullable public @Nullable org.bukkit.plugin.Plugin plugin()Returns the plugin that owns the load. Informational: the built-inBukkitSettleDispatcherroutes settles byviewer()via the platform scheduler and does not use this; a customSettleDispatchermay use it.- Returns:
- the owning plugin, or
nullonly for engine-external test usage
-
viewer
@Nullable public @Nullable org.bukkit.entity.Player viewer()Returns the live viewer the settle dispatcher uses to route the settle to the correct region thread. On Folia each player's inventory is owned by the region containing the player; the settle must run on that region's thread. On legacy Spigot/Paper the dispatcher falls back to the main thread.- Returns:
- the viewing player, or
nullonly for engine-external test usage (in which case the settle runs inline on the completing thread)
-