Offer Why us? How it works?
Guide

Minecraft Server Commands: OP, Whitelist, Bans & More

Minecraft server commands let you make someone an operator, let only your friends in, ban a player or change the time and weather. We've put the most important admin commands in one place, with examples, and show how to do the same with a few clicks in the panel.

Updated: 9 min read
Table of contents
  1. Where do you type Minecraft server commands?
  2. How do you OP someone on a Minecraft server?
  3. Why does OP disappear after leaving the server?
  4. How do you turn on the whitelist and add a player?
  5. How do you ban or kick a player?
  6. The most useful commands for managing the game and world
  7. How do you teleport with the /tp command?
  8. How do you use the /give command?
  9. How do you give permissions without OP?
  10. FAQ
  11. How do you OP yourself on a Minecraft server?
  12. Why does a command work in the console but not in the game?
  13. How do you whitelist someone on an offline mode server?
  14. Can commands run automatically?
  15. How do you stop the server if the stop command doesn't work in the console?

Where do you type Minecraft server commands?

In the game you type a command in chat with a / in front (e.g. /op Steve); in the server console you type it without the slash (op Steve). Chat commands only work for players with permissions (operators), while the server console always has full permissions.

On Spot.gg the console is in the "Console" tab. A few rules:

  • type commands without a leading /,
  • the switch above the field toggles between a regular command and "Message to all players" (the same as say),
  • you can't send stop from the console – use the "Stop" button in the top bar to shut the server down,
  • a command can be at most 400 characters long,
  • commands that should run on their own at a set time (e.g. an announcement or a restart) go into the "Task scheduler" (on a paid server).

The same console shows the players online and the operator, whitelist and ban lists, which you can manage without typing commands.

How do you OP someone on a Minecraft server?

Type op username in the console; to take the permissions away, type deop username. An operator (OP) can use every server command, including banning players and making others OP, so only give it to people you trust.

Command (console) What it does
op Steve Gives the player Steve operator permissions
deop Steve Removes operator permissions

On Spot.gg you can also do it without commands: in "Console", click the player's name in "Players online" and choose "Grant OP", or add the name in the "Operators" section with "Add an operator".

The operator permission level is set by op-permission-level in server.properties (1 to 4, default 4 – full permissions). This and other options are explained in Minecraft server.properties.

Why does OP disappear after leaving the server?

On Spot.gg OP is removed automatically only on servers without player authentication – offline mode servers without a login plugin. On such a server anyone can join under any name, including an operator's, and take over the server. That's why the host removes OP from operators who aren't online every few minutes and clears the operator list on every server start.

To keep OP permanently, set "Original accounts only" under "Configuration" or install a login plugin (e.g. AuthMe Reloaded) and restart the server. The lock in the panel's top bar shows whether the server is protected. Details in Minecraft offline mode server.

How do you turn on the whitelist and add a player?

Turn the whitelist on with whitelist on and add players with whitelist add username. With the whitelist on, only listed players and operators can join.

Command What it does
whitelist on / whitelist off Turns the whitelist on or off
whitelist add Steve Adds a player to the whitelist
whitelist remove Steve Removes a player from the list
whitelist list Lists whitelisted players
whitelist reload Reloads the list from whitelist.json

A player who is online when you turn the list on but isn't on it only gets kicked if server.properties has enforce-whitelist=true.

On Spot.gg, under "Console" → "Whitelist", one button turns the list on ("Enable the whitelist") and "Add to the whitelist" adds players. If players who aren't on the list are online, the panel first shows who will be kicked and asks you to confirm ("Enable and kick").

A note for offline mode servers: the player has to join the server once first so they're added with the right ID (UUID). On such a server the whitelist also doesn't stop impersonation – it only checks the name, so you need a login plugin.

How do you ban or kick a player?

kick username removes a player who can come straight back, ban username blocks them for good, and pardon username lifts the ban. You can add a reason to any of these, and the player sees it on screen.

Command What it does
kick Steve Chat spam Kicks the player with the given reason
ban Steve Griefing Bans the player (saved in banned-players.json)
pardon Steve Unbans the player
ban-ip 203.0.113.5 Bans an IP address (you can give the name of an online player instead of the IP)
pardon-ip 203.0.113.5 Unbans an IP address
banlist Shows the ban list (banlist ips – IP bans)

On Spot.gg click the player's name in "Console" and choose "Kick from the server" or "Ban the player". The "Player bans" and "IP bans" sections list every ban with its date and reason, and the button next to an entry removes it. Keep in mind that an IP ban covers everyone connecting from that address – a whole household or dorm, for example.

The most useful commands for managing the game and world

The admin commands you'll use most change the game mode, difficulty, time, weather and game rules. The table shows them the way you type them in the console – in the game, add / in front.

