MinecraftServer Class
The main server class used to initialize, start, and manage the Minestom server. All managers and core functionality are accessed through this class.Initialization
Initializes the server with offline authentication mode.Returns: The MinecraftServer instance
Initializes the server with specified authentication.Parameters:
auth- Authentication mode (online/offline)
Server Lifecycle
Starts the server on the specified address and port.Parameters:
address- Server IP addressport- Server port number
Starts the server on the specified socket address.Parameters:
address- Server socket address
Stops the server properly (saves data, kicks players, etc.).
Manager Getters
All manager getters are static methods that provide access to core server functionality.Gets the instance manager for managing worlds.Returns: The InstanceManager instance
Gets the connection manager for handling player connections.Returns: The ConnectionManager instance
Gets the block manager for registering block handlers and placement rules.Returns: The BlockManager instance
Gets the command manager for registering commands.Returns: The CommandManager instance
Gets the scheduler manager for task scheduling.Returns: The SchedulerManager instance
Gets the global event handler for registering event listeners.Returns: The GlobalEventHandler instance
Gets the recipe manager for handling recipes.Returns: The RecipeManager instance
Gets the team manager for managing scoreboard teams.Returns: The TeamManager instance
Gets the benchmark manager for server monitoring.Returns: The BenchmarkManager instance
Gets the exception manager for handling server exceptions.Returns: The ExceptionManager instance
Gets the boss bar manager for managing boss bars.Returns: The BossBarManager instance
Server Properties
Gets the current server brand name displayed to clients.Returns: The server brand name (default: “Minestom”)
Changes the server brand name and broadcasts it to all players.Parameters:
brandName- The new server brand name
Gets the server difficulty level.Returns: The current Difficulty
Changes the server difficulty and notifies all clients.Parameters:
difficulty- The new difficulty level
Gets the compression threshold. A value of 0 means compression is disabled.Returns: The compression threshold in bytes
Changes the compression threshold. Must be called before server start.Parameters:
compressionThreshold- Threshold in bytes, 0 to disable
Server State
Checks if the server is currently running.Returns: true if the server is started, false otherwise
Checks if the server is stopping or stopped.Returns: true if the server is not running, false otherwise
Gets the current server process.Returns: The ServerProcess instance
ServerProcess Interface
The ServerProcess interface provides access to all server subsystems and is the underlying implementation of MinecraftServer.Core Managers
Handles incoming connections and player management.
Handles registered instances (worlds).
Handles block handlers and placement rules.
Handles registered commands.
Handles registered recipes shown to clients.
Handles registered scoreboard teams.
Gets the global event handler for event registration.
Main scheduler ticked at the server rate.
Handles registered advancements.
Handles all thrown exceptions from the server.
Dispatcher for tickable game objects.
Example: Basic Server Setup
Always call
MinecraftServer.init() before registering dimensions, biomes, commands, or events.