Skip to content

Class endstone::Player

ClassList > endstone > Player

Represents a player.

  • #include <endstone/player.h>

Inherits the following classes: endstone::Mob

Public Functions

Type Name
virtual AbilityValue _getAbility (Identifier< Ability > ability) const = 0
Gets the value of an ability.
virtual bool _setAbility (Identifier< Ability > ability, AbilityValue value) = 0
Sets the value of an ability.
virtual bool canSee (const Actor & actor) const = 0
Checks to see if an actor has been visually hidden from this player.
virtual bool canSee (const Player & player) const = 0
Checks to see if a player has been hidden from this player.
virtual void closeForm () = 0
Closes the forms that are currently open for the player.
T getAbility (AbilityId< T > ability) const
Gets the value of an ability.
virtual const SocketAddress & getAddress () const = 0
Gets the socket address of this player.
virtual bool getAllowFlight () const = 0
Determines if the Player is allowed to fly via jump key double-tap.
virtual std::string getDeviceId () const = 0
Gets the player's current device id.
virtual std::string getDeviceOS () const = 0
Gets the player's current device's operation system (OS).
virtual Inventory & getEnderChest () const = 0
Get the player's EnderChest inventory.
virtual int getExpLevel () const = 0
Gets the players current experience level.
virtual float getExpProgress () const = 0
Gets the players current experience progress towards the next level.
virtual float getFlySpeed () const = 0
Gets the current allowed speed that a client can fly.
virtual GameMode getGameMode () const = 0
Gets this player's current GameMode.
virtual std::string getGameVersion () const = 0
Gets the player's current game version.
virtual PlayerInventory & getInventory () const = 0
Get the player's inventory.
virtual std::string getLocale () const = 0
Gets the player's current locale.
virtual std::string getName () override const = 0
Returns the name of this player.
virtual std::chrono::milliseconds getPing () const = 0
Gets the player's average ping.
virtual std::optional< Location > getRespawnLocation () const = 0
Gets the location where the player will spawn.
virtual NotNull< Scoreboard > getScoreboard () const = 0
Gets the Scoreboard displayed to this player.
virtual Skin getSkin () const = 0
Gets the player's skin.
virtual int getTotalExp () const = 0
Gets the players total experience points.
virtual UUID getUniqueId () const = 0
Returns the UUID of this player.
virtual float getWalkSpeed () const = 0
Gets the current allowed speed that a client can walk.
virtual std::string getXuid () const = 0
Returns the Xbox User ID (XUID) of this player.
virtual void giveExp (int amount) = 0
Gives the player the amount of experience specified.
virtual void giveExpLevels (int amount) = 0
Gives the player the amount of experience levels specified.
virtual void hideActor (Plugin & plugin, Actor & actor) = 0
Hides an actor from this player.
virtual bool isCrawling () const = 0
Gets whether the player is crawling or not.
virtual bool isFlying () const = 0
Checks to see if this player is currently flying or not.
virtual bool isOp () const = 0
Checks if this player is a server operator.
virtual bool isSneaking () const = 0
Returns if the player is in sneak mode.
virtual bool isSprinting () const = 0
Gets whether the player is sprinting or not.
virtual void kick (std::string message) const = 0
Kicks player with custom kick message.
virtual void openSign (const Sign & sign, Sign::Side side) = 0
Opens a sign editor for this player.
virtual void openVirtualSign (const Location & location, Sign::Side side) = 0
Opens a sign editor for this player at the given block location.
virtual bool performCommand (std::string command) const = 0
Makes the player perform the given command.
virtual void playSound (Location location, std::string sound, float volume, float pitch) = 0
Play a sound for a player at the location.
virtual void resetTitle () const = 0
Resets the title displayed to the player.
virtual void sendActionBar (std::string message) const = 0
Sends this player an action bar message.
virtual void sendBlockChange (const Location & location, const BlockData & block) = 0
Sends a block change to this player.
virtual void sendBlockUpdate (const Location & location, const BlockActorState & block_actor_state) = 0
Sends a block entity state change to this player.
virtual void sendForm (FormVariant form) = 0
Sends a form to the player.
virtual void sendMap (MapView & map) = 0
Render a map and send it to the player in its entirety.
virtual void sendPacket (int packet_id, std::string_view payload) const = 0
Sends a packet to the player.
virtual void sendPopup (std::string message) const = 0
Sends this player a popup message.
virtual void sendTip (std::string message) const = 0
Sends this player a tip message.
virtual void sendTitle (std::string title, std::string subtitle) const = 0
Sends a title and a subtitle message to the player.
virtual void sendTitle (std::string title, std::string subtitle, int fade_in, int stay, int fade_out) const = 0
Sends a title and a subtitle message to the player.
virtual void sendToast (std::string title, std::string content) const = 0
Sends this player a toast notification.
bool setAbility (AbilityId< T > ability, T value)
Sets the value of an ability.
virtual void setAllowFlight (bool flight) = 0
Sets if the Player is allowed to fly via jump key double-tap.
virtual void setExpLevel (int level) = 0
Sets the players current experience level.
virtual void setExpProgress (float progress) = 0
Sets the players current experience progress towards the next level.
virtual void setFlySpeed (float value) const = 0
Sets the speed at which a client will fly.
virtual void setFlying (bool value) = 0
Makes this player start or stop flying.
virtual void setGameMode (GameMode mode) = 0
Sets this player's current GameMode.
virtual void setOp (bool value) = 0
Sets the operator status of this player.
virtual void setRespawnLocation (std::optional< Location > location) = 0
Sets the location where the player will respawn.
virtual void setScoreboard (NotNull< Scoreboard > scoreboard) = 0
Sets the player's visible Scoreboard .
virtual void setSneaking (bool sneak) = 0
Sets the sneak mode of the player.
virtual void setSprinting (bool sprinting) = 0
Sets whether the player is sprinting or not.
virtual void setWalkSpeed (float value) const = 0
Sets the speed at which a client will walk.
virtual void showActor (Plugin & plugin, Actor & actor) = 0
Allows this player to see an actor that was previously hidden.
virtual void spawnParticle (std::string name, Location location) const = 0
Spawns the particle at the target location.
virtual void spawnParticle (std::string name, float x, float y, float z) const = 0
Spawns the particle at the target location.
virtual void spawnParticle (std::string name, Location location, std::optional< JsonObject > molang_variables) const = 0
Spawns the particle at the target location.
virtual void spawnParticle (std::string name, float x, float y, float z, std::optional< JsonObject > molang_variables) const = 0
Spawns the particle at the target location.
virtual void stopAllSounds () = 0
Stop all sounds from playing.
virtual void stopSound (std::string sound) = 0
Stop the specified sound from playing.
virtual void transfer (std::string host, int port) const = 0
Transfers the player to another server.
virtual void updateCommands () const = 0
Send the list of commands to the client.

