/publish

From Minecraft Wiki
Jump to navigation Jump to search
This feature is exclusive to Java Edition.
/publish
Permission level
required
4
Restrictions No dedicated server

Opens singleplayer world to the local network.

Syntax

[edit | edit source]
publish [<allowCommands>] [<port>]

Arguments

[edit | edit source]

<allowCommands>: bool

Whether commands are allowed when the world is hosted on the local network. Defaults to false.
Must be a [Boolean]Boolean (either true or false).

<port>: integer

The port to host on. If not specified, the port is automatically allocated, typically from an ephemeral port range.
Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). And it must be between 0 and 65535 (inclusive).

Result

[edit | edit source]

CommandTriggerJava Edition
AnyThe command is incomplete, or any argument is not specified correctly. Unparseable
The world is already published to LAN. Failed
The specified port could not be bound (e.g. a reserved port, or already in use by another application).
OtherwiseSuccessful

Output

[edit | edit source]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
AnyJava EditionOn failN/A00
On successN/A1the port allocated for this LAN world.

History

[edit | edit source]
Java Edition
1.3.112w24a Added /publish.
1.1317w45a /publish now accepts an optional port argument.
/publish can now be run from command blocks.
18w01a /publish can no longer be run from command blocks.
1.19.322w45a The syntax of /publish has been changed, and now accepts optional command and gamemode arguments.
26.2snap8 The syntax of /publish has been changed again, and now accepts optional online argument.
pre1 The above change has been reverted.
26.3snap6 The gamemode argument has been removed.
[edit | edit source]