Command What it does
list Lists players online
say Restart in 5 minutes Sends a message to all players
gamemode creative Steve Changes a player's game mode (survival, creative, adventure, spectator)
defaultgamemode survival Sets the game mode for new players
difficulty hard Changes difficulty (peaceful, easy, normal, hard)
time set day Sets the time to day (night – night)
weather clear Stops the rain (rain, thunder)
tp Steve Alex Teleports Steve to Alex
give Steve minecraft:diamond 5 Gives a player items
gamerule keep_inventory true (1.21.10 and older: keepInventory) Players keep their inventory after death
setworldspawn Sets the world spawn where you're standing (in game)
worldborder set 4000 Sets a world border 4000 blocks wide
seed Shows the world seed
save-all Saves the world to disk

Game rules (gamerule) change between Minecraft versions, and Mojang has renamed some of them in newer versions. Since 1.21.11 most of them have new snake_case names (e.g. keep_inventory). If a command doesn't work, check the full list with old and new names in Minecraft gamerules.

How do you teleport with the /tp command?

Type /tp player target to move one player to another, or /tp player x y z to send them to coordinates. /tp and /teleport are the same command, and you need OP to use it in game.

Command (console) What it does
tp Steve Alex Teleports Steve to Alex
tp Steve 100 64 -250 Teleports Steve to X 100, Y 64, Z -250
tp @a Steve Teleports every player online to Steve
execute as Steve at @s run tp @s ~ ~10 ~ Moves Steve 10 blocks up from where he's standing
execute in minecraft:the_nether run tp Steve 0 80 0 Teleports Steve to the Nether (the_end – the End, overworld – the Overworld)
  • In game, /tp 100 64 -250 without a name teleports you, and ~ means your current position, e.g. /tp ~ ~10 ~.
  • The console has no position of its own: always give the player's name. A ~ typed there counts from the world spawn, not from the player – that's why the table uses execute as … at @s.
  • Y is the height. Press F3 in game to see your current coordinates.
  • Selectors: @a – all players, @p – the nearest player, @r – a random player, @s – you.

How do you use the /give command?

/give player item count puts items straight into a player's inventory, e.g. /give Steve minecraft:diamond 64. Items are given by their ID, the minecraft: prefix is optional, and without a count the player gets one.

Command (console) What it does
give Steve diamond 64 64 diamonds
give Steve netherite_pickaxe A netherite pickaxe
give @a golden_apple 3 3 golden apples for every player online
give Steve elytra An elytra
give Steve command_block A command block
  • Item IDs are English names in lower case with underscores (oak_log, ender_pearl, cooked_beef). Press F3+H in game to turn on advanced tooltips, which show the ID of every item.
  • Items from mods use the mod's prefix instead of minecraft:, e.g. create:wrench.
  • To enchant the item a player is holding, use enchant Steve sharpness 5 – the level can't go above the enchantment's maximum.
  • Command blocks only run if server.properties has enable-command-block=true (it's false by default), and only an operator in creative mode can place and edit them.

How do you give permissions without OP?

Install a permissions plugin such as LuckPerms and give players only the commands they need. OP grants everything at once; on a public server or one with several moderators, it's better to split permissions into ranks.

Basic LuckPerms commands:

  • lp creategroup moderator – creates a group (rank),
  • lp group moderator permission set minecraft.command.kick true – gives the group permission to use a command,
  • lp user Steve parent add moderator – adds a player to the group,
  • lp editor – opens the permissions editor in your browser.

Popular player commands such as /home, /sethome, /tpa or /warp come from the Essentials plugin. Plugins run on the Paper and Purpur engines and install with one click in the "Addons" tab. On modded servers (Fabric, Forge, NeoForge) plugins don't work – permissions come from mods there, and LuckPerms itself also has mod versions you can upload to the mods folder in the "Files" tab.

FAQ

How do you OP yourself on a Minecraft server?

Type op your_name in the server console (without the slash). On Spot.gg you can also join the server, then click your name in the player list under "Console" and choose "Grant OP".

Why does a command work in the console but not in the game?

In the game commands need permissions: without OP (or a permission from a plugin) you'll get a no-permission or unknown-command message. In the server console commands always work – just type them without the /.

How do you whitelist someone on an offline mode server?

Ask the player to join the server once (if the whitelist is on, turn it off for a moment), then add them from "Players online" in the "Console" tab. That way the list stores the player's correct ID.

Can commands run automatically?

Yes. On a paid Spot.gg server, the "Task scheduler" runs commands or restarts at a chosen time or on a schedule, e.g. a daily say announcement or a nightly restart.

How do you stop the server if the stop command doesn't work in the console?

Use the "Stop" button in the panel's top bar. The server saves the world and shuts down just like after the stop command.

Other guides