public class Player extends Human implements CommandSender, InventoryHolder, ChunkLoader, IPlayer
| Modifier and Type | Class and Description |
|---|---|
static class |
Player.CraftingType |
| Modifier and Type | Field and Description |
|---|---|
protected AdventureSettings |
adventureSettings |
Block |
breakingBlock |
protected int |
chunksPerTick |
protected boolean |
connected |
protected CraftingGrid |
craftingGrid |
protected CraftingTransaction |
craftingTransaction |
Player.CraftingType |
craftingType |
long |
creationTime |
static float |
DEFAULT_SPEED |
protected String |
displayName |
protected Map<Long,DummyBossBar> |
dummyBossBars |
protected boolean |
enableClientCommand |
FishingHook |
fishing |
protected PlayerFood |
foodData |
protected com.nukkitx.math.vector.Vector3f |
forceMovement |
protected AtomicInteger |
formWindowCount |
protected Map<Integer,Form<?>> |
formWindows |
protected Map<UUID,Player> |
hiddenPlayers |
protected int |
inAirTicks |
protected String |
iusername |
long |
lastBreak |
protected int |
lastChorusFruitTeleport |
protected int |
lastEnderPearl |
long |
lastSkinChange |
boolean |
loggedIn |
static float |
MAXIMUM_SPEED |
protected int |
messageCounter |
protected com.nukkitx.math.vector.Vector3f |
newPosition |
int |
packetsRecieved |
protected it.unimi.dsi.fastutil.bytes.ByteSet |
permanentWindows |
int |
pickedXPOrb |
protected PlayerData |
playerData |
protected PlayerUIInventory |
playerUIInventory |
protected long |
randomClientId |
protected boolean |
removeFormat |
protected CustomForm |
serverSettings |
protected int |
serverSettingsId |
protected com.nukkitx.protocol.bedrock.BedrockServerSession |
session |
protected com.nukkitx.math.vector.Vector3i |
sleeping |
boolean |
spawned |
protected Location |
spawnLocation |
protected int |
spawnThreshold |
com.nukkitx.math.vector.Vector3f |
speed |
protected int |
startAction |
protected int |
startAirTicks |
protected float |
stepHeight |
protected com.nukkitx.math.vector.Vector3f |
teleportPosition |
protected String |
username |
protected int |
viewDistance |
protected byte |
windowCnt |
protected com.google.common.collect.BiMap<Byte,Inventory> |
windowIndex |
protected com.google.common.collect.BiMap<Inventory,Byte> |
windows |
attackTime, invisible, movementSpeed, turtleTicksabsorption, age, blocksAround, boundingBox, chunk, closed, collisionBlockStates, data, deadTicks, effects, entityCollisionReduction, fallDistance, fireProof, fireTicks, firstMove, hasSpawned, health, highestPosition, inBlock, inPortalTicks, invulnerable, isCollided, isCollidedHorizontally, isCollidedVertically, isPlayer, isStatic, justCreated, keepMovement, lastDamageCause, lastMotion, lastPitch, lastPosition, lastUpdate, lastYaw, level, maxFireTicks, motion, motionChanged, noDamageTicks, onGround, passengers, pitch, pitchDelta, position, positionChanged, scale, server, tag, ticksLived, timing, vehicle, yaw, yawDelta, ySize| Constructor and Description |
|---|
Player(com.nukkitx.protocol.bedrock.BedrockServerSession session,
ClientChainData chainData) |
| Modifier and Type | Method and Description |
|---|---|
PermissionAttachment |
addAttachment(PluginContainer plugin) |
PermissionAttachment |
addAttachment(PluginContainer plugin,
String name) |
PermissionAttachment |
addAttachment(PluginContainer plugin,
String name,
Boolean value) |
protected void |
addDefaultWindows() |
void |
addExperience(int add) |
void |
addMovement(double x,
double y,
double z,
double yaw,
double pitch,
double headYaw) |
int |
addWindow(Inventory inventory) |
int |
addWindow(Inventory inventory,
Byte forceId) |
int |
addWindow(Inventory inventory,
Byte forceId,
boolean isPermanent) |
boolean |
attack(EntityDamageEvent source) |
boolean |
awardAchievement(String achievementId) |
static int |
calculateRequireExperience(int level) |
boolean |
canCollideWith(Entity entity) |
boolean |
canInteract(com.nukkitx.math.vector.Vector3f pos,
double maxDistance) |
boolean |
canInteract(com.nukkitx.math.vector.Vector3f pos,
double maxDistance,
double maxDiff) |
boolean |
canOpenInventory() |
boolean |
canSee(Player player) |
boolean |
chat(String message)
Sends a chat message as this player.
|
protected void |
checkBlockCollision() |
protected void |
checkChunks() |
protected void |
checkGroundState(double movX,
double movY,
double movZ,
double dx,
double dy,
double dz) |
void |
checkInteractNearby() |
protected void |
checkNearEntities() |
void |
checkNetwork() |
protected boolean |
checkTeleportPosition() |
void |
clearTitle() |
void |
close() |
void |
close(String message) |
void |
close(String message,
String reason) |
void |
close(String message,
String reason,
boolean notify) |
void |
close(TextContainer message) |
void |
close(TextContainer message,
String reason) |
void |
close(TextContainer message,
String reason,
boolean notify) |
void |
closeInventory(Player who) |
void |
completeLoginSequence() |
protected com.nukkitx.protocol.bedrock.BedrockPacket |
createAddEntityPacket() |
long |
createBossBar(DummyBossBar dummyBossBar)
Creates and sends a BossBar to the player
|
long |
createBossBar(String text,
int length)
Deprecated.
|
protected void |
doFirstSpawn() |
boolean |
dropItem(Item item)
Drops an item on the ground in front of the player.
|
boolean |
equals(Object obj) |
String |
getAddress() |
AdventureSettings |
getAdventureSettings() |
boolean |
getAllowFlight()
Deprecated.
|
String |
getButtonText() |
PlayerChunkManager |
getChunkManager() |
int |
getChunkRadius() |
Long |
getClientId()
Deprecated.
|
String |
getClientSecret() |
CraftingGrid |
getCraftingGrid() |
CraftingTransaction |
getCraftingTransaction() |
PlayerCursorInventory |
getCursorInventory() |
String |
getDisplayName() |
Item[] |
getDrops() |
DummyBossBar |
getDummyBossBar(long bossBarId)
Get a DummyBossBar object
|
Map<Long,DummyBossBar> |
getDummyBossBars()
Get all DummyBossBar objects
|
Map<String,PermissionAttachmentInfo> |
getEffectivePermissions() |
EntityInteractable |
getEntityPlayerLookingAt(int maxDistance)
Returns the Entity the player is looking at currently
|
int |
getExperience() |
int |
getExperienceLevel() |
Long |
getFirstPlayed()
得到这个玩家第一次游戏的时间。
Returns the time this player first played in this server. |
PlayerFood |
getFoodData() |
com.nukkitx.math.vector.Vector3f |
getForceMovement() |
GameMode |
getGamemode() |
int |
getInAirTicks() |
Entity |
getKiller() |
int |
getLastChorusFruitTeleport() |
int |
getLastEnderPearlThrowingTick() |
Long |
getLastPlayed()
得到这个玩家上次加入游戏的时间。
Returns the time this player last joined in this server. |
TranslationContainer |
getLeaveMessage() |
int |
getLoaderId() |
Locale |
getLocale() |
LoginChainData |
getLoginChainData() |
List<MetadataValue> |
getMetadata(String metadataKey) |
String |
getName()
返回命令发送者的名称。
Returns the name of the command sender. |
com.nukkitx.math.vector.Vector3f |
getNewPosition() |
com.nukkitx.math.vector.Vector3f |
getNextPosition() |
long |
getPing() |
Player |
getPlayer()
得到这个接口的
Player对象。Returns a Player object for this interface. |
int |
getPort() |
boolean |
getRemoveFormat() |
Server |
getServer()
返回命令发送者所在的服务器。
Returns the server of the command sender. |
CustomForm |
getServerSettings() |
int |
getServerSettingsId() |
InetSocketAddress |
getSocketAddress() |
Location |
getSpawn() |
int |
getStartActionTick() |
com.nukkitx.math.vector.Vector3f |
getTeleportPosition() |
Optional<Inventory> |
getTopWindow() |
PlayerUIInventory |
getUIInventory() |
EnderChest |
getViewingEnderChest() |
Inventory |
getWindowById(int id) |
byte |
getWindowId(Inventory inventory) |
String |
getXuid() |
void |
handleDataPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet) |
boolean |
hasAchievement(String achievementId) |
boolean |
hasAutoJump()
Deprecated.
|
int |
hashCode() |
boolean |
hasMetadata(String metadataKey) |
boolean |
hasPermission(Permission permission) |
boolean |
hasPermission(String name) |
boolean |
hasPlayedBefore()
返回这个玩家以前是否来过服务器。
Returns if this player has played in this server before. |
void |
hidePlayer(Player player) |
protected void |
initEntity() |
boolean |
isAdventure() |
boolean |
isBanned()
返回这个玩家是否被封禁(ban)。
Returns if this player is banned. |
boolean |
isBreakingBlock() |
boolean |
isChunkInView(int x,
int z) |
boolean |
isConnected() |
boolean |
isCreative() |
boolean |
isEnableClientCommand() |
boolean |
isFoodEnabled() |
boolean |
isInitialized() |
boolean |
isLoaderActive() |
boolean |
isOnline()
返回这个玩家是否在线。
Returns if this player is online. |
boolean |
isOp()
返回这个对象是不是服务器管理员。
Returns if this object is an operator. |
boolean |
isPermissionSet(Permission permission) |
boolean |
isPermissionSet(String name) |
boolean |
isPlayer() |
boolean |
isSleeping() |
boolean |
isSpectator() |
boolean |
isSurvival() |
boolean |
isUsingItem()
Returns whether the player is currently using an item (right-click and hold).
|
boolean |
isWhitelisted()
返回这个玩家是否已加入白名单。
Returns if this player is pardoned by whitelist. |
boolean |
kick() |
boolean |
kick(PlayerKickEvent.Reason reason) |
boolean |
kick(PlayerKickEvent.Reason reason,
boolean isAdmin) |
boolean |
kick(PlayerKickEvent.Reason reason,
String reasonString) |
boolean |
kick(PlayerKickEvent.Reason reason,
String reasonString,
boolean isAdmin) |
boolean |
kick(String reason) |
boolean |
kick(String reason,
boolean isAdmin) |
void |
kill() |
void |
loadAdditionalData(com.nukkitx.nbt.NbtMap tag) |
void |
onChorusFruitTeleport() |
void |
onChunkChanged(Chunk chunk) |
void |
onChunkLoaded(Chunk chunk) |
void |
onChunkUnloaded(Chunk chunk) |
void |
onThrowEnderPearl() |
boolean |
onUpdate(int currentTick) |
void |
openInventory(Player who) |
boolean |
pickupEntity(Entity entity,
boolean near) |
void |
processLogin() |
protected void |
processMovement(int tickDiff) |
void |
recalculatePermissions() |
void |
removeAchievement(String achievementId) |
void |
removeAllWindows() |
void |
removeAllWindows(boolean permanent) |
void |
removeAttachment(PermissionAttachment attachment) |
void |
removeBossBar(long bossBarId)
Removes a BossBar
|
Form<?> |
removeFormWindow(int id) |
void |
removeMetadata(String metadataKey,
PluginContainer owningPlugin) |
void |
removeWindow(Inventory inventory) |
Inventory |
removeWindowById(byte id) |
void |
resetCraftingGridType() |
void |
resetFallDistance() |
void |
resetInAirTicks() |
void |
resetTitleSettings()
Resets both title animation times and subtitle for the next shown title
|
void |
save() |
void |
save(boolean async) |
void |
saveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag) |
void |
sendActionBar(String title) |
void |
sendActionBar(String title,
int fadein,
int duration,
int fadeout) |
void |
sendAllInventories() |
void |
sendAttributes() |
void |
sendChat(String message) |
void |
sendChat(String source,
String message) |
void |
sendCommandData() |
void |
sendExperience() |
void |
sendExperience(int exp) |
void |
sendExperienceLevel() |
void |
sendExperienceLevel(int level) |
void |
sendMessage(String message)
给命令发送者返回信息。
Sends a message to the command sender. |
void |
sendMessage(TextContainer message)
给命令发送者返回信息。
Sends a message to the command sender. |
boolean |
sendPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)
0 is true
-1 is false
other is identifer
|
boolean |
sendPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)
0 is true
-1 is false
other is identifer
|
void |
sendPacketInternal(com.nukkitx.protocol.bedrock.BedrockPacket packet) |
protected void |
sendPlayStatus(com.nukkitx.protocol.bedrock.packet.PlayStatusPacket.Status status) |
protected void |
sendPlayStatus(com.nukkitx.protocol.bedrock.packet.PlayStatusPacket.Status status,
boolean immediate) |
void |
sendPopup(String message) |
void |
sendPopup(String message,
String subtitle) |
void |
sendPosition(com.nukkitx.math.vector.Vector3f pos) |
void |
sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw) |
void |
sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch) |
void |
sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch,
com.nukkitx.protocol.bedrock.packet.MovePlayerPacket.Mode mode) |
void |
sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch,
com.nukkitx.protocol.bedrock.packet.MovePlayerPacket.Mode mode,
Collection<Player> targets) |
void |
sendSettings()
Deprecated.
|
void |
sendSignChange(com.nukkitx.math.vector.Vector3i position,
String[] lines)
Sends a sign change.
|
void |
sendTip(String message) |
void |
sendTitle(String title) |
void |
sendTitle(String title,
String subtitle) |
void |
sendTitle(String title,
String subtitle,
int fadeIn,
int stay,
int fadeOut) |
void |
sendTranslation(String message,
Object... parameters) |
void |
setAdventureSettings(AdventureSettings adventureSettings) |
void |
setAllowFlight(boolean value)
Deprecated.
|
void |
setAllowInteract(boolean value) |
void |
setAllowInteract(boolean value,
boolean containers) |
void |
setAllowModifyWorld(boolean value) |
void |
setAttribute(Attribute attribute) |
void |
setAutoJump(boolean value)
Deprecated.
|
void |
setBanned(boolean value)
设置这个玩家是否被封禁(ban)。
Sets this player to be banned or to be pardoned. |
void |
setButtonText(String text) |
void |
setChunkRadius(int chunkRadius) |
void |
setCraftingGrid(CraftingGrid grid) |
void |
setCraftingTransaction(CraftingTransaction craftingTransaction) |
void |
setDisplayName(String displayName) |
void |
setEnableClientCommand(boolean enable) |
void |
setExperience(int exp) |
void |
setExperience(int exp,
int level) |
void |
setFoodEnabled(boolean foodEnabled) |
void |
setForceMovement(com.nukkitx.math.vector.Vector3f forceMovement) |
boolean |
setGamemode(GameMode gamemode) |
boolean |
setGamemode(GameMode gamemode,
boolean clientSide) |
void |
setHealth(float health) |
void |
setInitialized(boolean initialized) |
void |
setLocale(Locale locale) |
void |
setLoginChainData(LoginChainData loginChainData) |
void |
setMaxHealth(int maxHealth) |
void |
setMetadata(String metadataKey,
MetadataValue newMetadataValue) |
boolean |
setMotion(com.nukkitx.math.vector.Vector3f motion) |
void |
setMovementSpeed(float speed) |
void |
setMovementSpeed(float speed,
boolean send) |
void |
setNewPosition(com.nukkitx.math.vector.Vector3f newPosition) |
void |
setOp(boolean value)
把这个对象设置成服务器管理员。
Sets this object to be an operator or not to be. |
void |
setRemoveFormat() |
void |
setRemoveFormat(boolean remove) |
int |
setServerSettings(CustomForm window)
Shows a new setting page in game settings
You can find out settings result by listening to PlayerFormRespondedEvent
|
void |
setSkin(com.nukkitx.protocol.bedrock.data.skin.SerializedSkin skin) |
void |
setSpawn(Location location) |
void |
setSprinting(boolean value) |
void |
setSubtitle(String subtitle) |
void |
setTeleportPosition(com.nukkitx.math.vector.Vector3f teleportPosition) |
void |
setTitleAnimationTimes(int fadein,
int duration,
int fadeout) |
void |
setUsingItem(boolean value) |
void |
setViewingEnderChest(EnderChest chest) |
void |
setWhitelisted(boolean value)
把这个玩家加入白名单,或者取消这个玩家的白名单。
Adds this player to the white list, or removes it from the whitelist. |
int |
showFormWindow(Form<?> window)
Shows a new FormWindow to the player
You can find out FormWindow result by listening to PlayerFormRespondedEvent
|
int |
showFormWindow(Form<?> window,
int id)
Shows a new FormWindow to the player
You can find out FormWindow result by listening to PlayerFormRespondedEvent
|
void |
showPlayer(Player player) |
void |
showXboxProfile(String xuid)
Show a window of a XBOX account's profile
|
boolean |
sleepOn(com.nukkitx.math.vector.Vector3i pos) |
void |
spawnTo(Player player) |
void |
startAction() |
void |
startFishing(Item fishingRod) |
void |
stopAction() |
void |
stopFishing(boolean click) |
void |
stopSleep() |
boolean |
switchLevel(Level level) |
boolean |
teleport(Location location,
PlayerTeleportEvent.TeleportCause cause) |
void |
teleportImmediate(Location location) |
void |
teleportImmediate(Location location,
PlayerTeleportEvent.TeleportCause cause) |
String |
toString() |
void |
transfer(InetSocketAddress address) |
void |
updateBossBar(String text,
int length,
long bossBarId)
Deprecated.
|
calculateEnchantmentProtectionFactor, despawnFrom, getBaseOffset, getEnderChestInventory, getEyeHeight, getHeight, getInventory, getLength, getServerId, getSkin, getWidth, isGliding, isSneaking, isSprinting, isSwimming, setGliding, setGliding, setOnFire, setServerId, setSneaking, setSneaking, setSprinting, setSwimming, setSwimmingcollidingWith, entityBaseTick, entityBaseTick, getAirTicks, getDrag, getGravity, getLineOfSight, getLineOfSight, getLineOfSight, getMovementSpeed, getTargetBlock, getTargetBlock, hasLineOfSight, knockBack, setAirTicksaddEffect, addMotion, attack, broadcastLinkPacket, canBeMovedByCurrents, canClimb, canClimbWalls, canCollide, canPassThrough, canTriggerPressurePlate, canTriggerWalking, checkObstruction, checkObstruction, despawnFromAll, dismount, extinguish, fall, fastMove, getAbsorption, getAir, getBlocksAround, getBoundingBox, getCardinalDirection, getCollisionBlocks, getData, getDirection, getDirectionPlane, getDirectionVector, getEffect, getEffects, getFireTicks, getHealth, getHighestPosition, getHorizontalDirection, getLastDamageCause, getLevel, getLocation, getMaxHealth, getMotion, getMountedOffset, getNameTag, getNoDamageTicks, getOwner, getPassenger, getPassengers, getPitch, getPosition, getRuntimeId, getScale, getScoreTag, getSeatPosition, getStepHeight, getTag, getType, getUniqueId, getVehicle, getViewers, getX, getY, getYaw, getZ, handleLavaMovement, hasControllingPassenger, hasEffect, hasNameTag, heal, heal, init, isAlive, isClosed, isControlling, isImmobile, isInsideOfFire, isInsideOfSolid, isInsideOfWater, isInvulnerable, isNameTagAlwaysVisible, isNameTagVisible, isOnGround, isPassenger, mount, move, move, onCollideWithPlayer, onDismount, onEntityCollision, onInteract, onInteract, onMount, onStruckByLightning, recalculateBoundingBox, recalculateEffectColor, removeAllEffects, removeEffect, respawnToAll, scheduleUpdate, sendData, sendData, sendFlags, sendPotionEffects, setAbsorption, setAir, setCanClimb, setCanClimb, setCanClimbWalls, setCanClimbWalls, setFallDistance, setHighestPosition, setImmobile, setImmobile, setInvulnerable, setLastDamageCause, setNameTag, setNameTagAlwaysVisible, setNameTagAlwaysVisible, setNameTagVisible, setNameTagVisible, setNoDamageTicks, setOnGround, setOwner, setPosition, setPositionAndRotation, setRotation, setScale, setScoreTag, setSeatPosition, spawnToAll, teleport, teleport, teleport, updateFallState, updateMovement, updatePassengerPosition, updatePassengersclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInventorygetLevel, getPosition, getX, getZgetServerIdpublic static final float DEFAULT_SPEED
public static final float MAXIMUM_SPEED
protected final com.nukkitx.protocol.bedrock.BedrockServerSession session
public boolean spawned
public boolean loggedIn
public long lastBreak
public com.nukkitx.math.vector.Vector3f speed
protected final it.unimi.dsi.fastutil.bytes.ByteSet permanentWindows
protected byte windowCnt
protected final PlayerData playerData
protected int messageCounter
protected com.nukkitx.math.vector.Vector3f forceMovement
public Player.CraftingType craftingType
protected PlayerUIInventory playerUIInventory
protected CraftingGrid craftingGrid
protected CraftingTransaction craftingTransaction
public long creationTime
protected long randomClientId
protected com.nukkitx.math.vector.Vector3f teleportPosition
protected final PlayerFood foodData
protected boolean connected
protected boolean removeFormat
protected String username
protected String iusername
protected String displayName
protected int startAction
protected com.nukkitx.math.vector.Vector3f newPosition
protected float stepHeight
protected int viewDistance
protected final int chunksPerTick
protected final int spawnThreshold
protected int inAirTicks
protected int startAirTicks
protected AdventureSettings adventureSettings
protected com.nukkitx.math.vector.Vector3i sleeping
protected Location spawnLocation
protected boolean enableClientCommand
protected int lastEnderPearl
protected int lastChorusFruitTeleport
public Block breakingBlock
public int pickedXPOrb
protected AtomicInteger formWindowCount
protected CustomForm serverSettings
protected int serverSettingsId
protected Map<Long,DummyBossBar> dummyBossBars
public FishingHook fishing
public int packetsRecieved
public long lastSkinChange
public Player(com.nukkitx.protocol.bedrock.BedrockServerSession session,
ClientChainData chainData)
public int getStartActionTick()
public void startAction()
public void stopAction()
public int getLastEnderPearlThrowingTick()
public void onThrowEnderPearl()
public int getLastChorusFruitTeleport()
public void onChorusFruitTeleport()
public EnderChest getViewingEnderChest()
public void setViewingEnderChest(EnderChest chest)
public TranslationContainer getLeaveMessage()
public String getClientSecret()
@Deprecated public Long getClientId()
public boolean isBanned()
IPlayerisBanned in interface IPlayerIPlayer.setBanned(boolean)public void setBanned(boolean value)
IPlayersetBanned in interface IPlayervalue - 如果为true,封禁这个玩家。如果为false,解封这个玩家。true for ban and false for pardon.IPlayer.isBanned()public boolean isWhitelisted()
IPlayerisWhitelisted in interface IPlayerServer.isWhitelisted(java.lang.String)public void setWhitelisted(boolean value)
IPlayersetWhitelisted in interface IPlayervalue - 如果为true,把玩家加入白名单。如果为false,取消这个玩家的白名单。true for add and false for remove.IPlayer.isWhitelisted(),
Server.addWhitelist(java.lang.String),
Server.removeWhitelist(java.lang.String)public boolean isInitialized()
public void setInitialized(boolean initialized)
public Player getPlayer()
IPlayerPlayer对象。Player object for this interface.getPlayer in interface IPlayerPlayer对象。Player object for this interface.Server.getPlayerExact(java.lang.String)public Long getFirstPlayed()
IPlayergetFirstPlayed in interface IPlayerpublic AdventureSettings getAdventureSettings()
public void setAdventureSettings(AdventureSettings adventureSettings)
public void resetInAirTicks()
@Deprecated public void setAllowFlight(boolean value)
@Deprecated public boolean getAllowFlight()
public void setAllowModifyWorld(boolean value)
public void setAllowInteract(boolean value)
public void setAllowInteract(boolean value,
boolean containers)
@Deprecated public void setAutoJump(boolean value)
@Deprecated public boolean hasAutoJump()
public Long getLastPlayed()
IPlayergetLastPlayed in interface IPlayerpublic Server getServer()
CommandSendergetServer in interface CommandSendergetServer in interface EntitygetServer in interface IPlayergetServer in class BaseEntitypublic boolean getRemoveFormat()
public void setRemoveFormat()
public void setRemoveFormat(boolean remove)
public boolean hasPlayedBefore()
IPlayer如果想得到这个玩家是不是第一次玩,可以使用:
If you want to know if this player is the first time playing in this server, you can use:
if(!player.hasPlayerBefore()) {...}hasPlayedBefore in interface IPlayerpublic boolean canSee(Player player)
public void hidePlayer(Player player)
public boolean canCollideWith(Entity entity)
canCollideWith in interface EntitycanCollideWith in class BaseEntitypublic void spawnTo(Player player)
protected com.nukkitx.protocol.bedrock.BedrockPacket createAddEntityPacket()
createAddEntityPacket in class Humanpublic boolean isOnline()
IPlayerpublic boolean isOp()
ServerOperatorisOp in interface ServerOperatorpublic void setOp(boolean value)
ServerOperatorsetOp in interface ServerOperatorvalue - true为授予管理员,false为取消管理员。true for giving this operator or false for cancelling.public boolean isPermissionSet(String name)
isPermissionSet in interface Permissiblepublic boolean isPermissionSet(Permission permission)
isPermissionSet in interface Permissiblepublic boolean hasPermission(String name)
hasPermission in interface Permissiblepublic boolean hasPermission(Permission permission)
hasPermission in interface Permissiblepublic PermissionAttachment addAttachment(PluginContainer plugin)
addAttachment in interface Permissiblepublic PermissionAttachment addAttachment(PluginContainer plugin, String name)
addAttachment in interface Permissiblepublic PermissionAttachment addAttachment(PluginContainer plugin, String name, Boolean value)
addAttachment in interface Permissiblepublic void removeAttachment(PermissionAttachment attachment)
removeAttachment in interface Permissiblepublic void recalculatePermissions()
recalculatePermissions in interface Permissiblepublic boolean isEnableClientCommand()
public void resetFallDistance()
resetFallDistance in interface EntityresetFallDistance in class BaseEntitypublic void setEnableClientCommand(boolean enable)
public Map<String,PermissionAttachmentInfo> getEffectivePermissions()
getEffectivePermissions in interface Permissiblepublic void showPlayer(Player player)
protected void initEntity()
initEntity in class Humanpublic boolean isPlayer()
isPlayer in interface CommandSenderpublic void sendCommandData()
public void removeAchievement(String achievementId)
public boolean isConnected()
public String getDisplayName()
public void setDisplayName(String displayName)
public boolean hasAchievement(String achievementId)
public void setSkin(com.nukkitx.protocol.bedrock.data.skin.SerializedSkin skin)
public String getAddress()
public InetSocketAddress getSocketAddress()
public int getPort()
public boolean isSleeping()
public int getInAirTicks()
public com.nukkitx.math.vector.Vector3f getNextPosition()
public boolean isUsingItem()
public String getButtonText()
public void setUsingItem(boolean value)
public void setButtonText(String text)
public Location getSpawn()
public void setSpawn(Location location)
protected void doFirstSpawn()
public long getPing()
public boolean sleepOn(com.nukkitx.math.vector.Vector3i pos)
public void stopSleep()
public boolean awardAchievement(String achievementId)
public GameMode getGamemode()
public boolean setGamemode(GameMode gamemode)
public boolean sendPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)
packet - packet to sendpublic void sendPacketInternal(com.nukkitx.protocol.bedrock.BedrockPacket packet)
@Deprecated public void sendSettings()
public boolean isSurvival()
public boolean isCreative()
public boolean isSpectator()
public boolean isAdventure()
public boolean sendPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)
packet - packet to sendprotected void checkBlockCollision()
checkBlockCollision in class BaseEntityprotected void checkNearEntities()
public boolean setGamemode(GameMode gamemode, boolean clientSide)
public boolean canOpenInventory()
public void openInventory(Player who)
public void closeInventory(Player who)
public boolean setMotion(com.nukkitx.math.vector.Vector3f motion)
setMotion in interface EntitysetMotion in class BaseEntitypublic void sendAttributes()
protected void checkGroundState(double movX,
double movY,
double movZ,
double dx,
double dy,
double dz)
checkGroundState in class BaseEntitypublic void checkInteractNearby()
protected void processMovement(int tickDiff)
public void addMovement(double x,
double y,
double z,
double yaw,
double pitch,
double headYaw)
addMovement in class BaseEntitypublic boolean onUpdate(int currentTick)
onUpdate in interface EntityonUpdate in class BaseEntitypublic EntityInteractable getEntityPlayerLookingAt(int maxDistance)
maxDistance - the maximum distance to check for entitiespublic boolean canInteract(com.nukkitx.math.vector.Vector3f pos,
double maxDistance)
public boolean canInteract(com.nukkitx.math.vector.Vector3f pos,
double maxDistance,
double maxDiff)
public void completeLoginSequence()
public void checkNetwork()
public void processLogin()
public boolean chat(String message)
message - message to sendpublic boolean kick()
public boolean kick(String reason, boolean isAdmin)
public boolean kick(String reason)
public boolean kick(PlayerKickEvent.Reason reason)
public boolean kick(PlayerKickEvent.Reason reason, String reasonString)
public boolean kick(PlayerKickEvent.Reason reason, boolean isAdmin)
public boolean kick(PlayerKickEvent.Reason reason, String reasonString, boolean isAdmin)
public void handleDataPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)
public int getChunkRadius()
public String getXuid()
public void sendMessage(String message)
CommandSendersendMessage in interface CommandSendermessage - 要发送的信息。TextFormatpublic void sendMessage(TextContainer message)
CommandSendersendMessage in interface CommandSendermessage - 要发送的信息。public void sendChat(String message)
public void sendPopup(String message)
public void sendTip(String message)
public void clearTitle()
public void resetTitleSettings()
public void setSubtitle(String subtitle)
public void setTitleAnimationTimes(int fadein,
int duration,
int fadeout)
public void sendTitle(String title)
public void sendActionBar(String title)
public void sendActionBar(String title, int fadein, int duration, int fadeout)
public void close(String message)
public void close(TextContainer message)
public void close(TextContainer message, String reason)
public void setChunkRadius(int chunkRadius)
public void save()
public PlayerChunkManager getChunkManager()
public String getName()
CommandSender如果命令发送者是一个玩家,将会返回他的玩家名字(name)不是显示名字(display name)。
如果命令发送者是控制台,将会返回"CONSOLE"。
If this command sender is a player, will return his/her player name(not display name).
If it is a console, will return "CONSOLE".
当你需要判断命令的执行者是不是控制台时,可以用这个:
When you need to determine if the sender is a console, use this:
if(sender instanceof ConsoleCommandSender) .....;
getName in interface CommandSendergetName in interface EntitygetName in interface IPlayergetName in class HumangetName(),
ConsoleCommandSender.getName(),
PluginDescriptionpublic com.nukkitx.math.vector.Vector3f getTeleportPosition()
public void setTeleportPosition(com.nukkitx.math.vector.Vector3f teleportPosition)
public com.nukkitx.math.vector.Vector3f getForceMovement()
public void setForceMovement(com.nukkitx.math.vector.Vector3f forceMovement)
public com.nukkitx.math.vector.Vector3f getNewPosition()
public void setNewPosition(com.nukkitx.math.vector.Vector3f newPosition)
public void close(TextContainer message, String reason, boolean notify)
public void setHealth(float health)
setHealth in interface EntitysetHealth in class EntityLivingpublic void setMaxHealth(int maxHealth)
setMaxHealth in interface EntitysetMaxHealth in class BaseEntitypublic int getExperience()
public int getExperienceLevel()
public void addExperience(int add)
public static int calculateRequireExperience(int level)
public void setExperience(int exp)
public void setExperience(int exp,
int level)
public void sendExperience()
public void sendExperience(int exp)
public void sendExperienceLevel()
public void sendExperienceLevel(int level)
public void setAttribute(Attribute attribute)
public void setMovementSpeed(float speed)
setMovementSpeed in class EntityLivingpublic void setMovementSpeed(float speed,
boolean send)
public Entity getKiller()
public boolean attack(EntityDamageEvent source)
public boolean dropItem(Item item)
item - to droppublic void sendPosition(com.nukkitx.math.vector.Vector3f pos)
public void sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw)
public void sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch)
public void sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch,
com.nukkitx.protocol.bedrock.packet.MovePlayerPacket.Mode mode)
public void sendPosition(com.nukkitx.math.vector.Vector3f pos,
double yaw,
double pitch,
com.nukkitx.protocol.bedrock.packet.MovePlayerPacket.Mode mode,
Collection<Player> targets)
public void loadAdditionalData(com.nukkitx.nbt.NbtMap tag)
loadAdditionalData in interface EntityloadAdditionalData in class Humanpublic void saveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag)
saveAdditionalData in interface EntitysaveAdditionalData in class Humanpublic void save(boolean async)
public void kill()
kill in interface Entitykill in class EntityLivingprotected void sendPlayStatus(com.nukkitx.protocol.bedrock.packet.PlayStatusPacket.Status status)
protected void sendPlayStatus(com.nukkitx.protocol.bedrock.packet.PlayStatusPacket.Status status,
boolean immediate)
protected void checkChunks()
checkChunks in class BaseEntitypublic void teleportImmediate(Location location)
public void teleportImmediate(Location location, PlayerTeleportEvent.TeleportCause cause)
public int showFormWindow(Form<?> window)
window - to showpublic int showFormWindow(Form<?> window, int id)
window - to showid - form idpublic Form<?> removeFormWindow(int id)
public CustomForm getServerSettings()
public int getServerSettingsId()
public int setServerSettings(CustomForm window)
window - to show on settings page@Deprecated public long createBossBar(String text, int length)
text - The BossBar messagelength - The BossBar percentagepublic long createBossBar(DummyBossBar dummyBossBar)
dummyBossBar - DummyBossBar Object (Instantiate it by the Class Builder)DummyBossBar.Builderpublic DummyBossBar getDummyBossBar(long bossBarId)
bossBarId - The BossBar IDSet BossBar text,
Set BossBar length,
Set BossBar colorpublic Map<Long,DummyBossBar> getDummyBossBars()
@Deprecated public void updateBossBar(String text, int length, long bossBarId)
text - The new BossBar messagelength - The new BossBar lengthbossBarId - The BossBar IDpublic void removeBossBar(long bossBarId)
bossBarId - The BossBar IDpublic byte getWindowId(Inventory inventory)
public Inventory getWindowById(int id)
public int addWindow(Inventory inventory)
public void removeWindow(Inventory inventory)
public Inventory removeWindowById(byte id)
public void sendAllInventories()
protected void addDefaultWindows()
public PlayerUIInventory getUIInventory()
public PlayerCursorInventory getCursorInventory()
public CraftingTransaction getCraftingTransaction()
public void setCraftingTransaction(CraftingTransaction craftingTransaction)
public CraftingGrid getCraftingGrid()
public void setCraftingGrid(CraftingGrid grid)
public void resetCraftingGridType()
public void removeAllWindows()
public void removeAllWindows(boolean permanent)
public void setMetadata(String metadataKey, MetadataValue newMetadataValue)
setMetadata in interface MetadatablesetMetadata in class BaseEntitypublic List<MetadataValue> getMetadata(String metadataKey)
getMetadata in interface MetadatablegetMetadata in class BaseEntitypublic boolean hasMetadata(String metadataKey)
hasMetadata in interface MetadatablehasMetadata in class BaseEntitypublic void removeMetadata(String metadataKey, PluginContainer owningPlugin)
removeMetadata in interface MetadatableremoveMetadata in class BaseEntityprotected boolean checkTeleportPosition()
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause)
teleport in interface Entityteleport in class BaseEntitypublic boolean isChunkInView(int x,
int z)
public void onChunkChanged(Chunk chunk)
onChunkChanged in interface ChunkLoaderpublic int getLoaderId()
getLoaderId in interface ChunkLoaderpublic boolean isLoaderActive()
isLoaderActive in interface ChunkLoaderpublic boolean isFoodEnabled()
public void setFoodEnabled(boolean foodEnabled)
public PlayerFood getFoodData()
public void onChunkLoaded(Chunk chunk)
onChunkLoaded in interface ChunkLoaderpublic void setLocale(Locale locale)
public Locale getLocale()
public void setSprinting(boolean value)
setSprinting in class Humanpublic void transfer(InetSocketAddress address)
public LoginChainData getLoginChainData()
public void setLoginChainData(LoginChainData loginChainData)
public void onChunkUnloaded(Chunk chunk)
onChunkUnloaded in interface ChunkLoaderpublic boolean isBreakingBlock()
public void showXboxProfile(String xuid)
xuid - XUIDpublic void sendSignChange(com.nukkitx.math.vector.Vector3i position,
String[] lines)
position - the position of the signlines - the lines to sendpublic void startFishing(Item fishingRod)
public void stopFishing(boolean click)
public boolean switchLevel(Level level)
switchLevel in class BaseEntitypublic boolean pickupEntity(Entity entity, boolean near)
public String toString()
toString in class BaseEntityCopyright © 2020. All rights reserved.