Public Functions inherited from endstone::Mob

See endstone::Mob

Type Name
virtual void addEffect (const Effect & effect) = 0
Adds the given Effect to this entity.
virtual std::vector< Effect > getActiveEffects () const = 0
Returns all currently active Effects on this entity.
virtual Nullable< AttributeInstance > getAttribute (AttributeId id) = 0
Gets the specified attribute instance from the object.
virtual std::vector< NotNull< AttributeInstance > > getAttributes () = 0
Gets all attribute instances from the object.
virtual std::optional< Effect > getEffect (EffectId type) const = 0
Returns the active Effect of the specified type.
virtual int getHealth () const = 0
Gets the entity's health from 0 to its max possible value, where 0 is dead.
virtual int getMaxHealth () const = 0
Gets the maximum health this entity has.
virtual bool hasAttribute (AttributeId id) const = 0
Checks whether the given attribute is present on the object.
virtual bool hasEffect (EffectId type) const = 0
Returns whether the entity already has an existing effect of the given type applied to it.
virtual bool isGliding () const = 0
Checks to see if an actor is gliding, such as using an Elytra.
virtual bool isSwimming () const = 0
Checks to see if an actor is swimming.
virtual void removeEffect (EffectId type) = 0
Removes any effects of the given type that are present on this entity.
virtual void setHealth (int health) const = 0
Sets the entity's health from 0 to its possible value, where 0 is dead.
virtual void setMaxHealth (int health) const = 0
Sets the maximum health this entity can have.

Public Functions inherited from endstone::Actor

See endstone::Actor

