Class ListElement<T>
java.lang.Object
net.chen.legacyLand.gui.elements.ListElement<T>
- All Implemented Interfaces:
GuiElement
列表元素 - 带分页的单选列表
占用整个 Inventory(除底部导航行),每页最多 45 个选项
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription获取元素的显示名称getId()获取元素的唯一标识符intgetSlot()获取元素的槽位位置获取元素的验证器getValue()获取元素的当前值voidhandleInventoryClick(org.bukkit.entity.Player player, GuiSession session, int clickedSlot) 处理 Inventory 点击(由 GuiForm 路由)loreMapper(Function<T, List<String>> mapper) materialMapper(Function<T, org.bukkit.Material> mapper) nameMapper(Function<T, String> mapper) voidonClick(org.bukkit.entity.Player player, GuiSession session, org.bukkit.event.inventory.ClickType clickType) 处理玩家点击事件org.bukkit.inventory.ItemStackrender(GuiSession session) 渲染元素为物品堆voidrenderToInventory(org.bukkit.inventory.Inventory inventory) 将列表渲染到整个 Inventory(由 GuiForm 调用)voidsetSlot(int slot) 设置元素的槽位位置void设置元素的值booleanvalidate(org.bukkit.entity.Player player) 验证元素的当前值Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GuiElement
isClickable, isEnabled, isVisible
-
Constructor Details
-
ListElement
-
-
Method Details
-
nameMapper
-
loreMapper
-
materialMapper
-
onSelect
-
validator
-
getId
Description copied from interface:GuiElement获取元素的唯一标识符- Specified by:
getIdin interfaceGuiElement- Returns:
- 元素 ID
-
getDisplayName
Description copied from interface:GuiElement获取元素的显示名称- Specified by:
getDisplayNamein interfaceGuiElement- Returns:
- 显示名称
-
getSlot
public int getSlot()Description copied from interface:GuiElement获取元素的槽位位置- Specified by:
getSlotin interfaceGuiElement- Returns:
- 槽位索引(-1 表示自动分配)
-
setSlot
public void setSlot(int slot) Description copied from interface:GuiElement设置元素的槽位位置- Specified by:
setSlotin interfaceGuiElement- Parameters:
slot- 槽位索引
-
renderToInventory
public void renderToInventory(org.bukkit.inventory.Inventory inventory) 将列表渲染到整个 Inventory(由 GuiForm 调用) -
handleInventoryClick
public void handleInventoryClick(org.bukkit.entity.Player player, GuiSession session, int clickedSlot) 处理 Inventory 点击(由 GuiForm 路由) -
render
Description copied from interface:GuiElement渲染元素为物品堆- Specified by:
renderin interfaceGuiElement- Parameters:
session- 当前会话(包含玩家信息)- Returns:
- 渲染后的物品堆
-
onClick
public void onClick(org.bukkit.entity.Player player, GuiSession session, org.bukkit.event.inventory.ClickType clickType) Description copied from interface:GuiElement处理玩家点击事件- Specified by:
onClickin interfaceGuiElement- Parameters:
player- 点击的玩家session- 当前会话clickType- 点击类型
-
validate
public boolean validate(org.bukkit.entity.Player player) Description copied from interface:GuiElement验证元素的当前值- Specified by:
validatein interfaceGuiElement- Parameters:
player- 目标玩家- Returns:
- 是否通过验证
-
setValue
Description copied from interface:GuiElement设置元素的值- Specified by:
setValuein interfaceGuiElement- Parameters:
value- 新值
-
getValue
Description copied from interface:GuiElement获取元素的当前值- Specified by:
getValuein interfaceGuiElement- Returns:
- 当前值
-
getValidator
Description copied from interface:GuiElement获取元素的验证器- Specified by:
getValidatorin interfaceGuiElement- Returns:
- 验证器(可为 null)
-