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 |
create_block_data |
Creates a new |
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 |
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 |
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 |
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 |
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 |
service_manager |
ServiceManager
|
The service manager. |
start_time |
datetime
|
The start time of the server. |
version |
str
|
The version string of this server implementation. |
command_sender
property
¶
command_sender: ConsoleCommandSender
A console CommandSender for this server.
language
property
¶
language: Language
The current language interface used by the server for translations.
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.
plugin_manager
property
¶
plugin_manager: PluginManager
The plugin manager for interfacing with plugins.
protocol_version
property
¶
protocol_version: int
The network protocol version that this server supports.
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.
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 |
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_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 |
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
|
|
get_map
¶
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 |
get_registry
¶
Returns the registry for the given type.
reload_data
¶
Reload only the Minecraft data for the server.
This includes functions and script files from all behaviour packs.