Type Name
virtual bool addScoreboardTag (std::string tag) const = 0
Adds a tag to this actor.
virtual NotNull< Dimension > getDimension () const = 0
Gets the current Dimension this actor resides in.
virtual std::int64_t getId () const = 0
Returns a unique id for this actor.
virtual Level & getLevel () const = 0
Gets the current Level this actor resides in.
virtual Location getLocation () const = 0
Gets the actor's current position.
virtual std::string getNameTag () const = 0
Gets the current name tag of the actor.
virtual std::uint64_t getRuntimeId () const = 0
Returns the runtime id for this actor.
virtual std::string getScoreTag () const = 0
Gets the current score tag of the actor.
virtual std::vector< std::string > getScoreboardTags () const = 0
Returns a list of scoreboard tags for this actor.
virtual const ActorType & getType () const = 0
Get the type of the actor.
virtual Vector getVelocity () const = 0
Gets this actor's current velocity.
virtual bool isDead () const = 0
Returns true if this actor has been marked for removal.
virtual bool isInLava () const = 0
Returns true if the actor is in lava.
virtual bool isInWater () const = 0
Returns true if the actor is in water.
virtual bool isNameTagAlwaysVisible () const = 0
Checks if the actor's name tag is always visible.
virtual bool isNameTagVisible () const = 0
Checks if the actor's name tag is currently visible.
virtual bool isOnGround () const = 0
Returns true if the actor is supported by a block.
virtual bool isValid () const = 0
Returns false if the entity has died, been despawned for some other reason, or has not been added to the level.
virtual void remove () = 0
Remove this actor from the level.
virtual bool removeScoreboardTag (std::string tag) const = 0
Removes a given tag from this actor.
virtual void setNameTag (std::string name) = 0
Sets the name tag for the actor.
virtual void setNameTagAlwaysVisible (bool visible) = 0
Sets whether the actor's name tag should always be visible.
virtual void setNameTagVisible (bool visible) = 0
Sets if the actor's name tag is visible or not.
virtual void setRotation (float yaw, float pitch) = 0
Sets the actor's rotation.
virtual void setScoreTag (std::string score) = 0
Sets the score tag for the actor.
virtual bool teleport (const Location & location) = 0
Teleports this actor to the given location.
virtual bool teleport (const NotNull< Actor > & target) = 0
Teleports this actor to the target Actor .

Public Functions inherited from endstone::CommandSender

See endstone::CommandSender

Type Name
virtual std::string getName () const = 0
Gets the name of this command sender.
virtual Server & getServer () const = 0
Returns the server instance that this command is running on.
virtual void sendErrorMessage (const Message & message) const = 0
Sends this sender a error message.
void sendErrorMessage (const std::format_string< Args... > format, Args &&... args) const
virtual void sendMessage (const Message & message) const = 0
Sends this sender a message.
void sendMessage (const std::format_string< Args... > format, Args &&... args) const

Public Functions inherited from endstone::Permissible

See endstone::Permissible

Type Name
virtual NotNull< PermissionAttachment > addAttachment (Plugin & plugin, const std::string & name, bool value) = 0
Adds a new PermissionAttachment with a single permission by name and value.
virtual NotNull< PermissionAttachment > addAttachment (Plugin & plugin) = 0
Adds a new empty PermissionAttachment to this object.
virtual std::unordered_set< NotNull< PermissionAttachmentInfo > > getEffectivePermissions () const = 0
Gets a set containing all the permissions currently in effect by this object.
virtual PermissionLevel getPermissionLevel () const = 0
Gets the permission level of this object.
virtual bool hasPermission (std::string name) const = 0
Gets the value of the specified permission, if set.
virtual bool hasPermission (const NotNull< Permission > & perm) const = 0
Gets the value of the specified permission, if set.
virtual bool isPermissionSet (std::string name) const = 0
Checks if this object contains an override for the specified permission, by fully qualified name.
virtual bool isPermissionSet (const NotNull< Permission > & perm) const = 0
Checks if this object contains an override for the specified Permission .
virtual void recalculatePermissions () = 0
Recalculates the permissions for this object, if the attachments have changed values.
virtual bool removeAttachment (const NotNull< PermissionAttachment > & attachment) = 0
Removes the given PermissionAttachment from this object.

Public Functions inherited from endstone::Object

