Class endstone::Player¶
Represents a player.
#include <endstone/player.h>
Inherits the following classes: endstone::Mob
Public Functions¶
Type | Name |
---|---|
virtual Player * | asPlayer () override const Gets a CommandSender asPlayer . |
virtual void | closeForm () = 0 Closes the forms that are currently open for the player. |
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 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::chrono::milliseconds | getPing () const = 0 Gets the player's average ping. |
virtual Scoreboard & | getScoreboard () const = 0 Gets the Scoreboard displayed to this player. |
virtual const 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 bool | isFlying () const = 0 Checks to see if this player is currently flying or not. |
virtual void | kick (std::string message) const = 0 Kicks player with custom kick message. |
virtual bool | performCommand (std::string command) const = 0 Makes the player perform the given command. |
virtual void | resetTitle () const = 0 Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values. |
virtual void | sendForm (FormVariant form) = 0 Sends a form to the player. |
virtual void | sendPacket (Packet & packet) 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. If they are empty strings, the display will be updated as such. The titles will be displayed with the default timings. |
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. If they are empty strings, the display will be updated as such. |
virtual void | sendToast (std::string title, std::string content) const = 0 Sends this player a toast notification. |
virtual void | setAllowFlight (bool flight) = 0 Sets if the Player is allowed to fly via jump key double-tap. |
virtual Result< void > | setExpLevel (int level) = 0 Sets the players current experience level. |
virtual Result< void > | setExpProgress (float progress) = 0 Sets the players current experience progress towards the next level. |
virtual void | setFlySpeed (float value) const = 0 |
virtual Result< 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 | setScoreboard (Scoreboard & scoreboard) = 0 |
virtual void | setWalkSpeed (float value) const = 0 |
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< std::string > molang_variables_json) const = 0 Spawns the particle at the target location. |
virtual void | spawnParticle (std::string name, float x, float y, float z, std::optional< std::string > molang_variables_json) const = 0 Spawns the particle at the target location. |
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 bool | isGliding () const = 0 Checks to see if an actor is gliding, such as using an Elytra. |
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 Actor * | asActor () override const Gets a CommandSender asActor . |
virtual Dimension & | getDimension () const = 0 |
virtual int | getHealth () const = 0 Gets the entity's health from 0 to its max possible value, where 0 is dead. |
virtual std::int64_t | getId () const = 0 Returns a unique id for this actor. |
virtual Level & | getLevel () const = 0 |
virtual Location | getLocation () const = 0 |
virtual int | getMaxHealth () const = 0 Gets the maximum health this entity has. |
virtual std::string | getNameTag () const = 0 Gets the current name tag of the actor. |
virtual std::uint64_t | getRuntimeId () const = 0 |
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 std::string | getType () const = 0 Get the type of the actor. |
virtual Vector< float > | getVelocity () const = 0 |
virtual bool | isDead () const = 0 Returns true if this actor has been marked for removal. |
virtual bool | isInLava () const = 0 |
virtual bool | isInWater () const = 0 |
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 |
virtual bool | removeScoreboardTag (std::string tag) const = 0 Removes a given tag from this actor. |
virtual Result< void > | setHealth (int health) const = 0 |
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 |
virtual void | setScoreTag (std::string score) = 0 Sets the score tag for the actor. |
virtual void | teleport (Location location) = 0 |
virtual void | teleport (Actor & target) = 0 |
Public Functions inherited from endstone::CommandSender¶
Type | Name |
---|---|
virtual Actor * | asActor () const Gets a CommandSender asActor . |
virtual CommandSender * | asCommandSender () override const Casts a Permissible asCommandSender . |
virtual ConsoleCommandSender * | asConsole () const Gets a CommandSender as Console. |
virtual Player * | asPlayer () const Gets a CommandSender asPlayer . |
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 fmt::format_string< Args... > format, Args &&... args) const |
virtual void | sendMessage (const Message & message) const = 0 Sends this sender a message. |
void | sendMessage (const fmt::format_string< Args... > format, Args &&... args) const |
Public Functions inherited from endstone::Permissible¶
Type | Name |
---|---|
virtual Result< PermissionAttachment * > | addAttachment (Plugin & plugin, const std::string & name, bool value) = 0 |
virtual Result< PermissionAttachment * > | addAttachment (Plugin & plugin) = 0 |
virtual CommandSender * | asCommandSender () const = 0 Casts a Permissible asCommandSender . |
virtual std::unordered_set< PermissionAttachmentInfo * > | getEffectivePermissions () const = 0 |
virtual bool | hasPermission (std::string name) const = 0 |
virtual bool | hasPermission (const Permission & perm) const = 0 |
virtual bool | isOp () const = 0 Checks if this object is a server operator. |
virtual bool | isPermissionSet (std::string name) const = 0 |
virtual bool | isPermissionSet (const Permission & perm) const = 0 |
virtual void | recalculatePermissions () = 0 |
virtual Result< void > | removeAttachment (PermissionAttachment & attachment) = 0 |
virtual void | setOp (bool value) = 0 Sets the operator status of this object. |
virtual | ~Permissible () = default |
Protected Types¶
Type | Name |
---|---|
typedef std::variant< MessageForm, ActionForm, ModalForm > | FormVariant |
Public Functions Documentation¶
function asPlayer¶
Gets a CommandSender asPlayer .
Returns:
Player, nullptr if not a Player
Implements endstone::CommandSender::asPlayer
function closeForm¶
Closes the forms that are currently open for the player.
function getAddress¶
Gets the socket address of this player.
Returns:
the player's socket address
function getAllowFlight¶
Determines if the Player is allowed to fly via jump key double-tap.
Returns:
True if the player is allowed to fly.
function getDeviceId¶
Gets the player's current device id.
Returns:
the player's device id
function getDeviceOS¶
Gets the player's current device's operation system (OS).
Returns:
the player's device OS
function getExpLevel¶
Gets the players current experience level.
Returns:
Current experience level
function getExpProgress¶
Gets the players current experience progress towards the next level.
This is a percentage value. 0.0 is "no progress" and 1.0 is "next level".
Returns:
Current experience points
function getFlySpeed¶
Gets the current allowed speed that a client can fly.
Returns:
The current allowed speed, default is 0.05.
function getGameMode¶
Gets this player's current GameMode.
Returns:
Current game mode
function getGameVersion¶
Gets the player's current game version.
Returns:
the player's game version
function getInventory¶
Get the player's inventory.
Returns:
The inventory of the player, this also contains the armor slots.
function getLocale¶
Gets the player's current locale.
Returns:
the player's locale
function getPing¶
Gets the player's average ping.
Returns:
player ping
function getScoreboard¶
Gets the Scoreboard displayed to this player.
Returns:
The current scoreboard seen by this player
function getSkin¶
Gets the player's skin.
Returns:
the player's skin
function getTotalExp¶
Gets the players total experience points.
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.
Returns:
function getWalkSpeed¶
Gets the current allowed speed that a client can walk.
Returns:
The current allowed speed, default is 0.10.
function getXuid¶
Returns the Xbox User ID (XUID) of this player.
Returns:
Player XUID
function giveExp¶
Gives the player the amount of experience specified.
Parameters:
amount
Exp amount to give
function giveExpLevels¶
Gives the player the amount of experience levels specified.
Parameters:
amount
amount of experience levels to give or take
function isFlying¶
Checks to see if this player is currently flying or not.
Returns:
True if the player is flying, else false.
function kick¶
Kicks player with custom kick message.
Parameters:
message
kick message
function performCommand¶
Makes the player perform the given command.
Parameters:
command
Command to perform
Returns:
true if the command was successful, otherwise false
function resetTitle¶
Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values.
function sendForm¶
Sends a form to the player.
Parameters:
form
The form to send
function sendPacket¶
Sends a packet to the player.
Parameters:
packet
The packet to be sent.
function sendPopup¶
Sends this player a popup message.
Parameters:
message
Message to be displayed
function sendTip¶
Sends this player a tip message.
Parameters:
message
Message to be displayed
function sendTitle [½]¶
Sends a title and a subtitle message to the player. If they are empty strings, the display will be updated as such. The titles will be displayed with the default timings.
Parameters:
title
Title textsubtitle
Subtitle text
function sendTitle [2/2]¶
Sends a title and a subtitle message to the player. If they are empty strings, the display will be updated as such.
virtual void endstone::Player::sendTitle (
std::string title,
std::string subtitle,
int fade_in,
int stay,
int fade_out
) const = 0
Parameters:
title
Title textsubtitle
Subtitle textfade_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.
Parameters:
title
The title of the toast notification.content
The content of the toast notification.
function setAllowFlight¶
Sets if the Player is allowed to fly via jump key double-tap.
Parameters:
flight
If flight should be allowed.
function setExpLevel¶
Sets the players current experience level.
Parameters:
level
New experience level
function setExpProgress¶
Sets the players current experience progress towards the next level.
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.
Parameters:
value
The new speed.
function setFlying¶
Makes this player start or stop flying.
Parameters:
value
True to fly.
function setGameMode¶
Sets this player's current GameMode.
Parameters:
mode
New game mode
function setScoreboard¶
@breif Sets the player's visible Scoreboard.
Parameters:
scoreboard
New Scoreboard for the player
function setWalkSpeed¶
Sets the speed at which a client will walk.
Parameters:
value
The new speed.
function spawnParticle [¼]¶
Spawns the particle at the target location.
Parameters:
name
the name of the particle effect to spawnlocation
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 spawnx
the position on the x axis to spawn aty
the position on the y axis to spawn atz
the position on the z axis to spawn at
function spawnParticle [¾]¶
Spawns the particle at the target location.
virtual void endstone::Player::spawnParticle (
std::string name,
Location location,
std::optional< std::string > molang_variables_json
) const = 0
Parameters:
name
the name of the particle effect to spawnlocation
the location to spawn atmolang_variables_json
the customizable molang variables that can be adjusted for this particle, in json
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< std::string > molang_variables_json
) const = 0
Parameters:
name
the name of the particle effect to spawnx
the position on the x axis to spawn aty
the position on the y axis to spawn atz
the position on the z axis to spawn atmolang_variables_json
the customizable molang variables that can be adjusted for this particle, in json
function transfer¶
Transfers the player to another server.
Parameters:
function updateCommands¶
Send the list of commands to the client.
Generally useful to ensure the client has a complete list of commands after permission changes are done.
Protected Types Documentation¶
typedef FormVariant¶
The documentation for this class was generated from the following file include/endstone/player.h