Commands/ban
< Commands
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.
Contents
ban[edit]
ban
Restrictions |
---|
Adds a player to the blacklist.
Syntax[edit]
ban <targets> [<reason>]
Arguments[edit]
<targets>
: game_profile
- 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.
- Specifies the player profile(s) to be added to the blacklist.
<reason>
: message
- 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.
- Message to display to the banned player, to other operators, and in the server logs. If unspecified, defaults to
Banned by an operator.
Result[edit]
Command | Trigger | Java Edition |
---|---|---|
any | the arguments are not specified correctly | Unparseable |
if the target selector fails to resolve to one or more online players | Failed | |
does not add any new player profile to blacklist | ||
On success | the player profile(s) is added to the server blacklist, which prevents anyone from connecting to the server with uuids of these profiles. |
Output[edit]
Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
any | Java Edition | On fail | N/A | 0 | 0 |
On success | N/A | 1 | the number of new player names added to blacklist. |
ban-ip[edit]
ban-ip
Restrictions |
---|
Adds an IP address to the blacklist.
Syntax[edit]
ban-ip <target> [<reason>]
Arguments[edit]
<targets>
: string
- Must be a string. And it must be in a single word (no spaces).
- 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.
<reason>
: message
- 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.
- Message to display to the banned player, to other operators, and in the server logs. If unspecified, defaults to
Banned by an operator.
Result[edit]
Command | Trigger | Java Edition |
---|---|---|
any | the arguments are not specified correctly | Unparseable |
does not add any new IP address to blacklist | Failed | |
On success | the narrowly-specified address or that of the named, online player is added to the server blacklist, preventing anyone from connecting to the server from that address. |
Output[edit]
Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
any | Java Edition | On fail | N/A | 0 | 0 |
On success | N/A | 1 | the number of online players that connecting with the specified IP. |
banlist[edit]
banlist
Restrictions |
---|
Displays the server's blacklist.
Syntax[edit]
banlist [ips|players]
Result[edit]
Always succeeds. Displays banned IP addresses or banned players.
Output[edit]
Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
any | Java Edition | On success | N/A | 1 | the number of entries in the specified list. |
banip[edit]
banip
Restrictions |
---|
This section describes content that exists only in outdated versions of Minecraft.
This feature used to be in the game but has since been removed.
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[edit]
banip (<address>|<name>) [<reason>]
History[edit]
Java Edition Classic | |||||
---|---|---|---|---|---|
0.0.15a (Multiplayer Test 3) | Added /ban and /banip . | ||||
Java Edition Indev | |||||
0.31 | Removed all commands. | ||||
Java Edition Alpha | |||||
v1.0.16 | Re-added /ban .
| ||||
Added /ban-ip and /banlist . |