public interface Player extends HumanEntity, Conversable, CommandSender, OfflinePlayer, PluginMessageRecipient
限定符和类型 | 方法和说明 |
---|---|
void |
awardAchievement(Achievement achievement)
已过时。
未来版本的Minecraft将不会有成就(取而代之的是进度).
|
boolean |
canSee(Player player)
检查该玩家是否能看到某玩家.
|
void |
chat(java.lang.String msg)
强制玩家发送一个聊天消息,或强制使用命令(需要在内容前加 "/").
|
void |
decrementStatistic(Statistic statistic)
把该玩家的统计信息里的某项-1.
|
void |
decrementStatistic(Statistic statistic,
EntityType entityType)
把该玩家的统计信息中跟实体有关的统计项中的某种实体(
EntityType )的数量-1. |
void |
decrementStatistic(Statistic statistic,
EntityType entityType,
int amount)
将该玩家的统计信息中某个跟实体有关的统计项中的某实体类型(
EntityType )减少指定的值. |
void |
decrementStatistic(Statistic statistic,
int amount)
把该玩家的统计信息里的某项减少指定的值.
|
void |
decrementStatistic(Statistic statistic,
Material material)
把该玩家的统计信息中跟方块/物品有关的统计项减少一个
Material . |
void |
decrementStatistic(Statistic statistic,
Material material,
int amount)
把该玩家的统计信息中跟方块/物品有关的统计项中的某
Material 减少指定的值. |
java.net.InetSocketAddress |
getAddress()
得到一个Address对象,包括这个玩家的IP以及登入端口.
|
AdvancementProgress |
getAdvancementProgress(Advancement advancement)
Return the player's progression on the specified advancement.
|
boolean |
getAllowFlight()
判断玩家是否能飞起来
译注:如果玩家确实在创造模式,那么一般返回true,除非被setAllowFlight(false);
原文:Determines if the Player is allowed to fly via jump key double-tap like
in creative mode.
|
Location |
getBedSpawnLocation()
得到玩家上一次睡觉的床的位置(
Location ). |
Location |
getCompassTarget()
得到玩家指南针的指向的位置(
Location ). |
java.lang.String |
getDisplayName()
获得玩家在聊天信息中的昵称.
|
float |
getExhaustion()
得到玩家的疲劳度.
|
float |
getExp()
得到当前级别升到下一级别经验进度的百分比.
|
float |
getFlySpeed()
得到该玩家飞行速度.
|
int |
getFoodLevel()
得到玩家的饥饿度(不是饱食度).
|
double |
getHealthScale()
获取客户端显示的血量的"压缩率".
|
int |
getLevel()
得到玩家的等级.
|
java.lang.String |
getLocale()
Gets the player's current locale.
|
java.lang.String |
getPlayerListName()
得到玩家显示在tab列表中的名称.
|
long |
getPlayerTime()
得到玩家的客户端的当前时间,单位为tick.
|
long |
getPlayerTimeOffset()
返回玩家的客户端的当前时间与玩家当前世界时间的差值.
|
WeatherType |
getPlayerWeather()
得到玩家所看到的天气.如果返回null,玩家的天气跟世界的天气一致.
|
float |
getSaturation()
得到玩家的饱食度(不是饥饿度).
|
Scoreboard |
getScoreboard()
获取玩家的计分板.
|
Entity |
getSpectatorTarget()
Gets the entity which is followed by the camera when in
GameMode.SPECTATOR . |
int |
getStatistic(Statistic statistic)
得到该玩家的统计信息中某项的值.
|
int |
getStatistic(Statistic statistic,
EntityType entityType)
获得该玩家的统计信息中跟实体有关的统计项中的某实体(
EntityType )数量. |
int |
getStatistic(Statistic statistic,
Material material)
获取该玩家的统计信息中跟方块/物品有关的统计项的某
Material 有多少. |
int |
getTotalExperience()
得到玩家总共获得了多少经验(等级和经验).
|
float |
getWalkSpeed()
得到行走速度.
|
void |
giveExp(int amount)
给玩家指定经验.
|
void |
giveExpLevels(int amount)
增加玩家的等级.
|
boolean |
hasAchievement(Achievement achievement)
判断玩家是否有该成就.
|
void |
hidePlayer(Player player)
已过时。
|
void |
hidePlayer(Plugin plugin,
Player player)
让该玩家看不见某玩家.
|
void |
incrementStatistic(Statistic statistic)
把该玩家的统计信息里的某项+1.
|
void |
incrementStatistic(Statistic statistic,
EntityType entityType)
把该玩家的统计信息中跟实体有关的统计项中的某种实体(
EntityType )的数量+1. |
void |
incrementStatistic(Statistic statistic,
EntityType entityType,
int amount)
将该玩家的统计信息中的某个跟实体有关的统计项的某实体类型(
EntityType )加上指定的数值. |
void |
incrementStatistic(Statistic statistic,
int amount)
把该玩家的统计信息里的某项加上指定的值.
|
void |
incrementStatistic(Statistic statistic,
Material material)
把该玩家的统计信息中跟方块/物品有关的统计项加上一个
Material . |
void |
incrementStatistic(Statistic statistic,
Material material,
int amount)
把该玩家的统计信息中跟方块/物品有关的统计项中的某
Material 加上指定的值. |
boolean |
isFlying()
检查玩家是否在飞.
|
boolean |
isHealthScaled()
获取客户端显示的玩家血量是否被"压缩"了.
|
boolean |
isPlayerTimeRelative()
如果玩家时间于当前世界时间保持了一定的差值则返回true.
|
boolean |
isSleepingIgnored()
查看
setSleepingIgnored(boolean) 方法所设置的值. |
boolean |
isSneaking()
判断玩家是否在潜行中.
|
boolean |
isSprinting()
判断玩家是否在疾跑.
|
void |
kickPlayer(java.lang.String message)
踢出玩家,并且发送一条自定义的踢出消息.
|
void |
loadData()
加载上一次保存的数据(从在world/player文件夹中的玩家名.dat文件中加载
位置,血量,背包,移动方向及其他信息).
|
boolean |
performCommand(java.lang.String command)
强制玩家执行某个命令.
|
void |
playEffect(Location loc,
Effect effect,
int data)
已过时。
不安全的参数
|
<T> void |
playEffect(Location loc,
Effect effect,
T data)
|
void |
playNote(Location loc,
byte instrument,
byte note)
已过时。
不安全的参数
|
void |
playNote(Location loc,
Instrument instrument,
Note note)
Play a note for a player at a location.
|
void |
playSound(Location location,
Sound sound,
float volume,
float pitch)
向玩家在某个位置播放一个声音.
|
void |
playSound(Location location,
Sound sound,
SoundCategory category,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
playSound(Location location,
java.lang.String sound,
float volume,
float pitch)
向玩家在某个位置播放一个声音.
|
void |
playSound(Location location,
java.lang.String sound,
SoundCategory category,
float volume,
float pitch)
Play a sound for a player at the location.
|
void |
removeAchievement(Achievement achievement)
已过时。
未来的Minecraft将不会有成就(取而代之的是进度).
|
void |
resetPlayerTime()
将玩家时间变为当前世界时间并与世界时间保持同步.
|
void |
resetPlayerWeather()
恢复玩家所看到的天气为世界的天气.
|
void |
resetTitle()
Resets the title displayed to the player.
|
void |
saveData()
保存玩家数据(位置,血量,背包,移动方向
及其他信息至在world/player文件夹中的"玩家名.dat"文件).
|
void |
sendBlockChange(Location loc,
int material,
byte data)
已过时。
不安全的参数
|
void |
sendBlockChange(Location loc,
Material material,
byte data)
已过时。
不安全的参数
|
boolean |
sendChunkChange(Location loc,
int sx,
int sy,
int sz,
byte[] data)
已过时。
不安全的参数
|
void |
sendMap(MapView map)
Render a map and send it to the player in its entirety.
|
void |
sendRawMessage(java.lang.String message)
发送一条不含颜色代码的消息.
|
void |
sendSignChange(Location loc,
java.lang.String[] lines)
向该玩家发送一个伪造的牌子(
Sign )上的字的更改数据包.这不会改变世界中的任何方块. |
void |
sendTitle(java.lang.String title,
java.lang.String subtitle)
已过时。
API behavior subject to change
|
void |
sendTitle(java.lang.String title,
java.lang.String subtitle,
int fadeIn,
int stay,
int fadeOut)
Sends a title and a subtitle message to the player.
|
void |
setAllowFlight(boolean flight)
设置玩家是否能够飞起来(就像创造模式).
|
void |
setBedSpawnLocation(Location location)
设置玩家上一次睡觉的床的位置(
Location ). |
void |
setBedSpawnLocation(Location location,
boolean force)
设置玩家上一次睡觉的床的位置.
|
void |
setCompassTarget(Location loc)
设置玩家指南针的指向的位置(
Location ). |
void |
setDisplayName(java.lang.String name)
设置玩家在聊天信息中的昵称.
|
void |
setExhaustion(float value)
设置玩家的疲劳度.
|
void |
setExp(float exp)
设置当前级别升到下一级别经验进度的百分比.
|
void |
setFlying(boolean value)
设置该玩家飞行状态.
|
void |
setFlySpeed(float value)
设置该玩家飞行速度.
|
void |
setFoodLevel(int value)
设置玩家的饥饿度(不是饱食度).
|
void |
setHealthScale(double scale)
设置客户端显示的血量的"压缩率".
|
void |
setHealthScaled(boolean scale)
设置客户端是否要显示一个"压缩"了的血量.
|
void |
setLevel(int level)
设置玩家的等级 .
|
void |
setPlayerListName(java.lang.String name)
设置玩家显示在Tab列表中的名称.
|
void |
setPlayerTime(long time,
boolean relative)
设置该玩家客户端的时间,单位为tick.
|
void |
setPlayerWeather(WeatherType type)
设置玩家的客户端的天气.
|
void |
setResourcePack(java.lang.String url)
请求玩家的客户端下载并且使用指定资源包.
|
void |
setResourcePack(java.lang.String url,
byte[] hash)
请求玩家的客户端下载并且使用指定资源包.
|
void |
setSaturation(float value)
设置玩家的饱食度(不是饥饿度).
|
void |
setScoreboard(Scoreboard scoreboard)
设置玩家的计分板.
|
void |
setSleepingIgnored(boolean isSleeping)
是否忽略该玩家.如果设置为true,不需要该玩家睡觉,只需其他人睡觉,时间也能改变.
|
void |
setSneaking(boolean sneak)
设置玩家潜行模式开启/取消.
|
void |
setSpectatorTarget(Entity entity)
Sets the entity which is followed by the camera when in
GameMode.SPECTATOR . |
void |
setSprinting(boolean sprinting)
设置玩家疾跑状态开启/取消.
|
void |
setStatistic(Statistic statistic,
EntityType entityType,
int newValue)
设置该玩家的统计信息中某个跟实体有关的统计项的某实体类型(
EntityType )为某个数值. |
void |
setStatistic(Statistic statistic,
int newValue)
设置该玩家的统计信息里的某项的值.
|
void |
setStatistic(Statistic statistic,
Material material,
int newValue)
把该玩家的统计信息中的某个跟方块/物品有关的统计项中的某
Material 的数量设定为某值. |
void |
setTexturePack(java.lang.String url)
已过时。
Minecraft已经不使用材质包了,应该用
setResourcePack(String) 设置资源包(额这不是一个意思么..). |
void |
setTotalExperience(int exp)
设置玩家的总经验值(等级和经验).
|
void |
setWalkSpeed(float value)
设置该玩家行走速度.
|
void |
showPlayer(Player player)
已过时。
|
void |
showPlayer(Plugin plugin,
Player player)
让该玩家能看到之前被隐藏的玩家.
|
void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count,
double offsetX,
double offsetY,
double offsetZ,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
double x,
double y,
double z,
int count,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(Particle particle,
Location location,
int count)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(Particle particle,
Location location,
int count,
double offsetX,
double offsetY,
double offsetZ)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
spawnParticle(Particle particle,
Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
double extra,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
Location location,
int count,
double offsetX,
double offsetY,
double offsetZ,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
<T> void |
spawnParticle(Particle particle,
Location location,
int count,
T data)
Spawns the particle (the number of times specified by count)
at the target location.
|
void |
stopSound(Sound sound)
停止播放某个指定的声音.
|
void |
stopSound(Sound sound,
SoundCategory category)
Stop the specified sound from playing.
|
void |
stopSound(java.lang.String sound)
Stop the specified sound from playing.
|
void |
stopSound(java.lang.String sound,
SoundCategory category)
Stop the specified sound from playing.
|
void |
updateInventory()
已过时。
不需要调用(谁知道呢..保险起见..反正不会报错).
|
closeInventory, getCooldown, getEnderChest, getExpToLevel, getGameMode, getInventory, getItemInHand, getItemOnCursor, getMainHand, getName, getOpenInventory, getShoulderEntityLeft, getShoulderEntityRight, getSleepTicks, hasCooldown, isBlocking, isHandRaised, isSleeping, openEnchanting, openInventory, openInventory, openMerchant, openMerchant, openWorkbench, setCooldown, setGameMode, setItemInHand, setItemOnCursor, setShoulderEntityLeft, setShoulderEntityRight, setWindowProperty
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway
getAttribute
damage, damage, getHealth, getMaxHealth, resetMaxHealth, setHealth, setMaxHealth
addPassenger, addScoreboardTag, eject, getEntityId, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isOnGround, isSilent, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPortalCooldown, setSilent, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
getMetadata, hasMetadata, removeMetadata, setMetadata
sendMessage, sendMessage
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
getCustomName, setCustomName
launchProjectile, launchProjectile
abandonConversation, abandonConversation, acceptConversationInput, beginConversation, isConversing
getFirstPlayed, getLastPlayed, getName, getPlayer, getUniqueId, hasPlayedBefore, isBanned, isOnline, isWhitelisted, setWhitelisted
serialize
getListeningPluginChannels, sendPluginMessage
java.lang.String getDisplayName()
这个昵称只显示在聊天信息中,能以颜色加以修饰.
原文:Gets the "friendly" name to display of this player. This may include color.
Note that this name will not be displayed in game, only in chat and places defined by plugins.
void setDisplayName(java.lang.String name)
这个名字只显示在聊天信息中,能以颜色加以修饰.
原文Sets the "friendly" name to display of this player. This may include color.
Note that this name will not be displayed in game, only in chat and places defined by plugins.
name
- 显示的名称.java.lang.String getPlayerListName()
原文:Gets the name that is shown on the player list.
void setPlayerListName(java.lang.String name)
不允许超过16个字符,不允许重复.但支持ChatColor
颜色代码.
如果设置为null则不在玩家列表中显示.(玩家自己还是看得到的,只不过别人看不到).
("list name"指代“玩家显示在Tab列表中的名称”)(以下解释的是服务器如何处理冲突玩家名,你用代码违法操作肯定是会抛出异常的) 这个名字区分大小写且唯一,也就意味着两个字母相同但字母大小写有别的名字被当作为两个不同的人. 如果一玩家以与某个游戏内玩家的自定义的"list name"相冲突的名字加入游戏, 则追加一个随机数字至这个玩家的"list name". 如果这个玩家的名字较长,那么名字末尾的部分会被截除.
原文:Sets the name that is shown on the in-game player list.
The name cannot be longer than 16 characters, but ChatColor
is
supported.
If the value is null, the name will be identical to HumanEntity.getName()
.
This name is case sensitive and unique, two names with different casing will appear as two different people. If a player joins afterwards with a name that conflicts with a player's custom list name, the joining player's player list name will have a random number appended to it (1-2 characters long in the default implementation). If the joining player's name is 15 or 16 characters long, part of the name will be truncated at the end to allow the addition of the two digits.
name
- 新的显示在玩家列表中的名字java.lang.IllegalArgumentException
- 当有名称相同时抛出java.lang.IllegalArgumentException
- 当名称超过16个字符时抛出void setCompassTarget(Location loc)
Location
).
原文:Set the target of the player's compass.
loc
- 指向Location getCompassTarget()
java.net.InetSocketAddress getAddress()
原文:Gets the socket address of this player
void sendRawMessage(java.lang.String message)
译注:就是会把颜色代码过滤掉然后CommandSender.sendMessage(java.lang.String)
原文:Sends this sender a message raw
sendRawMessage
在接口中 Conversable
message
- 要发送的消息void kickPlayer(java.lang.String message)
原文:Kicks player with custom kick message.
message
- 踢出消息void chat(java.lang.String msg)
原文:Says a message (or runs a command).
msg
- 要发送的聊天消息boolean performCommand(java.lang.String command)
原文:Makes the player perform the given command
command
- 要执行的命令(不带'/')boolean isSneaking()
原文:Returns if the player is in sneak mode
void setSneaking(boolean sneak)
原文:Sets the sneak mode the player
sneak
- true表示在潜行,false反之boolean isSprinting()
原文:Gets whether the player is sprinting or not.
void setSprinting(boolean sprinting)
原文:Sets whether the player is sprinting or not.
sprinting
- true表示在疾跑,false反之void saveData()
原文:Saves the players current location, health, inventory, motion, and other information into the username.dat file, in the world/player folder
void loadData()
这将会覆盖当前内存中的数据.
原文:Loads the players current location, health, inventory, motion, and other information from the username.dat file, in the world/player folder.
Note: This will overwrite the players current inventory, health, motion, etc, with the state from the saved dat file.
void setSleepingIgnored(boolean isSleeping)
如果所有玩家都把这个项设置为true但是没有人睡觉,则什么事也不会发生.
原文:Sets whether the player is ignored as not sleeping. If everyone is either sleeping or has this flag set, then time will advance to the next day. If everyone has this flag set but no one is actually in bed, then nothing will happen.
isSleeping
- 是否忽略该玩家boolean isSleepingIgnored()
@Deprecated void playNote(Location loc, byte instrument, byte note)
译注:貌似就是让一个音符盒播放指定乐器的指定声音..没试过...
loc
- 音符盒的位置.instrument
- 乐器IDnote
- 音符ID.void playNote(Location loc, Instrument instrument, Note note)
译注:貌似就是让一个音符盒播放指定乐器的指定声音..没试过...
loc
- 音符盒的位置instrument
- 乐器IDnote
- 音符void playSound(Location location, Sound sound, float volume, float pitch)
当位置或声音为null或玩家的客户端没开启声音时,这个方法无效.
原文:Play a sound for a player at the location.
This function will fail silently if Location or Sound are null.
location
- 要播放声音的位置sound
- 要播放的声音volume
- 音量 默认 1Fpitch
- 音高 默认 0Fvoid playSound(Location location, java.lang.String sound, float volume, float pitch)
当位置或声音为null或玩家的客户端没开启声音时,这个方法无效.
原文:Play a sound for a player at the location.
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- 要播放声音的位置sound
- 要播放的声音volume
- 音量 默认 1Fpitch
- 音高 默认 0Fvoid playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(Location location, java.lang.String sound, SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null. No sound will be heard by the player if their client does not have the respective sound for the value passed.
location
- the location to play the soundsound
- the internal sound name to playcategory
- The category of the soundvolume
- the volume of the soundpitch
- the pitch of the soundvoid stopSound(Sound sound)
原文:Stop the specified sound from playing.
sound
- 指定声音void stopSound(java.lang.String sound)
sound
- the sound to stopvoid stopSound(Sound sound, SoundCategory category)
sound
- the sound to stopcategory
- 声音类别void stopSound(java.lang.String sound, SoundCategory category)
sound
- the sound to stopcategory
- the category of the sound@Deprecated void playEffect(Location loc, Effect effect, int data)
loc
- 要播放粒子效果的位置effect
- 要播放的粒子效果data
- 某些效果需要的附加值.<T> void playEffect(Location loc, Effect effect, T data)
Location
)向玩家播放一个粒子效果(Effect
). 原文:Plays an effect to just this player.
译注1:data参数一般为0就行,但是如果要播放的效果为
Effect
.StepSound(方块被打破时的粒子效果),data就为Material
类型.
例:playEffect(loc, Effect
.StepSound, Material.REDSTONE_BLOCK)将
在loc的位置播放一个红石块(REDSTONE_BLOCK)被打破的粒子效果.
译注2:Material
只能表示主ID,不能表示副ID,所以播放绿色羊毛的打破效果貌似是不可能的,
但是由于data是泛型,我们猜测会不会data也可以是能表示任何方块
类型?由于时间关系不能测试,请谅解.
@Deprecated void sendBlockChange(Location loc, Material material, byte data)
Block
)更改数据包.这不会改变世界中的方块. 原文:Send a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.
译注:意思就是,向玩家发送一个伪造的,更新方块的数据包,那个位置本来是石头的,这个玩家看起来那里就变成了钻石矿.
但是这并没有真的在世界中放置一个钻石矿.其他玩家看到的还是石头.挖掉后也不会真的掉钻石.(我想还是举例说明比较好..)
例1:sendBlockChange(loc,Material.DIAMOND_ORE,(byte)0)将让玩家的客户端认为loc的位置是一个钻石矿石(DIAMOND_ORE) 但其实并没有改变.
例2:sendBlockChange(loc,Material.WOOL,(byte)14)将让玩家的客户端认为loc的位置是一个红色羊毛(附加值为14的WOOL).
loc
- 要改变的方块material
- 要改变成的方块的类型data
- 要改变成的方块的副ID@Deprecated boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data)
原文:Send a chunk change. This fakes a chunk change packet for a user at a certain location. The updated cuboid must be entirely within a single chunk. This will not actually change the world in any way.
At least one of the dimensions of the cuboid must be even. The size of the data buffer must be 2.5*sx*sy*sz and formatted in accordance with the Packet51 format.
译注:这..很难解释耶,就是说,这个方法可以让玩家的客户端显示这个长方体内全是钻石矿石233~
具体请看sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
方法.
它其实就是sendBlockChange方法的简单变体.sendBlockChange是伪装一个方块,而这个方法是伪装一堆方块.
例:
byte data = new Byte[27]; //由于我们要发送的是3*3*3的立方体,所以为27
for(int i=0;i<data.lenth;i++) data[i] = (byte)11 //由于我们想把这个立方体里填满岩浆,所以都为11
player.sendBlockChange(player.getLocation(),3,3,3,data); //完成~上帝保佑那个玩家233
loc
- The location of the cuboidsx
- The x size of the cuboidsy
- The y size of the cuboidsz
- The z size of the cuboiddata
- The data to be sent@Deprecated void sendBlockChange(Location loc, int material, byte data)
sendBlockChange(Location loc, Material material, byte data)
方法. Send a block change. This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.
loc
- 要改变的方块的位置material
- 要改变成的方块的IDdata
- 要改变成的方块的副IDvoid sendSignChange(Location loc, java.lang.String[] lines) throws java.lang.IllegalArgumentException
Sign
)上的字的更改数据包.这不会改变世界中的任何方块.
如果那个位置没有牌子,这个方法将用sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
方法在那个位置伪造一个牌子然后更改它.
如果客户端认为在指定的位置没有牌子,则会显示一个错误给玩家.
原文:Send a sign change. This fakes a sign change packet for a user at
a certain location. This will not actually change the world in any way.
This method will use a sign at the location's block or a faked sign
sent via sendBlockChange(org.bukkit.Location, int, byte)
or
sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
.
If the client does not have a sign at the given location it will display an error message to the user.
译注:该方法类似于sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)
,
只不过sendBlockChange是伪装一个方块成其他方块,而它只是伪装牌子上的字.
loc
- 要让玩家看起来改变了的牌子的位置lines
- null或大小等于4的String数组;数组中每个元素都代表一行java.lang.IllegalArgumentException
- 如果该位置没有牌子java.lang.IllegalArgumentException
- 如果lines的长度大于4或小于1void sendMap(MapView map)
译注:额...没搞懂...不过一般用不上吧?
map
- 要发送的地图@Deprecated void updateInventory()
译注:在以前的版本(好吧我也不知道是什么版本)中假如不调用该方法当更改背包时会出现莫名其妙的事情,比如 背包看起来是空的,点一下空的格突然出现了东西之类的....
原文:Forces an update of the player's entire inventory.
@Deprecated void awardAchievement(Achievement achievement)
Achievement
和这个成就所需的父成就. 原文:Awards the given achievement and any parent achievements that the player does not have.
译注:比如,给玩家"这是?工作台!"成就,这个方法就会先给玩家它的父成就"获得木头!"
achievement
- 要给玩家的成就(不包括父成就)java.lang.IllegalArgumentException
- 当成就为null时抛出.@Deprecated void removeAchievement(Achievement achievement)
原文:Removes the given achievement and any children achievements that the player has.
译注:假如移除玩家的"获得木头!"成就,同时也会移除"这是?工作台"和后面的所有成就.因为没有"获得木头!"成就,就没后面的成就.
achievement
- 要移除的成就java.lang.IllegalArgumentException
- 当成就为null时抛出.boolean hasAchievement(Achievement achievement)
原文:Gets whether this player has the given achievement.
achievement
- 被判断的成就java.lang.IllegalArgumentException
- 当成就为null时抛出.void incrementStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
这相当于下面的代码:
incrementStatistic(Statistic, 1)
原文:Increments the given statistic for this player.
This is equivalent to the following code:
incrementStatistic(Statistic, 1)
statistic
- 要+1的统计项java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果这个statictic需要一个额外的参数??void decrementStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
这相当于下面的代码:
decrementStatistic(Statistic, 1)
原文:Decrements the given statistic for this player.
This is equivalent to the following code:
decrementStatistic(Statistic, 1)
statistic
- 要减少的统计项目java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果这个统计需要一个额外的参数??void incrementStatistic(Statistic statistic, int amount) throws java.lang.IllegalArgumentException
原文:Increments the given statistic for this player.
statistic
- 要增加的统计项amount
- 要增加多少java.lang.IllegalArgumentException
- 当statistic为nulljava.lang.IllegalArgumentException
- 当amount无效java.lang.IllegalArgumentException
- 如果这个统计需要一个额外的参数?void decrementStatistic(Statistic statistic, int amount) throws java.lang.IllegalArgumentException
原文:Decrements the given statistic for this player.
statistic
- 要减少的统计项amount
- 要减少多少java.lang.IllegalArgumentException
- 当statistic为nulljava.lang.IllegalArgumentException
- 当amount无效java.lang.IllegalArgumentException
- 如果这个统计需要一个额外的参数??void setStatistic(Statistic statistic, int newValue) throws java.lang.IllegalArgumentException
原文:Sets the given statistic for this player.
statistic
- 要设置的统计项newValue
- 要把statistic设置成的值java.lang.IllegalArgumentException
- 当statistic为nulljava.lang.IllegalArgumentException
- 当amount无效java.lang.IllegalArgumentException
- 如果这个统计需要一个额外的参数??int getStatistic(Statistic statistic) throws java.lang.IllegalArgumentException
原文:Gets the value of the given statistic for this player.
statistic
- 要获取值的统计项java.lang.IllegalArgumentException
- 当statistic为nulljava.lang.IllegalArgumentException
- 当amount无效java.lang.IllegalArgumentException
- 如果这个统计需要一个额外的参数??void incrementStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
Material
.
这相当于下面的代码:
incrementStatistic(Statistic, Material, 1)
原文:Increments the given statistic for this player for the given material.
This is equivalent to the following code:
incrementStatistic(Statistic, Material, 1)
译注:比如,要想给玩家的"已破坏过的方块数量"统计里增加一个石头,就用incrementStatistic(统计, Material.STONE)
statistic
- 要操纵的统计material
- 要给statistic增加的Materialjava.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果这个成就项使用的不是Materialvoid decrementStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
Material
. 原文:Decrements the given statistic for this player for the given material.
This is equivalent to the following code:
decrementStatistic(Statistic, Material, 1)
译注:比如,要想给玩家的"已破坏过的方块数量"统计里减少一个石头,就用decrementStatistic(统计, Material.STONE);
statistic
- 要操纵的统计material
- 要给statistic减少的Materialjava.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果这个成就项使用的不是Materialint getStatistic(Statistic statistic, Material material) throws java.lang.IllegalArgumentException
Material
有多少. 原文:Gets the value of the given statistic for this player.
译注:译注:比如,要想获得玩家的"已破坏过的方块数量"统计里有多少石头,就用getStatistic(统计,Material.STONE);
statistic
- 要获取的统计项material
- statistic中,要获取值的Materialjava.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果这个成就项使用的不是Materialvoid incrementStatistic(Statistic statistic, Material material, int amount) throws java.lang.IllegalArgumentException
Material
加上指定的值. 原文:Increments the given statistic for this player for the given material.
译注:比如,要想给玩家的"已破坏过的方块数量"统计里增加指定数量的石头,就用incrementStatistic(统计, Material.STONE, 数量);
statistic
- 要操作的统计项material
- statistic里要操作的某个Materialamount
- 要把statistic中的material增加多少java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果amount无效java.lang.IllegalArgumentException
- 如果statistic跟方块/物品无关void decrementStatistic(Statistic statistic, Material material, int amount) throws java.lang.IllegalArgumentException
Material
减少指定的值. 原文:Decrements the given statistic for this player for the given material.
译注:该方法与incrementStatistic(org.bukkit.Statistic, org.bukkit.Material, int)
相反.
statistic
- 要减少的统计项material
- statistic中要操作的某个Materialamount
- 要把statistic中的material减少多少java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果amount无效java.lang.IllegalArgumentException
- 如果这个statistic的值不是Materialvoid setStatistic(Statistic statistic, Material material, int newValue) throws java.lang.IllegalArgumentException
Material
的数量设定为某值. 原文:Sets the given statistic for this player for the given material.
译注:比如,要想给玩家的"已破坏过的方块数量"统计里的石头破坏数设定为指定数量,就用setStatistic(统计, Material.STONE, 数量);
statistic
- 要设置的统计项material
- statistic中的某个MaterialnewValue
- 要把statistic中的material设置的值java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果material为nulljava.lang.IllegalArgumentException
- 如果newVaule无效java.lang.IllegalArgumentException
- 如果statistic跟方块/物品无关void incrementStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
EntityType
)的数量+1. 这相当于下面的代码:
incrementStatistic(Statistic, EntityType, 1)
原文:Increments the given statistic for this player for the given entity.
This is equivalent to the following code:
incrementStatistic(Statistic, EntityType, 1)
译注:比如,要项给玩家的"已杀过的生物数量"统计里的僵尸数量加上1,就用incrementStatistic(Statistic,EntityType.Zombie);
statistic
- 要更改的统计项entityType
- statistic中的某种实体java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entityType为nulljava.lang.IllegalArgumentException
- 如果statistic与实体无关void decrementStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
EntityType
)的数量-1. 这相当于下面的代码:
decrementStatistic(Statistic, EntityType, 1)
原文:Decrements the given statistic for this player for the given entity.
This is equivalent to the following code:
decrementStatistic(Statistic, EntityType, 1)
译注:该方法与incrementStatistic(org.bukkit.Statistic, org.bukkit.entity.EntityType)
相反,可以参见该方法.
statistic
- 要更改的统计项entityType
- statistic中的某种实体java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entityType为nulljava.lang.IllegalArgumentException
- 如果statistic与实体无关int getStatistic(Statistic statistic, EntityType entityType) throws java.lang.IllegalArgumentException
EntityType
)数量. 原文:Gets the value of the given statistic for this player.
译注:比如,要获得玩家杀过多少僵尸,就用getStatistic(记录玩家杀实体的统计项,EntityType.Zombie);
statistic
- 要获得某实体数的统计项entityType
- 要获取数量的statistic的某实体java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entitytype为nulljava.lang.IllegalArgumentException
- 如果statistic与实体无关void incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws java.lang.IllegalArgumentException
EntityType
)加上指定的数值. 原文:Increments the given statistic for this player for the given entity.
译注:跟incrementStatistic(org.bukkit.Statistic, org.bukkit.entity.EntityType)
类似.只不过这个方法可以指定每次加多少.
statistic
- 要操作的统计项entityType
- 要增加的statistic中的某实体amount
- 要增加的数量java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entitytype为nulljava.lang.IllegalArgumentException
- 如果amount无效java.lang.IllegalArgumentException
- 如果statistic与实体无关void decrementStatistic(Statistic statistic, EntityType entityType, int amount)
EntityType
)减少指定的值. 原文:Decrements the given statistic for this player for the given entity.
译注:与incrementStatistic(org.bukkit.Statistic, org.bukkit.entity.EntityType, int)
相反.
statistic
- 要操作的统计项entityType
- 要减少的statistic中的某实体amount
- 要减少的数量java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entitytype为nulljava.lang.IllegalArgumentException
- 如果amount无效java.lang.IllegalArgumentException
- 如果statistic与实体无关void setStatistic(Statistic statistic, EntityType entityType, int newValue)
EntityType
)为某个数值. 原文:Sets the given statistic for this player for the given entity.
statistic
- 要设置的统计项entityType
- 要设置的statistic中的某实体类型newValue
- 要把statistic中entitytype的数量设置成的值java.lang.IllegalArgumentException
- 如果statistic为nulljava.lang.IllegalArgumentException
- 如果entitytype为nulljava.lang.IllegalArgumentException
- 如果newValue无效java.lang.IllegalArgumentException
- 如果statistic与实体无关void setPlayerTime(long time, boolean relative)
假如relative为true则玩家时间会随着世界时间变动而变动,并且保持一个差值,反之客户端时间固定不动.
注意!如果relative为true,那么time表示的就是客户端的时间与世界的时间之差(相对于世界的时间),而如果为false 那么time表示的就是一个绝对的时间.
原文:Sets the current time on the player's client. When relative is true the player's time will be kept synchronized to its world time with the specified offset.
When using non relative time the player's time will stay fixed at the specified time parameter. It's up to the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime().
time
- 绝对时间或与世界的时间之差,单位为tickrelative
- 是否让玩家的时间和世界的时间保持一个差值long getPlayerTime()
原文:Returns the player's current timestamp.
long getPlayerTimeOffset()
如玩家时间是固定的,则返回玩家时间. 原文:Returns the player's current time offset relative to server time, or the current player's fixed time if the player's time is absolute.
boolean isPlayerTimeRelative()
原文:Returns true if the player's time is relative to the server time, otherwise the player's time is absolute and will not change its current time unless done so with setPlayerTime().
void resetPlayerTime()
原文 Restores the normal condition where the player's time is synchronized with the server time.
Equivalent to calling setPlayerTime(0, true).
void setPlayerWeather(WeatherType type)
使用resetPlayerWeather()
来恢复正常.
原文:Sets the type of weather the player will see. When used, the weather
status of the player is locked until resetPlayerWeather()
is
used.
type
- 要让玩家看到的天气WeatherType getPlayerWeather()
原文:Returns the type of weather the player is currently experiencing.
void resetPlayerWeather()
原文:Restores the normal condition where the player's weather is controlled by server conditions.
void giveExp(int amount)
原文:Gives the player the amount of experience specified.
amount
- 要给的经验void giveExpLevels(int amount)
支持负数(减少等级).
原文:Gives the player the amount of experience levels specified. Levels can be taken by specifying a negative amount.
amount
- 要增加的等级(正数)或要减少的等级(负数)float getExp()
0表示毫无进展(0%), 0.99表示差一点点(99%), 1表示要升级了(100%).
原文:Gets the players current experience points towards the next level.
This is a percentage value. 0 is "no progress" and 1 is "next level".
void setExp(float exp)
0表示毫无进展(0%), 0.99表示差一点点(99%), 1表示要升级了(100%).
Sets the players current experience points towards the next level
This is a percentage value. 0 is "no progress" and 1 is "next level".
exp
- 新的离下一级的小数形式百分比int getLevel()
原文:Gets the players current experience level
void setLevel(int level)
. 原文:Sets the players current experience level
level
- 新的等级int getTotalExperience()
原文:Gets the players total experience points
This refers to the total amount of experience the player has collected
over time and is only displayed as the player's "score" upon dying.
void setTotalExperience(int exp)
原文:
Sets the players current experience points.
This refers to the total amount of experience the player has collected
over time and is only displayed as the player's "score" upon dying.
exp
- 总经验值float getExhaustion()
疲劳度控制者玩家的饥饿消耗.当玩家达到一定的疲劳度时,你的饱食度就会下降,并且疲劳度归零.
译注:如果饱食度为0,那么就扣饥饿度.
注释2:运动会产生疲劳度.
原文:Gets the players current exhaustion level.
Exhaustion controls how fast the food level drops. While you have a certain amount of exhaustion, your saturation will drop to zero, and then your food will drop to zero.
void setExhaustion(float value)
关于疲劳度,请参见getExhaustion()
.
原文:Sets the players current exhaustion level
value
- 新的疲劳度float getSaturation()
饱食度是一个饥饿度的缓存.当你的饱食度 >0的时候,饥饿度是不会下降的.
译注:就是说,吃东西的时候,你的饥饿度被填满了,而多出来的部分就是隐藏的饱食度.当你的疲劳值(见getExhaustion()
)
达到一定程度时,如果饱食度不为0,那么先扣饱食度.只有当没饱食度时,才会扣饥饿度.其实饱食度就是饥饿度,只不过是隐藏的.
原文:Gets the players current saturation level.
Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.
void setSaturation(float value)
关于饱食度,请参见getSaturation()
.
原文:Sets the players current saturation level
value
- 要设置成的饱食度int getFoodLevel()
原文:Gets the players current food level
void setFoodLevel(int value)
原文:Sets the players current food level
value
- 新的饥饿度Location getBedSpawnLocation()
Location
). 如果玩家没有睡过觉或床已被拆除则返回null.
原文:Gets the Location where the player will spawn at their bed, null if they have not slept in one or their current bed spawn is invalid.
getBedSpawnLocation
在接口中 OfflinePlayer
void setBedSpawnLocation(Location location)
Location
). 原文:Sets the Location where the player will spawn at their bed.
location
- 要设置成的位置void setBedSpawnLocation(Location location, boolean force)
原文:Sets the Location where the player will spawn at their bed.
location
- 要设置成的位置force
- true为强制设置,不管那个位置有没有床.boolean getAllowFlight()
译注:如果玩家确实在创造模式,那么一般返回true,除非被setAllowFlight(false); 原文:Determines if the Player is allowed to fly via jump key double-tap like in creative mode.
void setAllowFlight(boolean flight)
译注:如果被设置为false,即便是创造模式也不能飞. 原文:Sets if the Player is allowed to fly via jump key double-tap like in creative mode.
flight
- 是否允许该玩家飞行.@Deprecated void hidePlayer(Player player)
hidePlayer(Plugin, Player)
原文:Hides a player from this player
player
- 要让该玩家看不见的玩家.void hidePlayer(Plugin plugin, Player player)
原文:Hides a player from this player
plugin
- Plugin 要隐藏该玩家的插件player
- Player 要让该玩家看不见的玩家.@Deprecated void showPlayer(Player player)
showPlayer(Plugin, Player)
原文:Allows this player to see a player that was previously hidden
player
- 要让该玩家看得见的玩家.void showPlayer(Plugin plugin, Player player)
原文:Allows this player to see a player that was previously hidden. If another another plugin had hidden the player too, then the player will remain hidden until the other plugin calls this method too.
plugin
- Plugin 要使某玩家现身的插件player
- Player 使某玩家现身boolean canSee(Player player)
原文:Checks to see if a player has been hidden from this player
player
- 要检查该玩家是否能看到的玩家boolean isFlying()
原文:Checks to see if this player is currently flying or not.
void setFlying(boolean value)
原文:Makes this player start or stop flying.
value
- true表示正在飞void setFlySpeed(float value) throws java.lang.IllegalArgumentException
速度为-1~1之间,负数代表玩家会反着飞...
译注:不代表行走的速度!.
原文:Sets the speed at which a client will fly. Negative values indicate reverse directions.
value
- 新的飞行速度,在-1~1之间.java.lang.IllegalArgumentException
- 如果速度不在-1~1之间则抛出.void setWalkSpeed(float value) throws java.lang.IllegalArgumentException
速度在-1~1之间,负数代表玩家会倒着走(整人专用233~)...
译注:不代表飞行的速度! 原文:Sets the speed at which a client will walk. Negative values indicate reverse directions.
value
- 新的行走速度.java.lang.IllegalArgumentException
- 当速度不在-1~1时间则抛出float getFlySpeed()
译注:不代表行走速度! 原文:Gets the current allowed speed that a client can fly.
float getWalkSpeed()
译注:不代表飞行速度! 原文:Gets the current allowed speed that a client can walk.
@Deprecated void setTexturePack(java.lang.String url)
setResourcePack(String)
设置资源包(额这不是一个意思么..).
介绍同setResourcePack(java.lang.String)
Request that the player's client download and switch texture packs.
The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- The URL from which the client will download the texture
pack. The string must contain only US-ASCII characters and should
be encoded as per RFC 1738.java.lang.IllegalArgumentException
- Thrown if the URL is null.java.lang.IllegalArgumentException
- Thrown if the URL is too long.void setResourcePack(java.lang.String url)
玩家的客户端将在后台异步下载新的资源包,并且下载完成后会自动使用那个资源包.如果 这个资源包已经下载好了,客户端先会检查给定URL的资源包跟已经下载的资源包是否一样. 如果不一样就会重新下载,一样就直接使用.
在开始下载之前,客户端会显示一个GUI确定界面,提示要不要下载资源包.如果玩家选择不要, 就不能下载.
注意:
PlayerResourcePackStatusEvent
方法以推断玩家是否加载了你设置的资源包!
原文:Request that the player's client download and switch texture packs.
The player's client will download the new texture pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached the same texture pack in the past, it will perform a file size check against the response content to determine if the texture pack has changed and needs to be downloaded again. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- 资源包的URL地址.只能包含US-ASCII字符并且使用RFC 1738编码.java.lang.IllegalArgumentException
- 当URL为null时抛出java.lang.IllegalArgumentException
- 当URL太长或者不符合规范时抛出void setResourcePack(java.lang.String url, byte[] hash)
玩家的客户端将在后台异步下载新的资源包,并且下载完成后会自动使用那个资源包.如果 这个资源包已经下载好了,客户端先会检查给定URL的资源包跟已经下载的资源包是否一样. 如果不一样就会重新下载,一样就直接使用.
在开始下载之前,客户端会显示一个GUI确定界面,提示要不要下载资源包.如果玩家选择不要, 就不能下载.
注意:
PlayerResourcePackStatusEvent
方法以推断玩家是否加载了你设置的资源包!
原文:Request that the player's client download and switch resource packs.
The player's client will download the new resource pack asynchronously in the background, and will automatically switch to it once the download is complete. If the client has downloaded and cached a resource pack with the same hash in the past it will not download but directly apply the cached pack. When this request is sent for the very first time from a given server, the client will first display a confirmation GUI to the player before proceeding with the download.
Notes:
PlayerResourcePackStatusEvent
to figure out whether or not
the player loaded the pack!
url
- 资源包的URL地址.只能包含US-ASCII字符并且使用RFC 1738编码.hash
- 资源包文件的sha1哈希值,被用于正确地应用缓存版本的资源包而不需再重新下载(如果之前下载过).必须是20字节长!java.lang.IllegalArgumentException
- 当URL为null时抛出java.lang.IllegalArgumentException
- 当URL太长或者不符合规范时抛出java.lang.IllegalArgumentException
- 当hash为null时抛出Thrown if the hash is null.java.lang.IllegalArgumentException
- 当hash不是20字节长时抛出
long.Scoreboard getScoreboard()
原文:Gets the Scoreboard displayed to this player
void setScoreboard(Scoreboard scoreboard) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
原文:Sets the player's visible Scoreboard.
scoreboard
- 要设置成的计分板java.lang.IllegalArgumentException
- 如果计分板为null则抛出java.lang.IllegalArgumentException
- 如果计分板不是由
scoreboard manager
创建的
则抛出.java.lang.IllegalStateException
- 如果没有该玩家的数据,即该玩家没有进入过服务器则抛出.boolean isHealthScaled()
译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)
),每一排血量将会被
挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是判断血量是否被压缩了.(完全没用的说..).
原文:Gets if the client is displayed a 'scaled' health, that is, health on a
scale from 0-getHealthScale()
.
setHealthScaled(boolean)
void setHealthScaled(boolean scale)
显示的血量遵循一个规则: 显示的血量 =
getHealth() / getMaxHealth() * getHealthScale()
.
译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)
),每一排血量将会被
挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是设置血量是否要被"压缩".(完全没用的说..).
原文:Sets if the client is displayed a 'scaled' health, that is, health on a
scale from 0-getHealthScale()
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- 血量是否要被压缩void setHealthScale(double scale) throws java.lang.IllegalArgumentException
显示的血量遵循一个规则: 显示的血量 =
getHealth() / getMaxHealth() * getHealthScale()
.
译注:当玩家的最大血量过多时(Damageable.setMaxHealth(double)
),每一排血量将会被
挤在一起,以免挡住玩家的视线,这就是"压缩".这个方法就是设置血量的"压缩率".(完全没用的说..).
原文:Sets the number to scale health to for the client; this will also
setHealthScaled(true)
.
Displayed health follows a simple formula displayedHealth =
getHealth() / getMaxHealth() * getHealthScale()
.
scale
- 血量的"压缩率"java.lang.IllegalArgumentException
- 如果scale <0java.lang.IllegalArgumentException
- 如果scale为Double.NaN
java.lang.IllegalArgumentException
- 如果scale太大了double getHealthScale()
详见setHealthScale(double)
原文:Gets the number that health is scaled to for the client.
setHealthScale(double)
,
setHealthScaled(boolean)
Entity getSpectatorTarget()
GameMode.SPECTATOR
.void setSpectatorTarget(Entity entity)
GameMode.SPECTATOR
.entity
- the entity to follow or null to resetjava.lang.IllegalStateException
- if the player is not in
GameMode.SPECTATOR
@Deprecated void sendTitle(java.lang.String title, java.lang.String subtitle)
title
- Title textsubtitle
- Subtitle textvoid sendTitle(java.lang.String title, java.lang.String subtitle, int fadeIn, int stay, int fadeOut)
title
- Title textsubtitle
- Subtitle textfadeIn
- time in ticks for titles to fade in. Defaults to 10.stay
- time in ticks for titles to stay. Defaults to 70.fadeOut
- time in ticks for titles to fade out. Defaults to 20.void resetTitle()
void spawnParticle(Particle particle, Location location, int count)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesvoid spawnParticle(Particle particle, double x, double y, double z, int count)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particles<T> void spawnParticle(Particle particle, Location location, int count, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisvoid spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axis<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the
particle used (normally speed)data
- the data to use for the particle or null,
the type of this depends on Particle.getDataType()
AdvancementProgress getAdvancementProgress(Advancement advancement)
advancement
- advancementjava.lang.String getLocale()