Class XVersionUtils

java.lang.Object
com.ultikits.ultitools.utils.XVersionUtils

public final class XVersionUtils extends Object
Cross-version compatibility utility class using XSeries. Replaces the old VersionWrapper dynamic loading mechanism. Minimum supported version: 1.13+

使用 XSeries 实现跨版本兼容的工具类。 替代旧的 VersionWrapper 动态加载机制。 最低支持版本: 1.13+

Since:
6.2.0
Author:
wisdomme
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    getBed(Colors bedColor)
    Get colored bed.
    static org.bukkit.block.BlockFace
    getBlockFace(org.bukkit.block.Block placedBlock)
    Get block face direction.
    static org.bukkit.inventory.ItemStack
    Get colored stained glass pane.
    static org.bukkit.inventory.ItemStack
    Get colored wool.
    static org.bukkit.inventory.ItemStack
    getEmailMaterial(boolean isRead)
    Get email material (paper for unread, filled map for read).
    static org.bukkit.inventory.ItemStack
    Get ender eye.
    static org.bukkit.inventory.ItemStack
    Get grass block.
    static org.bukkit.inventory.ItemStack
    getHead(org.bukkit.OfflinePlayer player)
    Get player head.
    static int
    getItemDurability(org.bukkit.inventory.ItemStack itemStack)
    Get item durability.
    static org.bukkit.inventory.ItemStack
    getItemInHand(org.bukkit.entity.Player player, boolean isMainHand)
    Get item in player's hand.
    static org.bukkit.inventory.ItemStack
    Get oak sign.
    static org.bukkit.Sound
    Get sound using XSound for cross-version compatibility.
    static org.bukkit.scoreboard.Objective
    registerNewObjective(org.bukkit.scoreboard.Scoreboard scoreboard, String name, String criteria, String displayName)
    Register a new scoreboard objective.
    static void
    sendActionBar(org.bukkit.entity.Player player, String message)
    Send action bar message to player.
    static void
    sendPlayerList(org.bukkit.entity.Player player, String header, String footer)
    Set player list header and footer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XVersionUtils

      private XVersionUtils()
  • Method Details

    • getColoredPlaneGlass

      public static org.bukkit.inventory.ItemStack getColoredPlaneGlass(Colors color)
      Get colored stained glass pane.

      获取彩色玻璃板

      Parameters:
      color - the color
      Returns:
      colored glass pane ItemStack
    • getColoredWool

      public static org.bukkit.inventory.ItemStack getColoredWool(Colors color)
      Get colored wool.

      获取彩色羊毛

      Parameters:
      color - the color
      Returns:
      colored wool ItemStack
    • getSign

      public static org.bukkit.inventory.ItemStack getSign()
      Get oak sign.

      获取告示牌

      Returns:
      sign ItemStack
    • getEndEye

      public static org.bukkit.inventory.ItemStack getEndEye()
      Get ender eye.

      获取末影之眼

      Returns:
      ender eye ItemStack
    • getEmailMaterial

      public static org.bukkit.inventory.ItemStack getEmailMaterial(boolean isRead)
      Get email material (paper for unread, filled map for read).

      获取邮件材质(未读为纸,已读为填充地图)

      Parameters:
      isRead - whether the email is read
      Returns:
      email material ItemStack
    • getHead

      public static org.bukkit.inventory.ItemStack getHead(org.bukkit.OfflinePlayer player)
      Get player head.

      获取玩家头颅

      Parameters:
      player - the player
      Returns:
      player head ItemStack
    • getGrassBlock

      public static org.bukkit.inventory.ItemStack getGrassBlock()
      Get grass block.

      获取草方块

      Returns:
      grass block ItemStack
    • registerNewObjective

      public static org.bukkit.scoreboard.Objective registerNewObjective(org.bukkit.scoreboard.Scoreboard scoreboard, String name, String criteria, String displayName)
      Register a new scoreboard objective.

      注册计分板对象

      Parameters:
      scoreboard - the scoreboard
      name - objective name
      criteria - criteria string
      displayName - display name
      Returns:
      the objective
    • getSound

      public static org.bukkit.Sound getSound(Sounds sound)
      Get sound using XSound for cross-version compatibility.

      使用 XSound 获取跨版本兼容的声音

      Parameters:
      sound - the sound enum
      Returns:
      the bukkit Sound, or null if not found
    • getBed

      public static org.bukkit.inventory.ItemStack getBed(Colors bedColor)
      Get colored bed.

      获取彩色床

      Parameters:
      bedColor - the bed color
      Returns:
      bed ItemStack
    • getItemDurability

      public static int getItemDurability(org.bukkit.inventory.ItemStack itemStack)
      Get item durability.

      获取物品耐久度

      Parameters:
      itemStack - the item
      Returns:
      remaining durability
    • getItemInHand

      public static org.bukkit.inventory.ItemStack getItemInHand(org.bukkit.entity.Player player, boolean isMainHand)
      Get item in player's hand.

      获取玩家手中的物品

      Parameters:
      player - the player
      isMainHand - whether to get main hand item
      Returns:
      item in hand
    • sendActionBar

      public static void sendActionBar(org.bukkit.entity.Player player, String message)
      Send action bar message to player.

      给玩家发送 Action Bar 消息

      Parameters:
      player - the player
      message - the message
    • sendPlayerList

      public static void sendPlayerList(org.bukkit.entity.Player player, String header, String footer)
      Set player list header and footer.

      设置玩家列表页眉页脚

      Parameters:
      player - the player
      header - header text
      footer - footer text
    • getBlockFace

      public static org.bukkit.block.BlockFace getBlockFace(org.bukkit.block.Block placedBlock)
      Get block face direction.

      获取方块朝向

      Parameters:
      placedBlock - the placed block
      Returns:
      the block face