Package pers.neige.neigeitems.utils
Object PlayerUtils
-
- All Implemented Interfaces:
public class PlayerUtils
玩家相关工具类
-
-
Field Summary
Fields Modifier and Type Field Description public final static PlayerUtils
INSTANCE
-
Method Summary
Modifier and Type Method Description final static Unit
giveItem(Player $self, ItemStack itemStack)
给予玩家物品. final static Unit
giveItem(Player $self, ItemStack itemStack, Integer repeat)
重复给予玩家物品一定次数. final static Unit
giveItems(Player $self, ItemStack itemStack, Integer amount)
给予玩家一定数量的物品. final static Boolean
hasMetadataEZ(Player $self, String key)
检测是否存在对应Metadata. final static Object
getMetadataEZ(Player $self, String key, Object def)
获取Metadata, 不含对应Metadata将返回默认值. final static Object
getMetadataEZ(Metadatable $self, String key, Object def)
获取Metadata, 不含对应Metadata将返回默认值. final static Unit
setMetadataEZ(Player $self, String key, Object value)
设置Metadata. final static Unit
setMetadataEZ(Metadatable $self, String key, Object value)
设置Metadata. final static Unit
sendMessage(Player $self, ComponentBuilder builder)
向玩家发送聊天栏消息. final static Unit
sendActionBar(Player $self, String message)
向玩家发送动作栏消息. final static Long
checkCooldown(Player $self, String key, Long cooldown)
检测冷却状态. final static Long
getCooldown(Player $self, String key)
返回剩余冷却时间. final static Unit
setCooldown(Player $self, String key, Long cooldown)
设置进入冷却状态. final static Map<String, Integer>
countInventoryNiItems(Player $self)
获取玩家背包内的所有NI物品数量. -
-
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
- 冷却组IDcooldown
- 冷却刷新时间- 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
- 冷却组IDcooldown
- 冷却刷新时间
-
countInventoryNiItems
final static Map<String, Integer> countInventoryNiItems(Player $self)
获取玩家背包内的所有NI物品数量.
-
-
-
-