See endstone::Object

Type Name
T * as ()
Attempts to cast this object to the given type T.
const T * as () const
Attempts to cast this object to the given type T.
virtual ClassInfo getClassInfo () const = 0
bool is () const
Checks if this object is an instance of the given type T (or a subclass of T).
virtual bool isInstanceOf (ClassInfo target) const = 0
virtual ~Object () = default

Protected Types

Type Name
typedef std::variant< MessageForm, ActionForm, ModalForm > FormVariant

Public Functions Documentation

function _getAbility

Gets the value of an ability.

virtual AbilityValue endstone::Player::_getAbility (
    Identifier < Ability > ability
) const = 0

Parameters:

  • ability The Minecraft ability to get

Returns:

The current ability value


function _setAbility

Sets the value of an ability.

virtual bool endstone::Player::_setAbility (
    Identifier < Ability > ability,
    AbilityValue value
) = 0

Parameters:

  • ability The Minecraft ability to set
  • value The new value

Returns:

True if the value was accepted


function canSee [½]

Checks to see if an actor has been visually hidden from this player.

virtual bool endstone::Player::canSee (
    const  Actor & actor
) const = 0

Parameters:

Returns:

true if the actor is not being hidden from this player


function canSee [2/2]

Checks to see if a player has been hidden from this player.

virtual bool endstone::Player::canSee (
    const  Player & player
) const = 0

Parameters:

Returns:

true if the player is not being hidden from this player


function closeForm

Closes the forms that are currently open for the player.

virtual void endstone::Player::closeForm () = 0


function getAbility

Gets the value of an ability.

template<typename  T>
inline T endstone::Player::getAbility (
    AbilityId < T > ability
) const

The value returned is the one in effect, which is not always the one that was set: while the player is spectating, or has the loading screen up, or is in the editor, that state supplies its own value for some abilities and it takes precedence over the player's own.

Template parameters:

  • T The type of the ability's value.

Parameters:

  • ability The Minecraft ability to get

Returns:

The current ability value


function getAddress

Gets the socket address of this player.

virtual const  SocketAddress & endstone::Player::getAddress () const = 0

Returns:

the player's socket address


function getAllowFlight

Determines if the Player is allowed to fly via jump key double-tap.

virtual bool endstone::Player::getAllowFlight () const = 0

Returns:

true if the player is allowed to fly.


function getDeviceId

Gets the player's current device id.

virtual std::string endstone::Player::getDeviceId () const = 0

Returns:

the player's device id


function getDeviceOS

Gets the player's current device's operation system (OS).

virtual std::string endstone::Player::getDeviceOS () const = 0

Returns:

the player's device OS


function getEnderChest

Get the player's EnderChest inventory.

virtual Inventory & endstone::Player::getEnderChest () const = 0

Returns:

The EnderChest of the player


function getExpLevel

Gets the players current experience level.

virtual int endstone::Player::getExpLevel () const = 0

Returns:

Current experience level


function getExpProgress

Gets the players current experience progress towards the next level.

virtual float endstone::Player::getExpProgress () const = 0

This is a percentage value. 0.0 is "no progress" and 1.0 is "next level".

Returns:

Current experience progress, between 0.0 and 1.0.


function getFlySpeed

Gets the current allowed speed that a client can fly.

virtual float endstone::Player::getFlySpeed () const = 0

Returns:

The current allowed speed, default is 0.05.


function getGameMode

Gets this player's current GameMode.

virtual GameMode endstone::Player::getGameMode () const = 0

Returns:

Current game mode


function getGameVersion

Gets the player's current game version.

virtual std::string endstone::Player::getGameVersion () const = 0

Returns:

the player's game version


function getInventory

Get the player's inventory.

virtual PlayerInventory & endstone::Player::getInventory () const = 0

Returns:

The inventory of the player, this also contains the armor slots.


function getLocale

Gets the player's current locale.

virtual std::string endstone::Player::getLocale () const = 0

Returns:

the player's locale


function getName

Returns the name of this player.

virtual std::string endstone::Player::getName () override const = 0

Returns:

Player name, or an empty string if we have not seen a name for this player yet.

Implements endstone::CommandSender::getName


function getPing

Gets the player's average ping.

virtual std::chrono::milliseconds endstone::Player::getPing () const = 0

