endstone
Classes
| Name | Description |
|---|---|
ColorFormat | All supported color and format codes. |
IRegistry | |
Identifier | Represents a identifier consisting of two components: a namespace and a key. |
Logger | Logger class which can format and output varies levels of logs. |
OfflinePlayer | Represents a reference to a player identity and the data belonging to a player that is stored on the disk and can, thus, be retrieved without the player needing to be online. |
Player | Represents a player. |
Preconditions | |
Registry | Abstract registry interface for objects with identifiers. |
Server | Represents a server implementation. |
Skin | Represents a player skin. |
Type | CRTP base for registry-backed types identified by an Identifier. |
overloaded | Helper type for visitors. |
Enums
| Name | Description |
|---|---|
GameMode | Represents the various type of game modes that Players may have. |
Type Aliases
| Name | Description |
|---|---|
Message |
Functions
| Name | Description |
|---|---|
overloaded | Deduction guide. |
structColorFormat
Defined in <endstone/color_format.h>
All supported color and format codes.
Variables
varEscapestatic
const std::string EscapevarBlackstatic
const std::string BlackvarDarkBluestatic
const std::string DarkBluevarDarkGreenstatic
const std::string DarkGreenvarDarkAquastatic
const std::string DarkAquavarDarkRedstatic
const std::string DarkRedvarDarkPurplestatic
const std::string DarkPurplevarGoldstatic
const std::string GoldvarGraystatic
const std::string GrayvarDarkGraystatic
const std::string DarkGrayvarBluestatic
const std::string BluevarGreenstatic
const std::string GreenvarAquastatic
const std::string AquavarRedstatic
const std::string RedvarLightPurplestatic
const std::string LightPurplevarYellowstatic
const std::string YellowvarWhitestatic
const std::string WhitevarMinecoinGoldstatic
const std::string MinecoinGoldvarMaterialQuartzstatic
const std::string MaterialQuartzvarMaterialIronstatic
const std::string MaterialIronvarMaterialNetheritestatic
const std::string MaterialNetheritevarMaterialRedstonestatic
const std::string MaterialRedstonevarMaterialCopperstatic
const std::string MaterialCoppervarMaterialGoldstatic
const std::string MaterialGoldvarMaterialEmeraldstatic
const std::string MaterialEmeraldvarMaterialDiamondstatic
const std::string MaterialDiamondvarMaterialLapisstatic
const std::string MaterialLapisvarMaterialAmethyststatic
const std::string MaterialAmethystvarMaterialResinstatic
const std::string MaterialResinvarObfuscatedstatic
const std::string ObfuscatedvarBoldstatic
const std::string BoldvarItalicstatic
const std::string ItalicvarResetstatic
const std::string ResetclassIRegistry
Defined in <endstone/registry.h>
Methods
| Name | Description |
|---|---|
~IRegistry |
meth~IRegistryvirtual
~IRegistry() =defaultclassIdentifier
Defined in <endstone/identifier.h>
Represents a identifier consisting of two components: a namespace and a key.
Variables
| Name | Description |
|---|---|
Minecraft | The namespace representing all inbuilt keys. |
Methods
varMinecraftstaticconstexpr
std::string_view MinecraftThe namespace representing all inbuilt keys.
methIdentifierconstexprnoexcept
constexpr Identifier(const char* s) noexceptmethIdentifierconstexprnoexcept
constexpr Identifier(const std::string& s) noexceptmethIdentifierconstexprnoexcept
constexpr Identifier(const std::string_view& identifier) noexceptmethIdentifierconstexprnoexcept
constexpr Identifier(const std::string_view& namespace_, const std::string_view& key) noexceptmethgetNamespaceconstconstexprnoexcept
std::string_view getNamespace() const noexceptmethgetKeyconstconstexprnoexcept
std::string_view getKey() const noexceptmethoperator==constconstexprnoexcept
bool operator==(const Identifier& other) const noexceptmethoperator!=constconstexprnoexcept
bool operator!=(const Identifier& other) const noexceptmethoperator std::stringconst
operator std::string() constmethminecraftstaticconstexprnoexcept
Identifier minecraft(const std::string_view key) noexceptclassLogger
Defined in <endstone/logger.h>
Logger class which can format and output varies levels of logs.
Enums
| Name | Description |
|---|---|
Level | Specifies the log level. |
Methods
| Name | Description |
|---|---|
Logger | |
~Logger | |
setLevel | Set the logging level for this Logger instance. |
isEnabledFor | Check if the Logger instance is enabled for the given log Level. |
getName | Get the name of this Logger instance. |
log | Log a message at the given level. |
log | |
trace | |
trace | |
debug | |
debug | |
info | |
info | |
warning | |
warning | |
error | |
error | |
critical | |
critical |
enumLevel
std::uint8_t LevelSpecifies the log level.
Values
| Name | Value | Description |
|---|---|---|
Trace | 0 | |
Debug | 1 | |
Info | 2 | |
Warning | 3 | |
Error | 4 | |
Critical | 5 | |
Off | 6 |
methLogger
Logger() =defaultmeth~Loggervirtual
~Logger() =defaultmethsetLevelabstract
void setLevel(Level level) =0Set the logging level for this Logger instance.
Parameters
| Name | Type | Description |
|---|---|---|
level | Level | The desired log level |
methisEnabledForabstractconst
bool isEnabledFor(Level level) const =0Check if the Logger instance is enabled for the given log Level.
Parameters
| Name | Type | Description |
|---|---|---|
level | Level | The log level to check |
Returns
| Type | Description |
|---|---|
bool | true if the logger is enabled for the Level, false otherwise. |
methgetNameabstractconst
std::string_view getName() const =0Get the name of this Logger instance.
Returns
| Type | Description |
|---|---|
std::string_view | The name of this Logger instance. |
methlogabstractconst
void log(Level level, std::string_view message) const =0Log a message at the given level.
Parameters
| Name | Type | Description |
|---|---|---|
level | Level | The level at which the message should be logged. |
message | std::string_view | The message to log. |
methlogconst
void log(Level level, const std::format_string<Args...> format, Args&&... args) constmethtraceconst
void trace(const std::string_view message) constmethtraceconst
void trace(const std::format_string<Args...> format, Args&&... args) constmethdebugconst
void debug(const std::string_view message) constmethdebugconst
void debug(const std::format_string<Args...> format, Args&&... args) constmethinfoconst
void info(const std::string_view message) constmethinfoconst
void info(const std::format_string<Args...> format, Args&&... args) constmethwarningconst
void warning(const std::string_view message) constmethwarningconst
void warning(const std::format_string<Args...> format, Args&&... args) constmetherrorconst
void error(const std::string_view message) constmetherrorconst
void error(const std::format_string<Args...> format, Args&&... args) constmethcriticalconst
void critical(const std::string_view message) constmethcriticalconst
void critical(const std::format_string<Args...> format, Args&&... args) constclassOfflinePlayer
Defined in <endstone/offline_player.h>
Represents a reference to a player identity and the data belonging to a player that is stored on the disk and can, thus, be retrieved without the player needing to be online.
Methods
| Name | Description |
|---|---|
~OfflinePlayer | |
getName | Returns the name of this player. |
getUniqueId | Returns the UUID of this player. |
meth~OfflinePlayervirtual
~OfflinePlayer() =defaultmethgetNameabstractconst
std::string getName() const =0Returns the name of this player.
Returns
| Type | Description |
|---|---|
std::string | Player name or null if we have not seen a name for this player yet |
methgetUniqueIdabstractconst
UUID getUniqueId() const =0Returns the UUID of this player.
classPlayer
Defined in <endstone/player.h>
Bases: Mob, OfflinePlayer
Represents a player.
Type Aliases
| Name | Description |
|---|---|
FormVariant |
Methods
| Name | Description |
|---|---|
getName | Returns the name of this player. |
isOp | Checks if this player is a server operator. |
setOp | Sets the operator status of this player. |
getXuid | Returns the Xbox User ID (XUID) of this player. |
getAddress | Gets the socket address of this player. |
transfer | Transfers the player to another server. |
kick | Kicks player with custom kick message. |
performCommand | Makes the player perform the given command. |
isSneaking | Returns if the player is in sneak mode. |
setSneaking | Sets the sneak mode of the player. |
isSprinting | Gets whether the player is sprinting or not. |
setSprinting | Sets whether the player is sprinting or not. |
playSound | Play a sound for a player at the location. |
stopSound | Stop the specified sound from playing. |
stopAllSounds | Stop all sounds from playing. |
giveExp | Gives the player the amount of experience specified. |
giveExpLevels | Gives the player the amount of experience levels specified. |
getExpProgress | Gets the players current experience progress towards the next level. |
setExpProgress | Sets the players current experience progress towards the next level. |
getExpLevel | Gets the players current experience level. |
setExpLevel | Sets the players current experience level. |
getTotalExp | Gets the players total experience points. |
getAllowFlight | Determines if the Player is allowed to fly via jump key double-tap. |
setAllowFlight | Sets if the Player is allowed to fly via jump key double-tap. |
isFlying | Checks to see if this player is currently flying or not. |
setFlying | Makes this player start or stop flying. |
getFlySpeed | Gets the current allowed speed that a client can fly. |
setFlySpeed | |
getWalkSpeed | Gets the current allowed speed that a client can walk. |
setWalkSpeed | |
getScoreboard | Gets the Scoreboard displayed to this player. |
setScoreboard | |
sendPopup | Sends this player a popup message. |
sendTip | Sends this player a tip message. |
sendToast | Sends this player a toast notification. |
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. |
sendTitle | Sends a title and a subtitle message to the player. If they are empty strings, the display will be updated as such. |
resetTitle | Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values. |
spawnParticle | Spawns the particle at the target location. |
spawnParticle | Spawns the particle at the target location. |
spawnParticle | Spawns the particle at the target location. |
spawnParticle | Spawns the particle at the target location. |
getPing | Gets the player's average ping. |
getLocale | Gets the player's current locale. |
updateCommands | Send the list of commands to the client. |
getInventory | Get the player's inventory. |
getEnderChest | Get the player's EnderChest inventory. |
getGameMode | Gets this player's current GameMode. |
setGameMode | Sets this player's current GameMode. |
getDeviceOS | Gets the player's current device's operation system (OS). |
getDeviceId | Gets the player's current device id. |
getGameVersion | Gets the player's current game version. |
getSkin | Gets the player's skin. |
sendForm | Sends a form to the player. |
closeForm | Closes the forms that are currently open for the player. |
sendPacket | Sends a packet to the player. |
sendMap | Render a map and send it to the player in its entirety. |
typeFormVariantprotected
std::variant<MessageForm, ActionForm, ModalForm> FormVariantmethgetNameabstractconstoverride
std::string getName() const override=0Returns the name of this player.
Returns
| Type | Description |
|---|---|
std::string | Player name or null if we have not seen a name for this player yet |
methisOpabstractconst
bool isOp() const =0Checks if this player is a server operator.
Returns
| Type | Description |
|---|---|
bool | true if this is an operator, otherwise false |
methsetOpabstract
void setOp(bool value) =0Sets the operator status of this player.
Parameters
| Name | Type | Description |
|---|---|---|
value | bool | New operator value |
methgetXuidabstractconst
std::string getXuid() const =0Returns the Xbox User ID (XUID) of this player.
Returns
| Type | Description |
|---|---|
std::string | Player XUID |
methgetAddressabstractconst
SocketAddress getAddress() const =0Gets the socket address of this player.
Returns
| Type | Description |
|---|---|
SocketAddress | the player's socket address |
methtransferabstractconst
void transfer(std::string host, int port) const =0Transfers the player to another server.
Parameters
| Name | Type | Description |
|---|---|---|
host | std::string | Server address to transfer the player to. |
port | int | Server port to transfer the player to |
methkickabstractconst
void kick(std::string message) const =0Kicks player with custom kick message.
Parameters
| Name | Type | Description |
|---|---|---|
message | std::string | kick message |
methperformCommandabstractconst
bool performCommand(std::string command) const =0Makes the player perform the given command.
Parameters
| Name | Type | Description |
|---|---|---|
command | std::string | Command to perform |
Returns
| Type | Description |
|---|---|
bool | true if the command was successful, otherwise false |
methisSneakingabstractconst
bool isSneaking() const =0Returns if the player is in sneak mode.
Returns
| Type | Description |
|---|---|
bool | true if player is in sneak mode |
methsetSneakingabstract
void setSneaking(bool sneak) =0Sets the sneak mode of the player.
Parameters
| Name | Type | Description |
|---|---|---|
sneak | bool | true if player should appear sneaking |
methisSprintingabstractconst
bool isSprinting() const =0Gets whether the player is sprinting or not.
Returns
| Type | Description |
|---|---|
bool | true if player is sprinting. |
methsetSprintingabstract
void setSprinting(bool sprinting) =0Sets whether the player is sprinting or not.
Parameters
| Name | Type | Description |
|---|---|---|
sprinting | bool | true if the player should be sprinting |
methplaySoundabstract
void playSound(Location location, std::string sound, float volume, float pitch) =0Play a sound for a player at the location.
Parameters
| Name | Type | Description |
|---|---|---|
location | Location | The location to play the sound |
sound | std::string | The internal sound name to play |
volume | float | The volume of the sound |
pitch | float | The pitch of the sound |
methstopSoundabstract
void stopSound(std::string sound) =0Stop the specified sound from playing.
Parameters
| Name | Type | Description |
|---|---|---|
sound | std::string | the sound to stop |
methstopAllSoundsabstract
void stopAllSounds() =0Stop all sounds from playing.
methgiveExpabstract
void giveExp(int amount) =0Gives the player the amount of experience specified.
Parameters
| Name | Type | Description |
|---|---|---|
amount | int | Exp amount to give |
methgiveExpLevelsabstract
void giveExpLevels(int amount) =0Gives the player the amount of experience levels specified.
Parameters
| Name | Type | Description |
|---|---|---|
amount | int | amount of experience levels to give or take |
methgetExpProgressabstractconst
float getExpProgress() const =0Gets 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
| Type | Description |
|---|---|
float | Current experience points |
methsetExpProgressabstract
void setExpProgress(float progress) =0Sets 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
| Name | Type | Description |
|---|---|---|
progress | float | New experience progress |
methgetExpLevelabstractconst
int getExpLevel() const =0Gets the players current experience level.
Returns
| Type | Description |
|---|---|
int | Current experience level |
methsetExpLevelabstract
void setExpLevel(int level) =0Sets the players current experience level.
Parameters
| Name | Type | Description |
|---|---|---|
level | int | New experience level |
methgetTotalExpabstractconst
int getTotalExp() const =0Gets 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
| Type | Description |
|---|---|
int | Current total experience points |
methgetAllowFlightabstractconst
bool getAllowFlight() const =0Determines if the Player is allowed to fly via jump key double-tap.
Returns
| Type | Description |
|---|---|
bool | True if the player is allowed to fly. |
methsetAllowFlightabstract
void setAllowFlight(bool flight) =0Sets if the Player is allowed to fly via jump key double-tap.
Parameters
| Name | Type | Description |
|---|---|---|
flight | bool | If flight should be allowed. |
methisFlyingabstractconst
bool isFlying() const =0Checks to see if this player is currently flying or not.
Returns
| Type | Description |
|---|---|
bool | True if the player is flying, else false. |
methsetFlyingabstract
void setFlying(bool value) =0Makes this player start or stop flying.
Parameters
| Name | Type | Description |
|---|---|---|
value | bool | True to fly. |
methgetFlySpeedabstractconst
float getFlySpeed() const =0Gets the current allowed speed that a client can fly.
Returns
| Type | Description |
|---|---|
float | The current allowed speed, default is 0.05. |
methsetFlySpeedabstractconst
void setFlySpeed(float value) const =0Sets the speed at which a client will fly.
Parameters
| Name | Type | Description |
|---|---|---|
value | float | The new speed. |
methgetWalkSpeedabstractconst
float getWalkSpeed() const =0Gets the current allowed speed that a client can walk.
Returns
| Type | Description |
|---|---|
float | The current allowed speed, default is 0.10. |
methsetWalkSpeedabstractconst
void setWalkSpeed(float value) const =0Sets the speed at which a client will walk.
Parameters
| Name | Type | Description |
|---|---|---|
value | float | The new speed. |
methgetScoreboardabstractconst
Scoreboard& getScoreboard() const =0Gets the Scoreboard displayed to this player.
Returns
| Type | Description |
|---|---|
Scoreboard& | The current scoreboard seen by this player |
methsetScoreboardabstract
void setScoreboard(Scoreboard& scoreboard) =0@breif Sets the player's visible Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
scoreboard | Scoreboard& | New Scoreboard for the player |
methsendPopupabstractconst
void sendPopup(std::string message) const =0Sends this player a popup message.
Parameters
| Name | Type | Description |
|---|---|---|
message | std::string | Message to be displayed |
methsendTipabstractconst
void sendTip(std::string message) const =0Sends this player a tip message.
Parameters
| Name | Type | Description |
|---|---|---|
message | std::string | Message to be displayed |
methsendToastabstractconst
void sendToast(std::string title, std::string content) const =0Sends this player a toast notification.
Parameters
| Name | Type | Description |
|---|---|---|
title | std::string | The title of the toast notification. |
content | std::string | The content of the toast notification. |
methsendTitleabstractconst
void sendTitle(std::string title, std::string subtitle) const =0Sends 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
| Name | Type | Description |
|---|---|---|
title | std::string | Title text |
subtitle | std::string | Subtitle text |
methsendTitleabstractconst
void sendTitle(std::string title, std::string subtitle, int fade_in, int stay, int fade_out) const =0Sends a title and a subtitle message to the player. If they are empty strings, the display will be updated as such.
Parameters
| Name | Type | Description |
|---|---|---|
title | std::string | Title text |
subtitle | std::string | Subtitle text |
fade_in | int | time in ticks for titles to fade in. Defaults to 10. |
stay | int | time in ticks for titles to stay. Defaults to 70. |
fade_out | int | time in ticks for titles to fade out. Defaults to 20. |
methresetTitleabstractconst
void resetTitle() const =0Resets the title displayed to the player. This will clear the displayed title / subtitle and reset timings to their default values.
methspawnParticleabstractconst
void spawnParticle(std::string name, Location location) const =0Spawns the particle at the target location.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the particle effect to spawn |
location | Location | the location to spawn at |
methspawnParticleabstractconst
void spawnParticle(std::string name, float x, float y, float z) const =0Spawns the particle at the target location.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the particle effect to spawn |
x | float | the position on the x axis to spawn at |
y | float | the position on the y axis to spawn at |
z | float | the position on the z axis to spawn at |
methspawnParticleabstractconst
void spawnParticle(std::string name, Location location, std::optional<std::string> molang_variables_json) const =0Spawns the particle at the target location.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the particle effect to spawn |
location | Location | the location to spawn at |
molang_variables_json | std::optional<std::string> | the customizable molang variables that can be adjusted for this particle, in json |
methspawnParticleabstractconst
void spawnParticle(std::string name, float x, float y, float z, std::optional<std::string> molang_variables_json) const =0Spawns the particle at the target location.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the particle effect to spawn |
x | float | the position on the x axis to spawn at |
y | float | the position on the y axis to spawn at |
z | float | the position on the z axis to spawn at |
molang_variables_json | std::optional<std::string> | the customizable molang variables that can be adjusted for this particle, in json |
methgetPingabstractconst
std::chrono::milliseconds getPing() const =0Gets the player's average ping.
Returns
| Type | Description |
|---|---|
std::chrono::milliseconds | player ping |
methgetLocaleabstractconst
std::string getLocale() const =0Gets the player's current locale.
Returns
| Type | Description |
|---|---|
std::string | the player's locale |
methupdateCommandsabstractconst
void updateCommands() const =0Send the list of commands to the client.
Generally useful to ensure the client has a complete list of commands after permission changes are done.
methgetInventoryabstractconst
PlayerInventory& getInventory() const =0Get the player's inventory.
Returns
| Type | Description |
|---|---|
PlayerInventory& | The inventory of the player, this also contains the armor slots. |
methgetEnderChestabstractconst
Inventory& getEnderChest() const =0Get the player's EnderChest inventory.
Returns
| Type | Description |
|---|---|
Inventory& | The EnderChest of the player |
methgetGameModeabstractconst
GameMode getGameMode() const =0Gets this player's current GameMode.
Returns
| Type | Description |
|---|---|
GameMode | Current game mode |
methsetGameModeabstract
void setGameMode(GameMode mode) =0Sets this player's current GameMode.
Parameters
| Name | Type | Description |
|---|---|---|
mode | GameMode | New game mode |
methgetDeviceOSabstractconst
std::string getDeviceOS() const =0Gets the player's current device's operation system (OS).
Returns
| Type | Description |
|---|---|
std::string | the player's device OS |
methgetDeviceIdabstractconst
std::string getDeviceId() const =0Gets the player's current device id.
Returns
| Type | Description |
|---|---|
std::string | the player's device id |
methgetGameVersionabstractconst
std::string getGameVersion() const =0Gets the player's current game version.
Returns
| Type | Description |
|---|---|
std::string | the player's game version |
methgetSkinabstractconst
Skin getSkin() const =0Gets the player's skin.
Returns
| Type | Description |
|---|---|
Skin | the player's skin |
methsendFormabstract
void sendForm(FormVariant form) =0Sends a form to the player.
Parameters
| Name | Type | Description |
|---|---|---|
form | FormVariant | The form to send |
methcloseFormabstract
void closeForm() =0Closes the forms that are currently open for the player.
methsendPacketabstractconst
void sendPacket(int packet_id, std::string_view payload) const =0Sends a packet to the player.
Parameters
| Name | Type | Description |
|---|---|---|
packet_id | int | The packet ID to be sent. |
payload | std::string_view | The payload of the packet to be transmitted. |
methsendMapabstract
void sendMap(MapView& map) =0Render a map and send it to the player in its entirety.
This may be used when streaming the map in the normal manner is not desirable.
Parameters
| Name | Type | Description |
|---|---|---|
map | MapView& | The map to send |
classPreconditions
Defined in <endstone/check.h>
Methods
| Name | Description |
|---|---|
checkArgument | |
checkState |
methcheckArgumentstatic
void checkArgument(bool condition, std::format_string<Args...> format, Args&&... args)methcheckStatestatic
void checkState(bool condition, std::format_string<Args...> format, Args&&... args)classRegistry
Defined in <endstone/registry.h>
Bases: IRegistry
Abstract registry interface for objects with identifiers.
Provides lookup by identifier (nullable or exception-throwing) and iteration.
Methods
| Name | Description |
|---|---|
get | Get the object by its identifier. |
get | Get the object by its identifier. |
getOrThrow | Get the object by its identifier or throw if missing. |
getOrThrow | Get the object by its identifier or throw if missing. |
forEach | Apply a function to each stored element. |
methgetabstractnoexcept
T* get(Identifier<T> id) noexcept=0Get the object by its identifier.
Returns a raw pointer to the object, or nullptr if not found.
Parameters
| Name | Type | Description |
|---|---|---|
id | Identifier<T> | Identifier to look up. |
Returns
| Type | Description |
|---|---|
T* | T* Pointer to the object, or nullptr if it does not exist. |
methgetabstractconstnoexcept
const T* get(Identifier<T> id) const noexcept=0Get the object by its identifier.
Returns a raw pointer to the object, or nullptr if not found.
Parameters
| Name | Type | Description |
|---|---|---|
id | Identifier<T> | Non-null identifier to look up. |
Returns
| Type | Description |
|---|---|
const T* | const T* Pointer to the object, or nullptr if it does not exist. |
methgetOrThrowvirtual
T& getOrThrow(Identifier<T> id)Get the object by its identifier or throw if missing.
Parameters
| Name | Type | Description |
|---|---|---|
id | Identifier<T> | identifier of the object to retrieve. |
Returns
| Type | Description |
|---|---|
T& | T& Reference to the object with the given identifier. |
Raises
| Type | Description |
|---|---|
std::invalid_argument | if no object with the given identifier exists. |
methgetOrThrowvirtualconst
const T& getOrThrow(Identifier<T> id) constGet the object by its identifier or throw if missing.
Parameters
| Name | Type | Description |
|---|---|---|
id | Identifier<T> | identifier of the object to retrieve. |
Returns
| Type | Description |
|---|---|
const T& | const T& Const reference to the object with the given identifier. |
Raises
| Type | Description |
|---|---|
std::invalid_argument | if no object with the given identifier exists. |
methforEachabstractconst
void forEach(std::function<bool(const T&)> func) const =0Apply a function to each stored element.
Iterates over all stored elements and applies the provided function to them. The iteration continues until the function returns false or all elements have been processed.
Parameters
| Name | Type | Description |
|---|---|---|
func | std::function<bool(const T&)> | A callable object taking a const reference to an element and returning a boolean. Returning false stops the iteration. |
classServer
Defined in <endstone/server.h>
Represents a server implementation.
Variables
| Name | Description |
|---|---|
BroadcastChannelAdmin | Used for all administrative messages, such as an operator using a command. |
BroadcastChannelUser | Used for all announcement messages, such as informing users that a player has joined. |
Methods
| Name | Description |
|---|---|
Server | |
Server | |
operator= | |
~Server | |
getName | Gets the name of this server implementation. |
getVersion | Gets the version string of this server implementation. |
getMinecraftVersion | Gets the Minecraft version that this server is running. |
getProtocolVersion | Gets the network protocol version that this server supports. |
getLogger | Returns the primary logger associated with this server instance. |
getLanguage | Gets the current language interface used by the server. |
getPluginManager | Gets the plugin manager for interfacing with plugins. |
getPluginCommand | Gets a PluginCommand with the given name or alias. |
getCommandSender | Gets a CommandSender for this server. |
dispatchCommand | Dispatches a command on this server, and executes it if found. |
getScheduler | Gets the scheduler for managing scheduled events. |
getLevel | Gets the server level. |
getOnlinePlayers | Gets a list of all currently online players. |
getMaxPlayers | Get the maximum amount of players which can login to this server. |
setMaxPlayers | Set the maximum amount of players allowed to be logged in at once. |
getPlayer | Gets the player with the given UUID. |
getPort | Get the game port that the server runs on. |
getPortV6 | Get the game port (IPv6) that the server runs on. |
getOnlineMode | Gets whether the Server is in online mode or not. |
getPlayer | Gets the player with the exact given name, case-insensitive. |
shutdown | Shutdowns the server, stopping everything. |
reload | Reloads the server configuration, functions, scripts and plugins. |
reloadData | Reload only the Minecraft data for the server. |
broadcast | Broadcasts the specified message to every user with the given permission name. |
broadcastMessage | Broadcasts the specified message to every user with permission endstone.broadcast.user. |
broadcastMessage | |
isPrimaryThread | Checks the current thread against the expected primary server thread. |
getItemFactory | |
getScoreboard | Gets the primary Scoreboard controlled by the server. |
createScoreboard | Creates a new Scoreboard to be tracked by the server. |
getCurrentMillisecondsPerTick | Gets the current milliseconds per tick (MSPT). |
getAverageMillisecondsPerTick | Gets the average milliseconds per tick (MSPT). |
getCurrentTicksPerSecond | Gets the current ticks per second (TPS). |
getAverageTicksPerSecond | Gets the average ticks per second (TPS). |
getCurrentTickUsage | Gets the current tick usage of the server. |
getAverageTickUsage | Gets the average tick usage of the server. |
getStartTime | Gets the start time of the server. |
createBossBar | Creates a boss bar instance to display to players. The progress defaults to 1.0. |
createBossBar | Creates a boss bar instance to display to players. The progress defaults to 1.0. |
createBlockData | Creates a new BlockData instance for the specified block type, with all properties initialized to defaults. |
createBlockData | Creates a new BlockData instance for the specified block type, with all properties initialized to defaults, except for those provided in data. |
getBanList | |
getIpBanList | |
getServiceManager | |
_getRegistry | Returns the registry for the given type. |
getRegistry | |
getMap | Gets the map from the given item ID. |
createMap | Create a new map with an automatically assigned ID. |
varBroadcastChannelAdminstatic
const std::string BroadcastChannelAdminUsed for all administrative messages, such as an operator using a command.
varBroadcastChannelUserstatic
const std::string BroadcastChannelUserUsed for all announcement messages, such as informing users that a player has joined.
methServer
Server() =defaultmethServer
Server(const Server&) =deletemethoperator=
meth~Servervirtual
~Server() =defaultmethgetNameabstractconst
std::string getName() const =0Gets the name of this server implementation.
Returns
| Type | Description |
|---|---|
std::string | name of this server implementation |
methgetVersionabstractconst
std::string getVersion() const =0Gets the version string of this server implementation.
Returns
| Type | Description |
|---|---|
std::string | version of this server implementation |
methgetMinecraftVersionabstractconst
std::string getMinecraftVersion() const =0Gets the Minecraft version that this server is running.
Returns
| Type | Description |
|---|---|
std::string | version of Minecraft |
methgetProtocolVersionabstractconst
int getProtocolVersion() const =0Gets the network protocol version that this server supports.
Returns
| Type | Description |
|---|---|
int | version of network protocol |
methgetLoggerabstractconst
Logger& getLogger() const =0Returns the primary logger associated with this server instance.
methgetLanguageabstractconst
Language& getLanguage() const =0Gets the current language interface used by the server.
methgetPluginManagerabstractconst
PluginManager& getPluginManager() const =0Gets the plugin manager for interfacing with plugins.
Returns
| Type | Description |
|---|---|
PluginManager& | a plugin manager for this Server instance |
methgetPluginCommandabstractconst
PluginCommand* getPluginCommand(std::string name) const =0Gets a PluginCommand with the given name or alias.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the command to retrieve |
Returns
| Type | Description |
|---|---|
PluginCommand* | a plugin command if found, null otherwise |
methgetCommandSenderabstractconst
ConsoleCommandSender& getCommandSender() const =0Gets a CommandSender for this server.
Returns
| Type | Description |
|---|---|
ConsoleCommandSender& | a console command sender |
methdispatchCommandabstractconst
bool dispatchCommand(CommandSender& sender, std::string command_line) const =0Dispatches a command on this server, and executes it if found.
Parameters
| Name | Type | Description |
|---|---|---|
sender | CommandSender& | the apparent sender of the command |
command_line | std::string | the command + arguments. |
Returns
| Type | Description |
|---|---|
bool | true if execution is successful, false otherwise |
methgetSchedulerabstractconst
Scheduler& getScheduler() const =0Gets the scheduler for managing scheduled events.
Returns
| Type | Description |
|---|---|
Scheduler& | a scheduling service for this server |
methgetLevelabstractconst
Level* getLevel() const =0Gets the server level.
Returns
| Type | Description |
|---|---|
Level* | the server level |
methgetOnlinePlayersabstractconst
std::vector<Player*> getOnlinePlayers() const =0Gets a list of all currently online players.
Returns
| Type | Description |
|---|---|
std::vector<Player*> | a list of currently online players. |
methgetMaxPlayersabstractconst
int getMaxPlayers() const =0Get the maximum amount of players which can login to this server.
Returns
| Type | Description |
|---|---|
int | the amount of players this server allows |
methsetMaxPlayersabstract
void setMaxPlayers(int max_players) =0Set the maximum amount of players allowed to be logged in at once.
Parameters
| Name | Type | Description |
|---|---|---|
max_players | int | The maximum amount of concurrent players |
methgetPlayerabstractconst
Player* getPlayer(endstone::UUID id) const =0Gets the player with the given UUID.
Parameters
| Name | Type | Description |
|---|---|---|
id | endstone::UUID | UUID of the player to retrieve |
Returns
| Type | Description |
|---|---|
Player* | a player object if one was found, null otherwise |
methgetPortabstractconst
int getPort() const =0Get the game port that the server runs on.
Returns
| Type | Description |
|---|---|
int | the port number of this server |
methgetPortV6abstractconst
int getPortV6() const =0Get the game port (IPv6) that the server runs on.
Returns
| Type | Description |
|---|---|
int | the port number of this server |
methgetOnlineModeabstractconst
bool getOnlineMode() const =0Gets whether the Server is in online mode or not.
Returns
| Type | Description |
|---|---|
bool | true if the server authenticates clients, false otherwise |
methgetPlayerabstractconst
Player* getPlayer(std::string name) const =0Gets the player with the exact given name, case-insensitive.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | Exact name of the player to retrieve |
Returns
| Type | Description |
|---|---|
Player* | a player object if one was found, null otherwise |
methshutdownabstract
void shutdown() =0Shutdowns the server, stopping everything.
methreloadabstract
void reload() =0Reloads the server configuration, functions, scripts and plugins.
methreloadDataabstract
void reloadData() =0Reload only the Minecraft data for the server.
This includes functions and script files from all behaviour packs.
methbroadcastabstractconst
void broadcast(const Message& message, const std::string& permission) const =0Broadcasts the specified message to every user with the given permission name.
Parameters
| Name | Type | Description |
|---|---|---|
message | const Message& | message to broadcast |
permission | const std::string& | the required permission Permissibles must have to receive the broadcast |
methbroadcastMessageabstractconst
void broadcastMessage(const Message& message) const =0Broadcasts the specified message to every user with permission endstone.broadcast.user.
Parameters
| Name | Type | Description |
|---|---|---|
message | const Message& | the message |
methbroadcastMessageconst
void broadcastMessage(const std::format_string<Args...> format, Args&&... args) constmethisPrimaryThreadabstractconst
bool isPrimaryThread() const =0Checks the current thread against the expected primary server thread.
Returns
| Type | Description |
|---|---|
bool | true if the current thread matches the expected primary thread, false otherwise |
methgetItemFactoryabstractconst
ItemFactory& getItemFactory() const =0Gets the instance of the item factory (for ItemMeta).
See also
Returns
| Type | Description |
|---|---|
ItemFactory& | the item factory |
methgetScoreboardabstractconst
Scoreboard* getScoreboard() const =0Gets the primary Scoreboard controlled by the server.
This Scoreboard is saved by the server, is affected by the /scoreboard command, and is the scoreboard shown by default to players. This will only exist after the level has been loaded.
Returns
| Type | Description |
|---|---|
Scoreboard* | the default server scoreboard |
methcreateScoreboardabstract
std::shared_ptr<Scoreboard> createScoreboard() =0Creates a new Scoreboard to be tracked by the server.
This will not be saved by the server and is not affected by the /scoreboard command.
Returns
| Type | Description |
|---|---|
std::shared_ptr<Scoreboard> | the newly created Scoreboard |
methgetCurrentMillisecondsPerTickabstract
float getCurrentMillisecondsPerTick() =0Gets the current milliseconds per tick (MSPT).
Returns
| Type | Description |
|---|---|
float | The average current of milliseconds per tick. |
methgetAverageMillisecondsPerTickabstract
float getAverageMillisecondsPerTick() =0Gets the average milliseconds per tick (MSPT).
Returns
| Type | Description |
|---|---|
float | The average number of milliseconds per tick. |
methgetCurrentTicksPerSecondabstract
float getCurrentTicksPerSecond() =0Gets the current ticks per second (TPS).
Returns
| Type | Description |
|---|---|
float | The current ticks per second |
methgetAverageTicksPerSecondabstract
float getAverageTicksPerSecond() =0Gets the average ticks per second (TPS).
Returns
| Type | Description |
|---|---|
float | The average ticks per second |
methgetCurrentTickUsageabstract
float getCurrentTickUsage() =0Gets the current tick usage of the server.
Returns
| Type | Description |
|---|---|
float | The current tick usage in percentage. |
methgetAverageTickUsageabstract
float getAverageTickUsage() =0Gets the average tick usage of the server.
Returns
| Type | Description |
|---|---|
float | The average tick usage in percentage. |
methgetStartTimeabstract
std::chrono::system_clock::time_point getStartTime() =0Gets the start time of the server.
Returns
| Type | Description |
|---|---|
std::chrono::system_clock::time_point | The start time of the server. |
methcreateBossBarabstractconst
std::unique_ptr<BossBar> createBossBar(std::string title, BarColor color, BarStyle style) const =0Creates a boss bar instance to display to players. The progress defaults to 1.0.
Parameters
| Name | Type | Description |
|---|---|---|
title | std::string | the title of the boss bar |
color | BarColor | the color of the boss bar |
style | BarStyle | the style of the boss bar |
Returns
| Type | Description |
|---|---|
std::unique_ptr<BossBar> | the created boss bar |
methcreateBossBarabstractconst
std::unique_ptr<BossBar> createBossBar(std::string title, BarColor color, BarStyle style, std::vector<BarFlag> flags) const =0Creates a boss bar instance to display to players. The progress defaults to 1.0.
Parameters
| Name | Type | Description |
|---|---|---|
title | std::string | the title of the boss bar |
color | BarColor | the color of the boss bar |
style | BarStyle | the style of the boss bar |
flags | std::vector<BarFlag> | a list of flags to set on the boss bar |
Returns
| Type | Description |
|---|---|
std::unique_ptr<BossBar> | the created boss bar |
methcreateBlockDataabstractconst
std::unique_ptr<BlockData> createBlockData(std::string type) const =0Creates a new BlockData instance for the specified block type, with all properties initialized to defaults.
Parameters
| Name | Type | Description |
|---|---|---|
type | std::string | the block type |
Returns
| Type | Description |
|---|---|
std::unique_ptr<BlockData> | new data instance |
methcreateBlockDataabstractconst
std::unique_ptr<BlockData> createBlockData(std::string type, BlockStates block_states) const =0Creates a new BlockData instance for the specified block type, with all properties initialized to defaults, except for those provided in data.
Parameters
| Name | Type | Description |
|---|---|---|
type | std::string | the block type |
block_states | BlockStates | block states, for example {"old_leaf_type":"birch", "persistent_bit":true} |
Returns
| Type | Description |
|---|---|
std::unique_ptr<BlockData> | new data instance |
methgetBanListabstractconst
PlayerBanList& getBanList() const =0Gets the player ban list.
Returns
| Type | Description |
|---|---|
PlayerBanList& | The player ban list |
methgetIpBanListabstractconst
IpBanList& getIpBanList() const =0Gets the IP ban list.
Returns
| Type | Description |
|---|---|
IpBanList& | The IP ban list |
methgetServiceManagerabstractconst
ServiceManager& getServiceManager() const =0Gets the service manager.
Returns
| Type | Description |
|---|---|
ServiceManager& | The service manager |
meth_getRegistryabstractconst
IRegistry* _getRegistry(const std::string& type) const =0Returns the registry for the given type.
If no registry is present for the given type null will be returned.
Parameters
| Name | Type | Description |
|---|---|---|
type | const std::string& | of the registry to get |
Returns
| Type | Description |
|---|---|
IRegistry* | the corresponding registry or null if not present |
methgetRegistryconst
const Registry<T>& getRegistry() constmethgetMapabstractconst
MapView* getMap(std::int64_t id) const =0Gets the map from the given item ID.
Parameters
| Name | Type | Description |
|---|---|---|
id | std::int64_t | the id of the map to get |
Returns
| Type | Description |
|---|---|
MapView* | a map view if it exists, or null otherwise |
methcreateMapabstractconst
Create a new map with an automatically assigned ID.
Returns
| Type | Description |
|---|---|
MapView& | a newly created map view |
classSkin
Defined in <endstone/skin.h>
Represents a player skin.
Methods
| Name | Description |
|---|---|
Skin | |
getId | Gets the skin id. |
getImage | Gets the skin image. |
getCapeId | Gets the cape id. |
getCapeImage | Gets the cape image. |
methSkin
Skin(std::string id, Image image, std::optional<std::string> cape_id = std::nullopt, std::optional<Image> cape_image = std::nullopt)methgetIdconst
const std::string& getId() constGets the skin id.
Returns
| Type | Description |
|---|---|
const std::string& | the skin id. |
methgetImageconst
const Image& getImage() constGets the skin image.
Returns
| Type | Description |
|---|---|
const Image& | the skin image. |
methgetCapeIdconst
const std::optional<std::string>& getCapeId() constGets the cape id.
Returns
| Type | Description |
|---|---|
const std::optional<std::string>& | the cape id. |
methgetCapeImageconst
const Image* getCapeImage() constGets the cape image.
Returns
| Type | Description |
|---|---|
const Image* | the cape image. |
classType
Defined in <endstone/registry.h>
CRTP base for registry-backed types identified by an Identifier.
Provides getId(), getTranslationKey() pure virtual declarations, comparison operators, implicit conversion to Id, and a static get() method.
Type Aliases
| Name | Description |
|---|---|
Id |
Methods
| Name | Description |
|---|---|
~Type | |
getId | Return the identifier of this object. |
getTranslationKey | Get the translation key, suitable for use in a translation component. |
operator== | |
operator!= | |
operator== | |
operator!= | |
operator Id | |
get | Look up a registry entry by identifier. |
typeId
Identifier<T> Idmeth~Typevirtual
~Type() =defaultmethgetIdabstractconst
Id getId() const =0Return the identifier of this object.
Returns
| Type | Description |
|---|---|
Id | this object's identifier |
methgetTranslationKeyabstractconst
std::string getTranslationKey() const =0Get the translation key, suitable for use in a translation component.
Returns
| Type | Description |
|---|---|
std::string | the translation key |
methoperator==const
bool operator==(const Id& other) constmethoperator!=const
bool operator!=(const Id& other) constmethoperator==const
bool operator==(const T& other) constmethoperator!=const
bool operator!=(const T& other) constmethoperator Idconst
operator Id() constmethgetstatic
const T* get(Id id)Look up a registry entry by identifier.
Parameters
| Name | Type | Description |
|---|---|---|
id | Id | Identifier to look up. |
Returns
| Type | Description |
|---|---|
const T* | Pointer to the entry, or nullptr if not found. |
structoverloaded
Defined in <endstone/variant.h>
Bases: Func...
Helper type for visitors.
enumGameMode
GameModeRepresents the various type of game modes that Players may have.
Values
| Name | Value | Description |
|---|---|---|
Survival | 0 | Survival mode is the "normal" gameplay type, with no special features. |
Creative | 1 | Creative mode may fly, build instantly, become invulnerable and create free items. |
Adventure | 2 | Adventure mode cannot break blocks without the correct tools. |
Spectator | 3 | Spectator mode cannot interact with the world in anyway and is invisible to normal players. This grants the player the ability to no-clip through the world. |
typeMessage
std::variant<std::string, Translatable> Messagefuncoverloaded
overloaded(Func...) -> overloaded< Func... >Deduction guide.
Parameters
| Name | Type | Description |
|---|---|---|
Func | Types of function objects. |