Class endstone::Server¶
Represents a server implementation.
#include <endstone/server.h>
Public Static Attributes¶
Type | Name |
---|---|
const std::string | BroadcastChannelAdmin = = "endstone.broadcast.admin" Used for all administrative messages, such as an operator using a command. |
const std::string | BroadcastChannelUser = = "endstone.broadcast.user" Used for all announcement messages, such as informing users that a player has joined. |
Public Functions¶
Type | Name |
---|---|
Server () = default |
|
Server (const Server &) = delete |
|
virtual void | broadcast (const Message & message, const std::string & permission) const = 0 Broadcasts the specified message to every user with the given permission name. |
virtual void | broadcastMessage (const Message & message) const = 0 Broadcasts the specified message to every user with permission endstone.broadcast.user. |
void | broadcastMessage (const fmt::format_string< Args... > format, Args &&... args) const |
virtual Result< std::shared_ptr< BlockData > > | createBlockData (std::string type) const = 0 Creates a new BlockData instance for the specified block type, with all properties initialized to defaults. |
virtual Result< std::shared_ptr< BlockData > > | createBlockData (std::string type, BlockStates block_states) const = 0 Creates a new BlockData instance for the specified block type, with all properties initialized to defaults, except for those provided in data. |
virtual std::unique_ptr< BossBar > | createBossBar (std::string title, BarColor color, BarStyle style) const = 0 Creates a boss bar instance to display to players. The progress defaults to 1.0. |
virtual std::unique_ptr< BossBar > | createBossBar (std::string title, BarColor color, BarStyle style, std::vector< BarFlag > flags) const = 0 Creates a boss bar instance to display to players. The progress defaults to 1.0. |
virtual std::shared_ptr< Scoreboard > | createScoreboard () = 0 Creates a new Scoreboard to be tracked by the server. |
virtual bool | dispatchCommand (CommandSender & sender, std::string command_line) const = 0 Dispatches a command on this server, and executes it if found. |
virtual float | getAverageMillisecondsPerTick () = 0 Gets the average milliseconds per tick (MSPT). |
virtual float | getAverageTickUsage () = 0 Gets the average tick usage of the server. |
virtual float | getAverageTicksPerSecond () = 0 Gets the average ticks per second (TPS). |
virtual PlayerBanList & | getBanList () const = 0 |
virtual ConsoleCommandSender & | getCommandSender () const = 0 Gets a CommandSender for this server. |
virtual float | getCurrentMillisecondsPerTick () = 0 Gets the current milliseconds per tick (MSPT). |
virtual float | getCurrentTickUsage () = 0 Gets the current tick usage of the server. |
virtual float | getCurrentTicksPerSecond () = 0 Gets the current ticks per second (TPS). |
virtual IpBanList & | getIpBanList () const = 0 |
virtual Language & | getLanguage () const = 0 Gets the current language interface used by the server. |
virtual Level * | getLevel () const = 0 Gets the server level. |
virtual Logger & | getLogger () const = 0 Returns the primary logger associated with this server instance. |
virtual int | getMaxPlayers () const = 0 Get the maximum amount of players which can login to this server. |
virtual std::string | getMinecraftVersion () const = 0 Gets the Minecraft version that this server is running. |
virtual std::string | getName () const = 0 Gets the name of this server implementation. |
virtual bool | getOnlineMode () const = 0 Gets whether the Server is in online mode or not. |
virtual std::vector< Player * > | getOnlinePlayers () const = 0 Gets a list of all currently online players. |
virtual Player * | getPlayer (endstone::UUID id) const = 0 Gets the player with the given UUID . |
virtual Player * | getPlayer (std::string name) const = 0 Gets the player with the exact given name, case-insensitive. |
virtual PluginCommand * | getPluginCommand (std::string name) const = 0 Gets a PluginCommand with the given name or alias. |
virtual PluginManager & | getPluginManager () const = 0 Gets the plugin manager for interfacing with plugins. |
virtual Scheduler & | getScheduler () const = 0 Gets the scheduler for managing scheduled events. |
virtual Scoreboard * | getScoreboard () const = 0 Gets the primary Scoreboard controlled by the server. |
virtual std::chrono::system_clock::time_point | getStartTime () = 0 Gets the start time of the server. |
virtual std::string | getVersion () const = 0 Gets the version string of this server implementation. |
virtual bool | isPrimaryThread () const = 0 Checks the current thread against the expected primary server thread. |
Server & | operator= (const Server &) = delete |
virtual void | reload () = 0 Reloads the server configuration, functions, scripts and plugins. |
virtual void | reloadData () = 0 Reload only the Minecraft data for the server. |
virtual Result< void > | setMaxPlayers (int max_players) = 0 Set the maximum amount of players allowed to be logged in at once. |
virtual void | shutdown () = 0 Shutdowns the server, stopping everything. |
virtual | ~Server () = default |
Public Static Attributes Documentation¶
variable BroadcastChannelAdmin¶
Used for all administrative messages, such as an operator using a command.
variable BroadcastChannelUser¶
Used for all announcement messages, such as informing users that a player has joined.
Public Functions Documentation¶
function Server [½]¶
function Server [2/2]¶
function broadcast¶
Broadcasts the specified message to every user with the given permission name.
virtual void endstone::Server::broadcast (
const Message & message,
const std::string & permission
) const = 0
Parameters:
message
message to broadcastpermission
the required permission Permissibles must have to receive the broadcast
function broadcastMessage [½]¶
Broadcasts the specified message to every user with permission endstone.broadcast.user.
Parameters:
message
the message
function broadcastMessage [2/2]¶
template<typename... Args>
inline void endstone::Server::broadcastMessage (
const fmt::format_string< Args... > format,
Args &&... args
) const
function createBlockData [½]¶
Creates a new BlockData instance for the specified block type, with all properties initialized to defaults.
virtual Result< std::shared_ptr< BlockData > > endstone::Server::createBlockData (
std::string type
) const = 0
Parameters:
type
the block type
Returns:
new data instance
function createBlockData [2/2]¶
Creates a new BlockData instance for the specified block type, with all properties initialized to defaults, except for those provided in data.
virtual Result< std::shared_ptr< BlockData > > endstone::Server::createBlockData (
std::string type,
BlockStates block_states
) const = 0
Parameters:
type
the block typeblock_states
block states, for example {"old_leaf_type":"birch", "persistent_bit":true}
Returns:
new data instance
function createBossBar [½]¶
Creates a boss bar instance to display to players. The progress defaults to 1.0.
virtual std::unique_ptr< BossBar > endstone::Server::createBossBar (
std::string title,
BarColor color,
BarStyle style
) const = 0
Parameters:
title
the title of the boss barcolor
the color of the boss barstyle
the style of the boss bar
Returns:
the created boss bar
function createBossBar [2/2]¶
Creates a boss bar instance to display to players. The progress defaults to 1.0.
virtual std::unique_ptr< BossBar > endstone::Server::createBossBar (
std::string title,
BarColor color,
BarStyle style,
std::vector< BarFlag > flags
) const = 0
Parameters:
title
the title of the boss barcolor
the color of the boss barstyle
the style of the boss barflags
a list of flags to set on the boss bar
Returns:
the created boss bar
function createScoreboard¶
Creates 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:
the newly created Scoreboard
function dispatchCommand¶
Dispatches a command on this server, and executes it if found.
virtual bool endstone::Server::dispatchCommand (
CommandSender & sender,
std::string command_line
) const = 0
Parameters:
sender
the apparent sender of the commandcommand_line
the command + arguments.
Returns:
true if execution is successful, false otherwise
function getAverageMillisecondsPerTick¶
Gets the average milliseconds per tick (MSPT).
Returns:
The average number of milliseconds per tick.
function getAverageTickUsage¶
Gets the average tick usage of the server.
Returns:
The average tick usage in percentage.
function getAverageTicksPerSecond¶
Gets the average ticks per second (TPS).
Returns:
The average ticks per second
function getBanList¶
Gets the player ban list.
Returns:
The player ban list
function getCommandSender¶
Gets a CommandSender for this server.
Returns:
a console command sender
function getCurrentMillisecondsPerTick¶
Gets the current milliseconds per tick (MSPT).
Returns:
The average current of milliseconds per tick.
function getCurrentTickUsage¶
Gets the current tick usage of the server.
Returns:
The current tick usage in percentage.
function getCurrentTicksPerSecond¶
Gets the current ticks per second (TPS).
Returns:
The current ticks per second
function getIpBanList¶
Gets the IP ban list.
Returns:
The IP ban list
function getLanguage¶
Gets the current language interface used by the server.
Returns:
Language interface used by the server for translations.
function getLevel¶
Gets the server level.
Returns:
the server level
function getLogger¶
Returns the primary logger associated with this server instance.
Returns:
Logger associated with this server
function getMaxPlayers¶
Get the maximum amount of players which can login to this server.
Returns:
the amount of players this server allows
function getMinecraftVersion¶
Gets the Minecraft version that this server is running.
Returns:
version of Minecraft
function getName¶
Gets the name of this server implementation.
Returns:
name of this server implementation
function getOnlineMode¶
Gets whether the Server is in online mode or not.
Returns:
true if the server authenticates clients, false otherwise
function getOnlinePlayers¶
Gets a list of all currently online players.
Returns:
a list of currently online players.
function getPlayer [½]¶
Gets the player with the given UUID .
Parameters:
id
UUID of the player to retrieve
Returns:
a player object if one was found, null otherwise
function getPlayer [2/2]¶
Gets the player with the exact given name, case-insensitive.
Parameters:
name
Exact name of the player to retrieve
Returns:
a player object if one was found, null otherwise
function getPluginCommand¶
Gets a PluginCommand with the given name or alias.
Parameters:
name
the name of the command to retrieve
Returns:
a plugin command if found, null otherwise
function getPluginManager¶
Gets the plugin manager for interfacing with plugins.
Returns:
a plugin manager for this Server instance
function getScheduler¶
Gets the scheduler for managing scheduled events.
Returns:
a scheduling service for this server
function getScoreboard¶
Gets 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:
the default server scoreboard
function getStartTime¶
Gets the start time of the server.
Returns:
The start time of the server。
function getVersion¶
Gets the version string of this server implementation.
Returns:
version of this server implementation
function isPrimaryThread¶
Checks the current thread against the expected primary server thread.
Returns:
true if the current thread matches the expected primary thread, false otherwise
function operator=¶
function reload¶
Reloads the server configuration, functions, scripts and plugins.
function reloadData¶
Reload only the Minecraft data for the server.
This includes functions and script files from all behaviour packs.
function setMaxPlayers¶
Set the maximum amount of players allowed to be logged in at once.
Parameters:
max_players
The maximum amount of concurrent players
function shutdown¶
Shutdowns the server, stopping everything.
function ~Server¶
The documentation for this class was generated from the following file include/endstone/server.h