Returns:

player ping


function getRespawnLocation

Gets the location where the player will spawn.

virtual std::optional< Location > endstone::Player::getRespawnLocation () const = 0

Note:

Bedrock does not persist yaw/pitch for a respawn point, so both are 0 on the returned location.

Returns:

the respawn location, or std::nullopt if the player has no valid respawn point


function getScoreboard

Gets the Scoreboard displayed to this player.

virtual NotNull < Scoreboard > endstone::Player::getScoreboard () const = 0

Returns:

The current scoreboard seen by this player


function getSkin

Gets the player's skin.

virtual Skin endstone::Player::getSkin () const = 0

Returns:

the player's skin


function getTotalExp

Gets the players total experience points.

virtual int endstone::Player::getTotalExp () const = 0

This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.

Returns:

Current total experience points


function getUniqueId

Returns the UUID of this player.

virtual UUID endstone::Player::getUniqueId () const = 0

Returns:

Player UUID


function getWalkSpeed

Gets the current allowed speed that a client can walk.

virtual float endstone::Player::getWalkSpeed () const = 0

Returns:

The current allowed speed, default is 0.10.


function getXuid

Returns the Xbox User ID (XUID) of this player.

virtual std::string endstone::Player::getXuid () const = 0

Returns:

Player XUID


function giveExp

Gives the player the amount of experience specified.

virtual void endstone::Player::giveExp (
    int amount
) = 0

Parameters:

  • amount Exp amount to give

function giveExpLevels

Gives the player the amount of experience levels specified.

virtual void endstone::Player::giveExpLevels (
    int amount
) = 0

Parameters:

  • amount amount of experience levels to give or take

function hideActor

Hides an actor from this player.

virtual void endstone::Player::hideActor (
    Plugin & plugin,
    Actor & actor
) = 0

Parameters:

  • plugin Plugin that wants to hide the actor
  • actor Actor to hide

function isCrawling

Gets whether the player is crawling or not.

virtual bool endstone::Player::isCrawling () const = 0

Bukkit has no equivalent, as crawling is a pose there rather than a state the server tracks.

Returns:

true if the player is crawling.


function isFlying

Checks to see if this player is currently flying or not.

virtual bool endstone::Player::isFlying () const = 0

Returns:

true if the player is flying, else false.


function isOp

Checks if this player is a server operator.

virtual bool endstone::Player::isOp () const = 0

Returns:

true if this is an operator, otherwise false


function isSneaking

Returns if the player is in sneak mode.

virtual bool endstone::Player::isSneaking () const = 0

Returns:

true if player is in sneak mode


function isSprinting

Gets whether the player is sprinting or not.

virtual bool endstone::Player::isSprinting () const = 0

Returns:

true if player is sprinting.


function kick

Kicks player with custom kick message.

virtual void endstone::Player::kick (
    std::string message
) const = 0

Parameters:

  • message kick message

function openSign

Opens a sign editor for this player.

virtual void endstone::Player::openSign (
    const  Sign & sign,
    Sign::Side side
) = 0

The sign must be placed in the same dimension as this player.

Parameters:

  • sign the sign to open
  • side the side of the sign to edit

Exception:

  • std::invalid_argument if the sign is not placed or is in another dimension

function openVirtualSign

Opens a sign editor for this player at the given block location.

virtual void endstone::Player::openVirtualSign (
    const  Location & location,
    Sign::Side side
) = 0

No sign has to exist in the dimension: the caller is responsible for sending the client a sign block at that position first. Only the block coordinates of the location are used, the client may refuse a position that is too far away, and PlayerOpenSignEvent is not called.

Parameters:

  • location the block location of the sign
  • side the side of the sign to edit

function performCommand

Makes the player perform the given command.

virtual bool endstone::Player::performCommand (
    std::string command
) const = 0

Parameters:

Returns:

true if the command was successful, otherwise false


function playSound

Play a sound for a player at the location.

virtual void endstone::Player::playSound (
    Location location,
    std::string sound,
    float volume,
    float pitch
) = 0

Parameters:

  • location The location to play the sound
  • sound The internal sound name to play
  • volume The volume of the sound
  • pitch The pitch of the sound

function resetTitle

Resets the title displayed to the player.

