Minecraft Wiki
Advertisement
Information icon
This feature is exclusive to Java Edition. 

These commands control a server's banlist, or blacklist. A blacklist is a list of players or IP addresses that are not allowed to connect to the server. Bans supersede any whitelisting in place.

ban[]

Adds the player profile(s) into the server blacklist, which prevents anyone from connecting to the server with uuids of these profiles.

Syntax[]

ban <targets> [<reason>]

Arguments[]

<targets>: game_profile

Specifies the player profile(s) to be added to the blacklist.
Must be a collection of game profiles (player profiles), which can be a player name (must be a real one if the server is in online mode), or a player-type target selector.

<reason>: message

Message to display to the banned player, to other operators, and in the server logs. If unspecified, defaults to Banned by an operator.
Must be a plain text. Can include spaces as well as target selectors. The game replaces entity selectors in the message with the list of selected entities' names, which is formatted as "name1 and name2" for two entities, or "name1, name2, ... and namen" for n entities.

Result[]

CommandTriggerJava Edition
anythe arguments are not specified correctly Unparseable
the target selector fails to resolve to one or more online players Failed
does not add any new player profile to blacklist
OtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn failN/A00
On successN/A1the number of new player names added to blacklist.

ban-ip[]

Adds an IP address to the blacklist. Adds the narrowly-specified address or address of the named online player into the server blacklist, preventing anyone from connecting to the server from that address.

Syntax[]

ban-ip <target> [<reason>]

Arguments[]

<targets>: string

Specifies the IP address to be added to the blacklist. Can also be a name of a online player, which represents the IP of that player.
Must be a string. And it must be in a single word (Allowed characters include: -, +, ., _, A-Z, a-z, and 0-9).

<reason>: message

Message to display to the banned player, to other operators, and in the server logs. If unspecified, defaults to Banned by an operator.
Must be a plain text. Can include spaces as well as target selectors. The game replaces entity selectors in the message with the list of selected entities' names, which is formatted as "name1 and name2" for two entities, or "name1, name2, ... and namen" for n entities.

Result[]

CommandTriggerJava Edition
anythe arguments are not specified correctly Unparseable
does not add any new IP address to blacklist Failed
OtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn failN/A00
On successN/A1the number of online players that connecting with the specified IP.

banlist[]

Displays the server's blacklist.

Syntax[]

banlist [ips|players]

Result[]

Always succeeds. Displays banned IP addresses or banned players.

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn successN/A1the number of entries in the specified list.

banip[]

This section describes content that exists only in outdated versions of Minecraft. 
This feature used to be in the game, but has ever since been removed.It may or may not return in a future update.

Bans a player by IP number. Cannot be undone in-game; banned-ip.txt must manually be changed.

The Classic equivalent of /ban-ip.

Syntax[]

banip (<address>|<name>) [<reason>]

History[]

Java Edition Classic
0.0.16aAdded /ban and /banip.
Java Edition Indev
0.31Removed all commands.
Java Edition Alpha
v1.0.16Re-added /ban.
Added /ban-ip and /banlist.

See also[]

Advertisement