Object PlayerUtils

  • All Implemented Interfaces:

    
    public class PlayerUtils
    
                        

    玩家相关工具类

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static PlayerUtils INSTANCE
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • giveItem

         final static Unit giveItem(Player $self, ItemStack itemStack)

        给予玩家物品.

        Parameters:
        itemStack - 待给予物品
      • giveItem

         final static Unit giveItem(Player $self, ItemStack itemStack, Integer repeat)

        重复给予玩家物品一定次数.

        Parameters:
        itemStack - 待给予物品
        repeat - 重复次数
      • giveItems

         final static Unit giveItems(Player $self, ItemStack itemStack, Integer amount)

        给予玩家一定数量的物品.

        Parameters:
        itemStack - 待给予物品
        amount - 给予数量
      • hasMetadataEZ

         final static Boolean hasMetadataEZ(Player $self, String key)

        检测是否存在对应Metadata.

        Parameters:
        key - Metadata键
        Returns:

        Metadata值

      • getMetadataEZ

         final static Object getMetadataEZ(Player $self, String key, Object def)

        获取Metadata, 不含对应Metadata将返回默认值.

        Parameters:
        key - Metadata键
        def - 默认值
        Returns:

        Metadata值

      • getMetadataEZ

         final static Object getMetadataEZ(Metadatable $self, String key, Object def)

        获取Metadata, 不含对应Metadata将返回默认值.

        Parameters:
        key - Metadata键
        def - 默认值
        Returns:

        Metadata值

      • setMetadataEZ

         final static Unit setMetadataEZ(Player $self, String key, Object value)

        设置Metadata.

        Parameters:
        key - Metadata键
        value - Metadata值
      • setMetadataEZ

         final static Unit setMetadataEZ(Metadatable $self, String key, Object value)

        设置Metadata.

        Parameters:
        key - Metadata键
        value - Metadata值
      • sendMessage

         final static Unit sendMessage(Player $self, ComponentBuilder builder)

        向玩家发送聊天栏消息.

        Parameters:
        builder - 待发送消息
      • sendActionBar

         final static Unit sendActionBar(Player $self, String message)

        向玩家发送动作栏消息.

        Parameters:
        message - 待发送消息
      • checkCooldown

         final static Long checkCooldown(Player $self, String key, Long cooldown)

        检测冷却状态. 冷却完成则重新设置冷却并返回0. 冷却未完成则返回剩余时间.

        Parameters:
        key - 冷却组ID
        cooldown - 冷却刷新时间
        Returns:

        剩余冷却时间

      • getCooldown

         final static Long getCooldown(Player $self, String key)

        返回剩余冷却时间.

        Parameters:
        key - 冷却组ID
        Returns:

        剩余冷却时间

      • setCooldown

         final static Unit setCooldown(Player $self, String key, Long cooldown)

        设置进入冷却状态.

        Parameters:
        key - 冷却组ID
        cooldown - 冷却刷新时间