virtual void endstone::Player::resetTitle () const = 0

This will clear the displayed title / subtitle and reset timings to their default values.


function sendActionBar

Sends this player an action bar message.

virtual void endstone::Player::sendActionBar (
    std::string message
) const = 0

Parameters:

  • message Message to be displayed

function sendBlockChange

Sends a block change to this player.

virtual void endstone::Player::sendBlockChange (
    const  Location & location,
    const  BlockData & block
) = 0

This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.

Parameters:

  • location The location of the changed block
  • block The new block data

function sendBlockUpdate

Sends a block entity state change to this player.

virtual void endstone::Player::sendBlockUpdate (
    const  Location & location,
    const  BlockActorState & block_actor_state
) = 0

This fakes a block entity state change for a user at the given location. This will not actually change the world in any way.

The state is sent only to this player and does not update the world.

Parameters:

  • location The location of the changed block
  • block_actor_state The new block entity state

function sendForm

Sends a form to the player.

virtual void endstone::Player::sendForm (
    FormVariant form
) = 0

Parameters:

  • form The form to send

function sendMap

Render a map and send it to the player in its entirety.

virtual void endstone::Player::sendMap (
    MapView & map
) = 0

This may be used when streaming the map in the normal manner is not desirable.

Parameters:

  • map The map to send

function sendPacket

Sends a packet to the player.

virtual void endstone::Player::sendPacket (
    int packet_id,
    std::string_view payload
) const = 0

Parameters:

  • packet_id The packet ID to be sent.
  • payload The payload of the packet to be transmitted.

function sendPopup

Sends this player a popup message.

virtual void endstone::Player::sendPopup (
    std::string message
) const = 0

Parameters:

  • message Message to be displayed

function sendTip

Sends this player a tip message.

virtual void endstone::Player::sendTip (
    std::string message
) const = 0

Parameters:

  • message Message to be displayed

function sendTitle [½]

Sends a title and a subtitle message to the player.

virtual void endstone::Player::sendTitle (
    std::string title,
    std::string subtitle
) const = 0

If they are empty strings, the display will be updated as such. The titles will be displayed with the default timings.

Parameters:

  • title Title text
  • subtitle Subtitle text

function sendTitle [2/2]

Sends a title and a subtitle message to the player.

virtual void endstone::Player::sendTitle (
    std::string title,
    std::string subtitle,
    int fade_in,
    int stay,
    int fade_out
) const = 0

If they are empty strings, the display will be updated as such.

Parameters:

  • title Title text
  • subtitle Subtitle text
  • fade_in time in ticks for titles to fade in. Defaults to 10.
  • stay time in ticks for titles to stay. Defaults to 70.
  • fade_out time in ticks for titles to fade out. Defaults to 20.

function sendToast

Sends this player a toast notification.

virtual void endstone::Player::sendToast (
    std::string title,
    std::string content
) const = 0

Parameters:

  • title The title of the toast notification.
  • content The content of the toast notification.

function setAbility

Sets the value of an ability.

template<typename  T>
inline bool endstone::Player::setAbility (
    AbilityId < T > ability,
    T value
) 

Abilities are not persisted for a player whose permissions are managed by the server, so a plugin that wants a value to outlast the session must set it again when the player rejoins. Ability::Muted, Ability::NoClip, Ability::PrivilegedBuilder and Ability::WorldBuilder are never saved at all.

Template parameters:

  • T The type of the ability's value.

Parameters:

  • ability The Minecraft ability to set
  • value The new value

Returns:

True if the value was accepted


function setAllowFlight

Sets if the Player is allowed to fly via jump key double-tap.

virtual void endstone::Player::setAllowFlight (
    bool flight
) = 0

Parameters:

  • flight If flight should be allowed.

function setExpLevel

Sets the players current experience level.

virtual void endstone::Player::setExpLevel (
    int level
) = 0

Parameters:

  • level New experience level

function setExpProgress

Sets the players current experience progress towards the next level.

virtual void endstone::Player::setExpProgress (
    float progress
) = 0

This is a percentage value. 0.0 is "no progress" and 1.0 is "next level".

Parameters:

  • progress New experience progress

function setFlySpeed

Sets the speed at which a client will fly.

virtual void endstone::Player::setFlySpeed (
    float value
) const = 0

