ServerPlayer
Link to serverplayer
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.entity.type.player.ServerPlayer;
Extending Player
Link to extending-player
ServerPlayer extends Player. That means all methods available in Player are also available in ServerPlayer
使用方式
Link to 使用方式
Name: getPersistentData
Gets the persistent NBT data for this player.
Persistent data is kept through deaths
Returns: The persistent data for this Entity.
Return Type: MapData
ZenScript Copy// ServerPlayer.getPersistentData() as MapData
myServerPlayer.getPersistentData();
Name: updatePersistentData
Updates the persistent NBT data for this player.
Persistent data is kept through deaths
ZenScript Copy// ServerPlayer.updatePersistentData(data as MapData)
myServerPlayer.updatePersistentData({custom: "data"});
参数 | 类型 | 描述 |
---|---|---|
参数 data | 类型 MapData #地图数据 | 描述 The custom data to store. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 persistentData | 类型 MapData #地图数据 | 可获得 true | 可设置 false | 描述 Gets the persistent NBT data for this player. Persistent data is kept through deaths |