Class NumberInputElement
java.lang.Object
net.chen.legacyLand.gui.elements.NumberInputElement
- All Implemented Interfaces:
GuiElement
数字输入元素
使用 Paper Dialog API 实现数字输入
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefaultValue(double defaultValue) intgetSlot()获取元素的槽位位置icon(org.bukkit.Material icon) integerOnly(boolean integerOnly) boolean检查元素是否可点击maxValue(double maxValue) minValue(double minValue) voidonClick(org.bukkit.entity.Player player, GuiSession session, org.bukkit.event.inventory.ClickType clickType) 处理玩家点击事件org.bukkit.inventory.ItemStackrender(GuiSession session) 渲染元素为物品堆voidsetSlot(int slot) 设置元素的槽位位置void设置元素的值booleanvalidate()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
getDisplayName, getId, getValidator, getValue, isEnabled, isVisible
-
Constructor Details
-
NumberInputElement
-
-
Method Details
-
defaultValue
-
minValue
-
maxValue
-
integerOnly
-
icon
-
lore
-
render
Description copied from interface:GuiElement渲染元素为物品堆- Specified by:
renderin interfaceGuiElement- Parameters:
session- 当前会话(包含玩家信息)- Returns:
- 渲染后的物品堆
-
validate
public boolean validate(org.bukkit.entity.Player player) Description copied from interface:GuiElement验证元素的当前值- Specified by:
validatein interfaceGuiElement- Parameters:
player- 目标玩家- Returns:
- 是否通过验证
-
setSlot
public void setSlot(int slot) Description copied from interface:GuiElement设置元素的槽位位置- Specified by:
setSlotin interfaceGuiElement- Parameters:
slot- 槽位索引
-
getSlot
public int getSlot()Description copied from interface:GuiElement获取元素的槽位位置- Specified by:
getSlotin interfaceGuiElement- Returns:
- 槽位索引(-1 表示自动分配)
-
setValue
设置元素的值- Specified by:
setValuein interfaceGuiElement- Parameters:
value- 新值
-
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() -
isClickable
public boolean isClickable()Description copied from interface:GuiElement检查元素是否可点击- Specified by:
isClickablein interfaceGuiElement- Returns:
- 是否可点击
-