Player
Extends Human
Implements CommandSender, ChunkListener, IPlayer, NeverSavedWithChunkEntity
Main class that handles networking, recovery, and packet sending to the server part
Constants
DEFAULT_FLIGHT_SPEED_MULTIPLIER
public const DEFAULT_FLIGHT_SPEED_MULTIPLIER = 0.05TAG_FIRST_PLAYED
public const TAG_FIRST_PLAYED = "firstPlayed"TAG_LAST_KNOWN_XUID
public const TAG_LAST_KNOWN_XUID = "LastKnownXUID"TAG_LAST_PLAYED
public const TAG_LAST_PLAYED = "lastPlayed"TAG_LEVEL
public const TAG_LEVEL = "Level"TAG_TIME_SINCE_REST 5.46.0
public const TAG_TIME_SINCE_REST = "TimeSinceRest"TAG_WARDEN_SPAWN_TRACKER 5.46.0
public const TAG_WARDEN_SPAWN_TRACKER = "WardenSpawnTracker"Properties
$allowFlight protected
protected bool $allowFlight$authenticated protected
protected bool $authenticated$autoJump protected
protected bool $autoJump$blockBreakHandler protected
protected ?\pocketmine\player\SurvivalBlockBreakHandler $blockBreakHandler$blockCollision protected
protected bool $blockCollision$blocking 5.46.0 protected
protected bool $blockingWhether the raised shield is currently blocking (raised for at least Shield::BLOCK_DELAY_TICKS).
$chunkLoader protected
protected \pocketmine\world\ChunkLoader $chunkLoader$chunkSelector protected
protected \pocketmine\player\ChunkSelector $chunkSelector$chunkTicker protected
protected \pocketmine\world\ChunkTicker $chunkTicker$chunksPerTick protected
protected int $chunksPerTick$craftingGrid protected
protected \pocketmine\inventory\PlayerCraftingInventory $craftingGrid$creativeInventory protected
protected \pocketmine\inventory\CreativeInventory $creativeInventory$currentWindow protected
protected ?\pocketmine\inventory\Inventory $currentWindow$cursorInventory protected
protected \pocketmine\inventory\PlayerCursorInventory $cursorInventory$displayName protected
protected string $displayName$firstPlayed protected
protected int $firstPlayed$flightSpeedMultiplier protected
protected float $flightSpeedMultiplier$flying protected
protected bool $flying$formIdCounter protected
protected int $formIdCounter$forms protected
protected array $forms$gamemode protected
protected \pocketmine\player\GameMode $gamemode$glideTicks 5.46.0 protected
protected int $glideTicksTicks spent gliding since the player started, used for elytra durability loss.
$hiddenPlayers protected
protected array $hiddenPlayers$inAirTicks protected
protected int $inAirTicks$lastGlideHorizontalSpeed 5.46.0 protected
protected float $lastGlideHorizontalSpeedHorizontal distance moved during the previous tick while gliding, used for kinetic (fly into wall) damage.
$lastGlideTickPosition 5.46.0 protected
protected ?\pocketmine\math\Vector3 $lastGlideTickPosition$lastMovementProcess protected
protected ?float $lastMovementProcess$lastPlayed protected
protected int $lastPlayed$lastSpearChargeHitTick 5.46.0 protected
protected int $lastSpearChargeHitTickServer tick of the last spear charge hit.
$lineHeight protected
protected ?int $lineHeight$loadQueue protected
protected array $loadQueue$locale protected
protected string $locale$logger protected
protected \Logger $logger$messageCounter protected
protected int $messageCounter$moveRateLimit protected
protected float $moveRateLimit$networkSession protected
protected ?\pocketmine\network\mcpe\NetworkSession $networkSession$nextChunkOrderRun protected
protected int $nextChunkOrderRun$permanentWindows protected
protected array $permanentWindows$playerInfo protected
protected \pocketmine\player\PlayerInfo $playerInfo$previousTickPosition 5.46.0 protected
protected ?\pocketmine\math\Vector3 $previousTickPosition$shieldRaisedTick 5.46.0 protected
protected int $shieldRaisedTickServer tick on which the player raised a shield, or -1 if no shield is raised.
$sleeping protected
protected ?\pocketmine\math\Vector3 $sleeping$sneakPressed protected
protected bool $sneakPressed$spawnChunkLoadCount protected
protected int $spawnChunkLoadCount$spawnThreshold protected
protected int $spawnThreshold$spawned
public bool $spawned$startAction protected
protected int $startAction$stepHeight protected
protected float $stepHeight$tickMovement 5.46.0 protected
protected \pocketmine\math\Vector3 $tickMovementDistance moved during the last tick (blocks/tick), measured from the positions the client reported.
$timeSinceRest 5.46.0 protected
protected int $timeSinceRestTicks since the player last entered a bed or died (Bedrock "Time Since Last Rest", used by phantom spawning).
$usedChunks protected
protected array $usedChunks$usedItemsCooldown protected
protected array $usedItemsCooldown$username protected
protected string $username$viewDistance protected
protected int $viewDistance$xuid protected
protected string $xuidMethods
__construct()
public function __construct(\pocketmine\Server $server, \pocketmine\network\mcpe\NetworkSession $session, \pocketmine\player\PlayerInfo $playerInfo, bool $authenticated, \pocketmine\entity\Location $spawnLocation, ?\pocketmine\nbt\tag\CompoundTag $namedtag)__debugInfo()
public function __debugInfo() : array__destruct()
public function __destruct()actuallyRespawn() protected
protected function actuallyRespawn() : voidaddDefaultWindows() protected
protected function addDefaultWindows() : voidaddPermanentInventories() protected
protected function addPermanentInventories(\pocketmine\inventory\Inventory ...$inventories) : voidapplyPostDamageEffects() protected
protected function applyPostDamageEffects(\pocketmine\event\entity\EntityDamageEvent $source) : voidattack()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidattackBlock()
public function attackBlock(\pocketmine\math\Vector3 $pos, int $face) : boolPerforms a left-click (attack) action on the block.
attackEntity()
public function attackEntity(\pocketmine\entity\Entity $entity) : boolAttacks the given entity with the currently-held item. TODO: move this up the class hierarchy
breakBlock()
public function breakBlock(\pocketmine\math\Vector3 $pos) : boolBreaks the block at the given position using the currently-held item.
broadcastAnimation()
public function broadcastAnimation(\pocketmine\entity\animation\Animation $animation, ?array $targets = null) : voidbroadcastMovement() 5.46.0 protected
protected function broadcastMovement(bool $teleport = false) : voidSends this player's movement to viewers, less often to the ones far away (see player.movement-broadcast in pocketmine.yml): with N players in view every movement goes to every viewer every tick, which is N^2 packets. Teleports always go to everyone.
broadcastSound()
public function broadcastSound(\pocketmine\world\sound\Sound $sound, ?array $targets = null) : voidcalculateFallDamage() protected
protected function calculateFallDamage(float $fallDistance) : floatcalculateKineticDamage() 5.46.0
public static function calculateKineticDamage(float $previousHorizontalSpeed, float $horizontalSpeed) : floatDamage taken when a gliding entity loses horizontal speed by hitting a wall: (speed lost in blocks/tick) * 10 - 3 (https://minecraft.wiki/w/Elytra, "Kinetic damage").
canBeCollidedWith()
public function canBeCollidedWith() : boolcanBeMovedByCurrents()
public function canBeMovedByCurrents() : boolcanBeRenamed()
public function canBeRenamed() : boolcanBlockWithShield() 5.46.0 protected
protected function canBlockWithShield(\pocketmine\event\entity\EntityDamageEvent $source) : boolReturns whether the given damage would be stopped by the player's raised shield: melee and projectile attacks whose source is in front of the player.
canBreathe()
public function canBreathe() : boolcanCollideWith()
public function canCollideWith(\pocketmine\entity\Entity $entity) : boolcanEat()
public function canEat() : boolcanInteract()
public function canInteract(\pocketmine\math\Vector3 $pos, float $maxDistance, float $maxDiff = \M_SQRT3 / 2) : boolReturns whether the player can interact with the specified position. This checks distance and direction.
canSaveWithChunk()
public function canSaveWithChunk() : boolcanSee()
public function canSee(\pocketmine\player\Player $player) : boolchangeSkin()
public function changeSkin(\pocketmine\entity\Skin $skin, string $newSkinName, string $oldSkinName) : boolCalled when a player changes their skin. Plugin developers should not use this, use setSkin() and sendSkin() instead.
chat()
public function chat(string $message) : boolSends a chat message as this player. If the message begins with a / (forward-slash) it will be treated as a command.
checkGroundState() protected
protected function checkGroundState(float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz) : voidcheckItemCooldowns() protected
protected function checkItemCooldowns() : voidcheckNearEntities() protected
protected function checkNearEntities() : voidcloseAllForms()
public function closeAllForms() : voidCloses the current viewing form and forms in queue.
completeChargingHeldItem() 5.46.0
public function completeChargingHeldItem() : boolCalled when the client reports that the Chargeable item it is using finished charging (e.g. a crossbow). Stops using the item and loads it if it was charged for long enough.
consumeHeldItem()
public function consumeHeldItem() : boolConsumes the currently-held item.
continueBreakBlock()
public function continueBreakBlock(\pocketmine\math\Vector3 $pos, int $face) : voiddestroyCycles() protected
protected function destroyCycles() : voiddisconnect()
public function disconnect(\pocketmine\lang\Translatable|string $reason, \pocketmine\lang\Translatable|string|null $quitMessage = null, \pocketmine\lang\Translatable|string|null $disconnectScreenMessage = null) : voidRemoves the player from the server. This cannot be cancelled. This is used for remote disconnects and for uninterruptible disconnects (for example, when the server shuts down).
Note for plugin developers: Prefer kick() instead of this method. That way other plugins can have a say in whether the player is removed or not.
Note for internals developers: Do not call this from network sessions. It will cause a feedback loop.
doChunkRequests()
public function doChunkRequests() : voidTicks the chunk-requesting mechanism.
doFirstSpawn()
public function doFirstSpawn() : voidCalled by the network system when the pre-spawn sequence is completed (e.g. after sending spawn chunks). This fires join events and broadcasts join messages to other online players.
dropItem()
public function dropItem(\pocketmine\item\Item $item) : voidDrops an item on the ground in front of the player.
emote()
public function emote(string $emoteId) : voidgetAllowFlight()
public function getAllowFlight() : boolReturns whether the player is allowed to toggle its flight state.
If false, the player is locked in its current flight mode (flying/not flying), and attempts by the player to enter or exit flight mode will be prevented.
getCraftingGrid()
public function getCraftingGrid() : \pocketmine\crafting\CraftingGridgetCreativeInventory()
public function getCreativeInventory() : \pocketmine\inventory\CreativeInventoryReturns the creative inventory shown to the player. Unless changed by a plugin, this is usually the same for all players.
getCurrentWindow()
public function getCurrentWindow() : ?\pocketmine\inventory\InventoryReturns the inventory the player is currently viewing. This might be a chest, furnace, or any other container.
getCursorInventory()
public function getCursorInventory() : \pocketmine\inventory\PlayerCursorInventorygetDeathPosition()
public function getDeathPosition() : ?\pocketmine\world\PositiongetDisplayName()
public function getDisplayName() : stringReturns the "friendly" display name of this player to use in the chat.
getDrops()
public function getDrops() : arraygetFirstPlayed()
public function getFirstPlayed() : ?intTODO: not sure this should be nullable
getFlightSpeedMultiplier()
public function getFlightSpeedMultiplier() : floatReturns the player's flight speed multiplier.
Normal flying speed in blocks-per-tick is (multiplier * 10) blocks per tick. When sprint-flying, this is doubled to 20.
If set to zero, the player will not be able to move in the xz plane when flying. Negative values will invert the controls.
getGamemode()
public function getGamemode() : \pocketmine\player\GameModegetHeldShield() 5.46.0
public function getHeldShield() : ?\pocketmine\item\ShieldReturns the shield the player would raise: the one in the main hand, or else the one in the off hand.
getInAirTicks()
public function getInAirTicks() : intgetInteractiveTag() 5.46.0
public function getInteractiveTag() : stringgetItemCooldownExpiry()
public function getItemCooldownExpiry(\pocketmine\item\Item $item) : intReturns the server tick on which the player's cooldown period expires for the given item.
getItemUseDuration()
public function getItemUseDuration() : intReturns how long the player has been using their currently-held item for. Used for determining arrow shoot force for bows.
getLanguage()
public function getLanguage() : \pocketmine\lang\LanguageReturns the language used to translate messages sent to this player. This is the player's game language if per-player languages are enabled and a translation exists for it, otherwise the server language.
getLastPlayed()
public function getLastPlayed() : ?intTODO: not sure this should be nullable
getLeaveMessage()
public function getLeaveMessage() : \pocketmine\lang\Translatable|stringgetLocale()
public function getLocale() : stringReturns the player's locale, e.g. en_US.
getName()
public function getName() : stringGets the username
getNetworkSession()
public function getNetworkSession() : \pocketmine\network\mcpe\NetworkSessiongetPlayerInfo()
public function getPlayerInfo() : \pocketmine\player\PlayerInfoReturns an object containing information about the player, such as their username, skin, and misc extra client-specific data.
getSaveData()
public function getSaveData() : \pocketmine\nbt\tag\CompoundTaggetScreenLineHeight()
public function getScreenLineHeight() : intgetServer()
public function getServer() : \pocketmine\ServergetSleepingPosition() 5.46.0
public function getSleepingPosition() : ?\pocketmine\math\Vector3Position of the bed the player is sleeping in, or null when awake.
getSpawn()
public function getSpawn()getTickMovement() 5.46.0
public function getTickMovement() : \pocketmine\math\Vector3Returns how far the player moved during the last tick (blocks/tick), as reported by the client.
getTimeSinceRest() 5.46.0
public function getTimeSinceRest() : intReturns the number of ticks since the player last entered a bed or died (Bedrock "Time Since Last Rest"). Phantoms spawn around players who have not rested for 3 days (72000 ticks).
getUniqueId()
public function getUniqueId() : \Ramsey\Uuid\UuidInterfaceReturns the player's UUID. This should be the preferred method to identify a player. It does not change if the player changes their username.
All players will have a UUID, regardless of whether they are logged into Xbox Live or not. However, note that non-XBL players can fake their UUIDs.
getUsedChunkStatus()
public function getUsedChunkStatus(int $chunkX, int $chunkZ) : ?\pocketmine\player\UsedChunkStatusReturns a usage status of the given chunk, or null if the player is not using the given chunk.
getUsedChunks()
public function getUsedChunks() : arraygetViewDistance()
public function getViewDistance() : intgetWardenSpawnTracker() 5.46.0
public function getWardenSpawnTracker() : \pocketmine\entity\monster\WardenSpawnTrackerReturns the player's warning level towards wardens, raised by sculk shriekers (see \pocketmine\block\SculkShrieker).
getXpDropAmount()
public function getXpDropAmount() : intgetXuid()
public function getXuid() : stringIf the player is logged into Xbox Live, returns their Xbox user ID (XUID) as a string. Returns an empty string if the player is not logged into Xbox Live.
handleMovement()
public function handleMovement(\pocketmine\math\Vector3 $newPos) : voidAttempts to move the player to the given coordinates. Unless you have some particularly specialized logic, you probably want to use teleport() instead of this.
This is used for processing movements sent by the player over network.
hasAutoJump()
public function hasAutoJump() : boolhasBlockCollision()
public function hasBlockCollision() : boolReturns whether blocks may obstruct the player's movement. If false, the player can move through any block unobstructed.
hasFiniteResources()
public function hasFiniteResources() : boolTODO: make this a dynamic ability instead of being hardcoded
hasItemCooldown()
public function hasItemCooldown(\pocketmine\item\Item $item) : boolReturns whether the player has a cooldown period left before it can use the given item again.
hasPlayedBefore()
public function hasPlayedBefore() : boolhasReceivedChunk()
public function hasReceivedChunk(int $chunkX, int $chunkZ) : boolReturns whether the target chunk has been sent to this player.
hasUsableElytra() 5.46.0
public function hasUsableElytra() : boolReturns whether the player wears an elytra in the chest slot that can be used to glide (more than 1 durability left).
hasValidCustomSpawn()
public function hasValidCustomSpawn() : boolhidePlayer()
public function hidePlayer(\pocketmine\player\Player $player) : voidinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidinitHumanData() protected
protected function initHumanData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidinteractBlock()
public function interactBlock(\pocketmine\math\Vector3 $pos, int $face, \pocketmine\math\Vector3 $clickOffset) : boolTouches the block at the given position with the currently-held item.
interactEntity()
public function interactEntity(\pocketmine\entity\Entity $entity, \pocketmine\math\Vector3 $clickPos) : boolInteracts with the given entity using the currently-held item.
internalSetGameMode() protected
protected function internalSetGameMode(\pocketmine\player\GameMode $gameMode) : voidisAdventure()
public function isAdventure(bool $literal = false) : boolNOTE: Because Adventure and Spectator Mode share some similar behaviour, this method will also return true if the player is in Spectator Mode. Supply the $literal parameter as true to force a literal Adventure Mode check.
isAuthenticated()
public function isAuthenticated() : boolisBlocking() 5.46.0
public function isBlocking() : boolReturns whether the player is blocking with a raised shield.
isConnected()
public function isConnected() : boolisCreative()
public function isCreative(bool $literal = false) : boolNOTE: Because Creative and Spectator Mode share some similar behaviour, this method will also return true if the player is in Spectator Mode. Supply the $literal parameter as true to force a literal Creative Mode check.
isFlying()
public function isFlying() : boolisOnline()
public function isOnline() : boolisSleeping()
public function isSleeping() : boolisSneakPressed()
public function isSneakPressed() : boolReturns whether the player is pressing the sneak key. The player may still be sneaking even if this is false due to gameplay mechanics (e.g. releasing sneak while in a 1.5 block high space).
isSpectator()
public function isSpectator() : boolisSurvival()
public function isSurvival(bool $literal = false) : boolNOTE: Because Survival and Adventure Mode share some similar behaviour, this method will also return true if the player is in Adventure Mode. Supply the $literal parameter as true to force a literal Survival Mode check.
isUsingChunk()
public function isUsingChunk(int $chunkX, int $chunkZ) : boolReturns whether the player is using the chunk with the given coordinates, irrespective of whether the chunk has been sent yet.
isUsingItem()
public function isUsingItem() : boolReturns whether the player is currently using an item (right-click and hold).
isValidUserName()
public static function isValidUserName(?string $name) : boolValidates the given username.
jump()
public function jump() : voidkick()
public function kick(\pocketmine\lang\Translatable|string $reason = "", \pocketmine\lang\Translatable|string|null $quitMessage = null, \pocketmine\lang\Translatable|string|null $disconnectScreenMessage = null) : boolKicks a player from the server
lowerShield() 5.46.0
public function lowerShield() : voidLowers the shield, if raised; it needs to be raised for Shield::BLOCK_DELAY_TICKS again to block.
missSwing()
public function missSwing() : voidPerforms actions associated with the attack action (left-click) without a target entity. Under normal circumstances, this will just play the no-damage attack sound and the arm-swing animation.
onBlockChanged()
public function onBlockChanged(\pocketmine\math\Vector3 $block) : voidonChunkChanged()
public function onChunkChanged(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : voidonChunkUnloaded()
public function onChunkUnloaded(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : voidonDeath() protected
protected function onDeath() : voidonDeathUpdate() protected
protected function onDeathUpdate(int $tickDiff) : boolonDispose() protected
protected function onDispose() : voidonFormSubmit()
public function onFormSubmit(int $formId, mixed $responseData) : boolonShieldBlock() 5.46.0 protected
protected function onShieldBlock(\pocketmine\event\entity\EntityDamageByEntityEvent $source) : voidApplies the effects of a blocked attack: shield durability, sound, knocking back melee attackers and axes disabling the shield.
onSpearJab() 5.46.0 protected
protected function onSpearJab(\pocketmine\item\Spear $spear) : voidCalled when the player jabs with a spear (attack button, hitting an entity or not): starts the use cooldown shared by all spears and applies Lunge.
onUpdate()
public function onUpdate(int $currentTick) : boolopenSignEditor()
public function openSignEditor(\pocketmine\math\Vector3 $position, bool $frontFace = true) : voidOpens the player's sign editor GUI for the sign at the given position.
orderChunks() protected
protected function orderChunks() : voidCalculates which new chunks this player needs to use, and which currently-used chunks it needs to stop using. This is based on factors including the player's current render radius and current position.
pickBlock()
public function pickBlock(\pocketmine\math\Vector3 $pos, bool $addTileNBT) : boolpickEntity()
public function pickEntity(int $entityId) : boolprocessMostRecentMovements() protected
protected function processMostRecentMovements() : voidFires movement events and synchronizes player movement, every tick.
releaseHeldItem()
public function releaseHeldItem() : boolremoveCurrentWindow()
public function removeCurrentWindow() : voidremovePermanentInventories() protected
protected function removePermanentInventories() : voidremoveTitles()
public function removeTitles() : voidRemoves the title from the client's screen.
requestChunks() protected
protected function requestChunks() : voidRequests chunks from the world to be sent, up to a set limit every tick. This operates on the results of the most recent chunk order.
resetFallDistance()
public function resetFallDistance() : voidresetItemCooldown()
public function resetItemCooldown(\pocketmine\item\Item $item, ?int $ticks = null) : voidResets the player's cooldown time for the given item back to the maximum.
resetTitles()
public function resetTitles() : voidResets the title duration settings to defaults and removes any existing titles.
respawn()
public function respawn() : voidrevertMovement() protected
protected function revertMovement(\pocketmine\entity\Location $from) : voidsave()
public function save() : voidHandles player data saving
selectHotbarSlot()
public function selectHotbarSlot(int $hotbarSlot) : boolsendActionBarMessage()
public function sendActionBarMessage(string $message) : voidAdds small text to the user's screen.
sendData()
public function sendData(?array $targets, ?array $data = null) : voidsendForm()
public function sendForm(\pocketmine\form\Form $form) : voidSends a Form to the player, or queue to send it if a form is already open.
sendJukeboxPopup()
public function sendJukeboxPopup(\pocketmine\lang\Translatable|string $message) : voidsendMessage()
public function sendMessage(\pocketmine\lang\Translatable|string $message) : voidSends a direct chat message to a player
sendPopup()
public function sendPopup(string $message) : voidSends a popup message to the player
TODO: add translation type popups
sendPosition() protected
protected function sendPosition(\pocketmine\math\Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = \pocketmine\network\mcpe\protocol\MovePlayerPacket::MODE_NORMAL) : voidTODO: remove this
sendSkin()
public function sendSkin(?array $targets = null) : void{@inheritdoc}
If null is given, will additionally send the skin to the player itself as well as its viewers.
sendSubTitle()
public function sendSubTitle(string $subtitle) : voidSets the subtitle message, without sending a title.
sendTip()
public function sendTip(string $message) : voidsendTitle()
public function sendTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1) : voidAdds a title text to the user's screen, with an optional subtitle.
sendToastNotification()
public function sendToastNotification(string $title, string $body) : voidSends a toast message to the player, or queue to send it if a toast message is already shown.
setAllowFlight()
public function setAllowFlight(bool $value) : voidSets whether the player is allowed to toggle flight mode.
If set to false, the player will be locked in its current flight mode (flying/not flying), and attempts by the player to enter or exit flight mode will be prevented.
Note: Setting this to false DOES NOT change whether the player is currently flying. Use Player::setFlying() for that purpose.
setAutoJump()
public function setAutoJump(bool $value) : voidsetCanSaveWithChunk()
public function setCanSaveWithChunk(bool $value) : voidsetCreativeInventory()
public function setCreativeInventory(\pocketmine\inventory\CreativeInventory $inventory) : voidTo set a custom creative inventory, you need to make a clone of a CreativeInventory instance.
setCurrentWindow()
public function setCurrentWindow(\pocketmine\inventory\Inventory $inventory) : boolOpens an inventory window to the player. Returns if it was successful.
setDeathPosition()
public function setDeathPosition(?\pocketmine\math\Vector3 $pos) : voidsetDisplayName()
public function setDisplayName(string $name) : voidsetFlightSpeedMultiplier()
public function setFlightSpeedMultiplier(float $flightSpeedMultiplier) : voidSets the player's flight speed multiplier.
Normal flying speed in blocks-per-tick is (multiplier * 10) blocks per tick. When sprint-flying, this is doubled to 20.
If set to zero, the player will not be able to move in the xz plane when flying. Negative values will invert the controls.
Note: Movement speed attribute does not influence flight speed.
setFlying()
public function setFlying(bool $value) : voidsetGamemode()
public function setGamemode(\pocketmine\player\GameMode $gm) : boolSets the provided gamemode.
setGliding() 5.46.0
public function setGliding(bool $value = true) : voidsetHasBlockCollision()
public function setHasBlockCollision(bool $value) : voidSets whether the player's movement may be obstructed by blocks with collision boxes. If set to false, the player can move through any block unobstructed.
Note: Enabling flight mode in conjunction with this is recommended. A non-flying player will simply fall through the ground into the void.
setInteractiveTag() 5.46.0
public function setInteractiveTag(string $tag) : voidSets the text of the interaction button shown to the player (touch controls), e.g. "action.interact.ride.horse", or "" for none. Updated when the client reports the entity it points at (InteractPacket MOUSEOVER).
setMotion()
public function setMotion(\pocketmine\math\Vector3 $motion) : boolsetPosition() protected
protected function setPosition(\pocketmine\math\Vector3 $pos) : boolsetScreenLineHeight()
public function setScreenLineHeight(?int $height) : voidsetSneakPressed()
public function setSneakPressed(bool $sneakPressed) : voidsetSpawn()
public function setSpawn(?\pocketmine\math\Vector3 $pos) : voidSets the spawnpoint of the player (and the compass direction) to a Vector3, or set it on another world with a Position object
setTimeSinceRest() 5.46.0
public function setTimeSinceRest(int $ticks) : voidsetTitleDuration()
public function setTitleDuration(int $fadeIn, int $stay, int $fadeOut) : voidSets the title duration.
setUsingItem()
public function setUsingItem(bool $value) : voidsetViewDistance()
public function setViewDistance(int $distance) : voidshowPlayer()
public function showPlayer(\pocketmine\player\Player $player) : voidsleepOn()
public function sleepOn(\pocketmine\math\Vector3 $pos) : boolspawnEntitiesOnAllChunks() protected
protected function spawnEntitiesOnAllChunks() : voidspawnEntitiesOnChunk() protected
protected function spawnEntitiesOnChunk(int $chunkX, int $chunkZ) : voidspawnTo()
public function spawnTo(\pocketmine\player\Player $player) : voidstopBreakBlock()
public function stopBreakBlock(\pocketmine\math\Vector3 $pos) : voidstopSleep()
public function stopSleep() : voidsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : voidteleport()
public function teleport(\pocketmine\math\Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : booltickGliding() 5.46.0 protected
protected function tickGliding() : voidElytra upkeep, run every tick: 1 durability per second of gliding (vanilla), gliding stops when the elytra is removed or worn down to 1 durability, and flying into a wall hurts (kinetic energy).
tickShield() 5.46.0 protected
protected function tickShield() : voidOn Bedrock the shield is raised by sneaking with it in either hand (or by using it from the main hand) and blocks after a short delay.
tickSpearCharge() 5.46.0 protected
protected function tickSpearCharge(\pocketmine\item\Spear $spear) : voidSpear charge attack, run every tick while the player holds "use" with a spear: once the activation delay has passed, hits the first entity the spear points at, dealing damage proportional to the relative speed.
toggleFlight()
public function toggleFlight(bool $fly) : booltoggleGlide()
public function toggleGlide(bool $glide) : booltoggleSneak()
public function toggleSneak(bool $sneak, bool $sneakPressed = true) : booltoggleSprint()
public function toggleSprint(bool $sprint) : booltoggleSwim()
public function toggleSwim(bool $swim) : booltransfer()
public function transfer(string $address, int $port = 19132, \pocketmine\lang\Translatable|string|null $message = null) : boolTransfers a player to another server.
tryChangeMovement() protected
protected function tryChangeMovement() : voidunloadChunk() protected
protected function unloadChunk(int $x, int $z, ?\pocketmine\world\World $world = null) : voidupdateFallState() 5.46.0 protected
protected function updateFallState(float $distanceThisTick, bool $onGround) : ?floatupdateMovement() protected
protected function updateMovement(bool $teleport = false) : voiduseHeldItem()
public function useHeldItem() : boolActivates the item in hand, for example throwing a projectile.
