Class NumberInputElement

java.lang.Object
net.chen.legacyLand.gui.elements.NumberInputElement
All Implemented Interfaces:
GuiElement

public class NumberInputElement extends Object implements GuiElement
数字输入元素 使用 Paper Dialog API 实现数字输入
  • Constructor Details

    • NumberInputElement

      public NumberInputElement(String id, String displayName, String prompt)
  • Method Details

    • defaultValue

      public NumberInputElement defaultValue(double defaultValue)
    • minValue

      public NumberInputElement minValue(double minValue)
    • maxValue

      public NumberInputElement maxValue(double maxValue)
    • integerOnly

      public NumberInputElement integerOnly(boolean integerOnly)
    • icon

      public NumberInputElement icon(org.bukkit.Material icon)
    • lore

      public NumberInputElement lore(String... lines)
    • render

      public org.bukkit.inventory.ItemStack render(GuiSession session)
      Description copied from interface: GuiElement
      渲染元素为物品堆
      Specified by:
      render in interface GuiElement
      Parameters:
      session - 当前会话(包含玩家信息)
      Returns:
      渲染后的物品堆
    • validate

      public boolean validate(org.bukkit.entity.Player player)
      Description copied from interface: GuiElement
      验证元素的当前值
      Specified by:
      validate in interface GuiElement
      Parameters:
      player - 目标玩家
      Returns:
      是否通过验证
    • setSlot

      public void setSlot(int slot)
      Description copied from interface: GuiElement
      设置元素的槽位位置
      Specified by:
      setSlot in interface GuiElement
      Parameters:
      slot - 槽位索引
    • getSlot

      public int getSlot()
      Description copied from interface: GuiElement
      获取元素的槽位位置
      Specified by:
      getSlot in interface GuiElement
      Returns:
      槽位索引(-1 表示自动分配)
    • setValue

      public void setValue(Object value)
      设置元素的值
      Specified by:
      setValue in interface GuiElement
      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:
      onClick in interface GuiElement
      Parameters:
      player - 点击的玩家
      session - 当前会话
      clickType - 点击类型
    • validate

      public boolean validate()
    • isClickable

      public boolean isClickable()
      Description copied from interface: GuiElement
      检查元素是否可点击
      Specified by:
      isClickable in interface GuiElement
      Returns:
      是否可点击