dev.polymodloader.api.event.server
This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.
| Type | Kind | Description |
|---|---|---|
ServerEvents | class | Server lifecycle events. |
ServerStartedListener | functional interface | Called on the server thread once, before the server's first tick. |
ServerStartingListener | functional interface | Called on the server thread once per server start, after registries and data packs are loaded and before the worlds are created. |
ServerStoppedListener | functional interface | Called on the server thread once when the server has stopped: players were saved and removed, worlds were saved and closed. |
ServerStoppingListener | functional interface | Called on the server thread when the server begins to stop, before worlds are saved. |
ServerTickListener | functional interface | Called on the server thread at the start of every server tick (20 times per second). |
ServerView | interface | Read-only view of a running Minecraft server (dedicated, integrated, or game test). |
ServerEvents
class · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public final class ServerEvents
Server lifecycle events. Fired for dedicated, integrated (single player), and game test servers, in this order: STARTING, STARTED, TICK (repeatedly), STOPPING, STOPPED. Fabric API: ServerLifecycleEvents; NeoForge: ServerStartingEvent and its siblings.
| Constant or field | Type | Description |
|---|---|---|
STARTING | EventKey<ServerStartingListener> | The server is starting: registries and data packs are loaded, worlds are about to be created. |
STARTED | EventKey<ServerStartedListener> | The server finished starting and is about to process its first tick. |
TICK | EventKey<ServerTickListener> | A server tick begins. |
STOPPING | EventKey<ServerStoppingListener> | The server begins to stop. |
STOPPED | EventKey<ServerStoppedListener> | The server stopped: players and worlds were saved and the worlds closed. |
ServerStartedListener
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerStartedListener
Called on the server thread once, before the server's first tick.
onServerStarted(ServerView)
void onServerStarted(ServerView server)
Since 0.1.0-alpha.4 or earlier
Handles the event.
| Parameter | Type | Description |
|---|---|---|
server | ServerView | — |
ServerStartingListener
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerStartingListener
Called on the server thread once per server start, after registries and data packs are loaded and before the worlds are created. Worlds are not available yet; use WorldEvents.LOADED for them.
onServerStarting(ServerView)
void onServerStarting(ServerView server)
Since 0.1.0-alpha.4 or earlier
Handles the event.
| Parameter | Type | Description |
|---|---|---|
server | ServerView | — |
ServerStoppedListener
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerStoppedListener
Called on the server thread once when the server has stopped: players were saved and removed, worlds were saved and closed. A good moment to release what the mod kept for this server; on the client the next single-player world starts a new server.
onServerStopped(ServerView)
void onServerStopped(ServerView server)
Since 0.1.0-alpha.4 or earlier
Handles the event.
| Parameter | Type | Description |
|---|---|---|
server | ServerView | — |
ServerStoppingListener
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerStoppingListener
Called on the server thread when the server begins to stop, before worlds are saved.
onServerStopping(ServerView)
void onServerStopping(ServerView server)
Since 0.1.0-alpha.4 or earlier
Handles the event.
| Parameter | Type | Description |
|---|---|---|
server | ServerView | — |
ServerTickListener
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerTickListener
Called on the server thread at the start of every server tick (20 times per second). Keep it fast.
onServerTick(ServerView)
void onServerTick(ServerView server)
Since 0.1.0-alpha.4 or earlier
Handles the event.
| Parameter | Type | Description |
|---|---|---|
server | ServerView | — |
ServerView
interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface ServerView
Read-only view of a running Minecraft server (dedicated, integrated, or game test). Only valid while the listener that received it runs; do not keep it.
tickCount()
int tickCount()
Since 0.1.0-alpha.4 or earlier
Ticks processed so far.
Returns int
playerCount()
int playerCount()
Since 0.1.0-alpha.4 or earlier
Players currently connected.
Returns int
motd()
String motd()
Since 0.1.0-alpha.4 or earlier
Message of the day shown in the server list.
Returns String
dedicated()
boolean dedicated()
Since 0.1.0-alpha.4 or earlier
Whether Minecraft reports this server as dedicated. The client's integrated server and Mojang's game test server report false.
Returns boolean