Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/publish

Command

/publish

Opens the current singleplayer world to other players on the local network.

Syntax

/publish [<allowCommands> [<port>]]

Arguments

ArgumentKind of valueWhat to type
<allowCommands>True or falsetrue or false: whether players who join may use commands. Default false.
<port>Whole numberThe network port to host on, from 0 to 65535. Left out, a free port is chosen.

Details

Permission level4: server owners and the server console
Works inSingleplayer only: the command does not exist on dedicated servers. Needs permission level 4 (owners), which only the world's owner has, and only when cheats are enabled. Command blocks and functions cannot run it (their permission level is 2).
ResultReports "Local game hosted on port <port>". The number /execute store saves is the port number.
DefaultsWithout arguments a free port is picked automatically and joining players are not allowed to use commands.
Guest commandsWith allowCommands set to true, players who join get permission level 2, as long as cheats are enabled in the world.
Already openIf the world is already open the command fails with "Local game is already hosted on port <port>". If the port cannot be opened it fails with "Unable to host local game".

Examples

/publish

Opens the world to the local network on a free port.

/publish true 25565

Opens the world on port 25565 and lets joining players use commands.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)