ModerationJava

/publish

Opens your current single-player world to LAN so others on the same network can join, optionally choosing the game mode for guests and the port. Reports the port to use. Single-player only.

Syntax

Parameters

allowCommandsoptional
boolean
Allow cheats for joining players.
gamemodeoptional
literal
Default mode for guests.
portoptional
integer
Port to host on.

Examples

  • Open the world to LAN on a random port.

  • Open to LAN with cheats, survival, on port 25565.

Permission level

/publish requires Server owner (op level 4). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.