Skip to content

Server

endstone.Server

Represents a server implementation.

Methods:

Name Description
broadcast

Broadcasts the specified message to every user with the given permission name.

broadcast_message

Broadcasts the specified message to every user with permission endstone.broadcast.user.

create_block_data

Creates a new BlockData instance for the specified block type, with all properties initialized to defaults,

create_boss_bar

Creates a boss bar instance to display to players. The progress defaults to 1.0.

create_map

Create a new map with an automatically assigned ID.

create_scoreboard

Creates a new Scoreboard to be tracked by the server.

dispatch_command

Dispatches a command on this server, and executes it if found.

get_map

Gets the map from the given item ID.

get_player
get_plugin_command

Gets a PluginCommand with the given name or alias.

get_registry

Returns the registry for the given type.

reload

Reloads the server configuration, functions, scripts and plugins.

reload_data

Reload only the Minecraft data for the server.

shutdown

Shutdowns the server, stopping everything.

Attributes:

Name Type Description
average_mspt float

The average milliseconds per tick (MSPT).

average_tick_usage float

The average tick usage of the server.

average_tps float

The average ticks per second (TPS).

ban_list PlayerBanList

The player ban list.

command_sender ConsoleCommandSender

A console CommandSender for this server.

current_mspt float

The current milliseconds per tick (MSPT).

current_tick_usage float

The current tick usage of the server.

current_tps float

The current ticks per second (TPS).

ip_ban_list IpBanList

The IP ban list.

item_factory ItemFactory

The instance of the item factory (for ItemMeta).

language Language

The current language interface used by the server for translations.

level Level

The server level.

logger Logger

The primary logger associated with this server instance.

max_players int

The maximum amount of players which can login to this server.

minecraft_version str

The Minecraft version that this server is running.

name str

The name of this server implementation.

online_mode bool

Whether the Server is in online mode or not.

online_players list[Player]

A list of all currently online players.

plugin_manager PluginManager

The plugin manager for interfacing with plugins.

port int

The game port that the server runs on.

port_v6 int

The game port (IPv6) that the server runs on.

protocol_version int

The network protocol version that this server supports.

scheduler Scheduler

The scheduler for managing scheduled events.

scoreboard Scoreboard | None

The primary Scoreboard controlled by the server.

service_manager ServiceManager

The service manager.

start_time datetime

The start time of the server.

version str

The version string of this server implementation.

average_mspt property

average_mspt: float

The average milliseconds per tick (MSPT).

average_tick_usage property

average_tick_usage: float

The average tick usage of the server.

average_tps property

average_tps: float

The average ticks per second (TPS).

ban_list property

ban_list: PlayerBanList

The player ban list.

command_sender property

command_sender: ConsoleCommandSender

A console CommandSender for this server.

current_mspt property

current_mspt: float

The current milliseconds per tick (MSPT).

current_tick_usage property

current_tick_usage: float

The current tick usage of the server.

current_tps property

current_tps: float

The current ticks per second (TPS).

ip_ban_list property

ip_ban_list: IpBanList

The IP ban list.

item_factory property

item_factory: ItemFactory

The instance of the item factory (for ItemMeta).

language property

language: Language

The current language interface used by the server for translations.

level property

level: Level

The server level.

logger property

logger: Logger

The primary logger associated with this server instance.

max_players property writable

max_players: int

The maximum amount of players which can login to this server.

minecraft_version property

minecraft_version: str

The Minecraft version that this server is running.

name property

name: str

The name of this server implementation.

online_mode property

online_mode: bool

Whether the Server is in online mode or not.

online_players property

online_players: list[Player]

A list of all currently online players.

plugin_manager property

plugin_manager: PluginManager

The plugin manager for interfacing with plugins.

port property

port: int

The game port that the server runs on.

port_v6 property

port_v6: int

The game port (IPv6) that the server runs on.

protocol_version property

protocol_version: int

The network protocol version that this server supports.

scheduler property

scheduler: Scheduler

The scheduler for managing scheduled events.

scoreboard property

scoreboard: Scoreboard | None

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.

service_manager property

service_manager: ServiceManager

The service manager.

start_time property

start_time: datetime

The start time of the server.

version property

version: str

The version string of this server implementation.

broadcast

broadcast(
    message: str | Translatable, permission: str
) -> None

Broadcasts the specified message to every user with the given permission name.

Parameters:

Name Type Description Default
message str | Translatable

Message to broadcast.

required
permission str

The required permission Permissibles must have to receive the broadcast.

required

broadcast_message

broadcast_message(message: str | Translatable) -> None

Broadcasts the specified message to every user with permission endstone.broadcast.user.

Parameters:

Name Type Description Default
message str | Translatable

The message.

required

create_block_data

create_block_data(
    type: Identifier[BlockType] | str,
    block_states: (
        Mapping[str, bool | str | int] | None
    ) = None,
) -> BlockData

Creates a new BlockData instance for the specified block type, with all properties initialized to defaults, except for those provided in block_states.

Parameters:

Name Type Description Default
type Identifier[BlockType] | str

The block type.

required
block_states Mapping[str, bool | str | int] | None

Block states, for example {"old_leaf_type":"birch", "persistent_bit":True}.

None

Returns:

Type Description
BlockData

New data instance.

create_boss_bar

create_boss_bar(
    title: str,
    color: BarColor,
    style: BarStyle,
    flags: list[BarFlag] | None = None,
) -> BossBar

Creates a boss bar instance to display to players. The progress defaults to 1.0.

Parameters:

Name Type Description Default
title str

The title of the boss bar.

required
color BarColor

The color of the boss bar.

required
style BarStyle

The style of the boss bar.

required
flags list[BarFlag] | None

A list of flags to set on the boss bar.

None

Returns:

Type Description
BossBar

The created boss bar.

create_map

create_map(dimension: Dimension) -> MapView

Create a new map with an automatically assigned ID.

Parameters:

Name Type Description Default
dimension Dimension

The Dimension the map will belong to.

required

Returns:

Type Description
MapView

A newly created map view.

create_scoreboard

create_scoreboard() -> Scoreboard

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:

Type Description
Scoreboard

The newly created Scoreboard.

dispatch_command

dispatch_command(
    sender: CommandSender, command_line: str
) -> bool

Dispatches a command on this server, and executes it if found.

Parameters:

Name Type Description Default
sender CommandSender

The apparent sender of the command.

required
command_line str

The command + arguments.

required

Returns:

Type Description
bool

True if execution is successful, False otherwise.

get_map

get_map(id: int) -> MapView

Gets the map from the given item ID.

Parameters:

Name Type Description Default
id int

The id of the map to get.

required

Returns:

Type Description
MapView

A map view if it exists, or None otherwise.

get_player

get_player(name: str) -> Player | None
get_player(unique_id: UUID) -> Player | None

get_plugin_command

get_plugin_command(name: str) -> PluginCommand | None

Gets a PluginCommand with the given name or alias.

Parameters:

Name Type Description Default
name str

The name of the command to retrieve.

required

Returns:

Type Description
PluginCommand | None

A PluginCommand if found, None otherwise.

get_registry

get_registry(type: Type[_T]) -> Registry[_T]

Returns the registry for the given type.

reload

reload() -> None

Reloads the server configuration, functions, scripts and plugins.

reload_data

reload_data() -> None

Reload only the Minecraft data for the server.

This includes functions and script files from all behaviour packs.

shutdown

shutdown() -> None

Shutdowns the server, stopping everything.