Parameters:

  • value The new speed.

function setFlying

Makes this player start or stop flying.

virtual void endstone::Player::setFlying (
    bool value
) = 0

Parameters:

  • value true to fly.

function setGameMode

Sets this player's current GameMode.

virtual void endstone::Player::setGameMode (
    GameMode mode
) = 0

Parameters:

  • mode New game mode

function setOp

Sets the operator status of this player.

virtual void endstone::Player::setOp (
    bool value
) = 0

Parameters:

  • value New operator value

function setRespawnLocation

Sets the location where the player will respawn.

virtual void endstone::Player::setRespawnLocation (
    std::optional< Location > location
) = 0

Fires PlayerSetSpawnEvent with PlayerSetSpawnEvent::Cause::Plugin, whether setting or clearing.

Parameters:

  • location the respawn location, or std::nullopt to clear it; its dimension must be loaded when set

function setScoreboard

Sets the player's visible Scoreboard .

virtual void endstone::Player::setScoreboard (
    NotNull < Scoreboard > scoreboard
) = 0

Parameters:


function setSneaking

Sets the sneak mode of the player.

virtual void endstone::Player::setSneaking (
    bool sneak
) = 0

Parameters:

  • sneak true if player should appear sneaking

function setSprinting

Sets whether the player is sprinting or not.

virtual void endstone::Player::setSprinting (
    bool sprinting
) = 0

Parameters:

  • sprinting true if the player should be sprinting

function setWalkSpeed

Sets the speed at which a client will walk.

virtual void endstone::Player::setWalkSpeed (
    float value
) const = 0

Parameters:

  • value The new speed.

function showActor

Allows this player to see an actor that was previously hidden.

virtual void endstone::Player::showActor (
    Plugin & plugin,
    Actor & actor
) = 0

If another plugin had hidden the actor too, the actor will remain hidden until the other plugin calls this method too.

Parameters:

  • plugin Plugin that wants to show the actor
  • actor Actor to show

function spawnParticle [¼]

Spawns the particle at the target location.

virtual void endstone::Player::spawnParticle (
    std::string name,
    Location location
) const = 0

Parameters:

  • name the name of the particle effect to spawn
  • location the location to spawn at

function spawnParticle [2/4]

Spawns the particle at the target location.

virtual void endstone::Player::spawnParticle (
    std::string name,
    float x,
    float y,
    float z
) const = 0

Parameters:

  • name the name of the particle effect to spawn
  • x the position on the x axis to spawn at
  • y the position on the y axis to spawn at
  • z the position on the z axis to spawn at

function spawnParticle [¾]

Spawns the particle at the target location.

virtual void endstone::Player::spawnParticle (
    std::string name,
    Location location,
    std::optional< JsonObject > molang_variables
) const = 0

Parameters:

  • name the name of the particle effect to spawn
  • location the location to spawn at
  • molang_variables the customizable molang variables that can be adjusted for this particle

function spawnParticle [4/4]

Spawns the particle at the target location.

virtual void endstone::Player::spawnParticle (
    std::string name,
    float x,
    float y,
    float z,
    std::optional< JsonObject > molang_variables
) const = 0

Parameters:

  • name the name of the particle effect to spawn
  • x the position on the x axis to spawn at
  • y the position on the y axis to spawn at
  • z the position on the z axis to spawn at
  • molang_variables the customizable molang variables that can be adjusted for this particle

function stopAllSounds

Stop all sounds from playing.

virtual void endstone::Player::stopAllSounds () = 0


function stopSound

Stop the specified sound from playing.

virtual void endstone::Player::stopSound (
    std::string sound
) = 0

Parameters:

  • sound the sound to stop

function transfer

Transfers the player to another server.

virtual void endstone::Player::transfer (
    std::string host,
    int port
) const = 0

Parameters:

  • host Server address to transfer the player to.
  • port Server port to transfer the player to

function updateCommands

Send the list of commands to the client.

virtual void endstone::Player::updateCommands () const = 0

Generally useful to ensure the client has a complete list of commands after permission changes are done.


Protected Types Documentation

typedef FormVariant

using endstone::Player::FormVariant =  std::variant<MessageForm, ActionForm, ModalForm>;


The documentation for this class was generated from the following file include/endstone/player.h