Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.event.server

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
ServerEventsclassServer lifecycle events.
ServerStartedListenerfunctional interfaceCalled on the server thread once, before the server's first tick.
ServerStartingListenerfunctional interfaceCalled on the server thread once per server start, after registries and data packs are loaded and before the worlds are created.
ServerStoppedListenerfunctional interfaceCalled on the server thread once when the server has stopped: players were saved and removed, worlds were saved and closed.
ServerStoppingListenerfunctional interfaceCalled on the server thread when the server begins to stop, before worlds are saved.
ServerTickListenerfunctional interfaceCalled on the server thread at the start of every server tick (20 times per second).
ServerViewinterfaceRead-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 fieldTypeDescription
STARTINGEventKey<ServerStartingListener>The server is starting: registries and data packs are loaded, worlds are about to be created.
STARTEDEventKey<ServerStartedListener>The server finished starting and is about to process its first tick.
TICKEventKey<ServerTickListener>A server tick begins.
STOPPINGEventKey<ServerStoppingListener>The server begins to stop.
STOPPEDEventKey<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.

ParameterTypeDescription
serverServerView—

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.

ParameterTypeDescription
serverServerView—

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.

ParameterTypeDescription
serverServerView—

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.

ParameterTypeDescription
serverServerView—

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.

ParameterTypeDescription
serverServerView—

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

Buy me a coffee