Slash Commands & Server Configs

Dear past!Mojang: why on Earth did you decide to call them "cheats"? In single-player nobody is being harmed by the ability to fine-tune gameplay; in multiplayer they're often crucial for running a server and making sure everyone has fun. In both cases they are also key to debugging and repairing your janky game. Why would you name them something which implies anyone who uses them is in the moral wrong??

Anyways.

A few slash commands are easy to remember (/gamemode creative my beloved) but I'm tired of looking up the rest over and over. So here's my no longer so little sticky note wall! (Plus server configs, because guess what else pollutes my search history.)

psst here's the Java target selectors list
@s (Self) The entity executing the command. (Command blocks and server console can't use this.) 1.12+
@p (Player) The nearest player to the executing command.
@n (Nearest) The nearest entity to the executing command. 1.21+
Pre-1.21 pseudo: @e[limit=1,sort=nearest]
@r (Random) A random player.
@a (All) All players.
@e (Everything) All alive entities in all loaded chunks. 1.8+
Wiki: Target Selectors

Slash Commands

Java Minecraft version 1.20.1 unless otherwise noted

  • /effect give @s minecraft:night_vision infinite - Give yourself infinite Night Vision. Can be removed by drinking milk like a normal potion effect.
  • /give @s minecraft:wooden_shovel{Unbreakable:1b} 1 - Give yourself a Wooden Shovel that ignores durability entirely (true Unbreakable)!
  • /give @s minecraft:wooden_shovel{Unbreakable:1b,display:{Name:"\"Barkfall\""},Enchantments:[{id:efficiency,lvl:5}]} 1 - Give yourself a Wooden Shovel named Barkfall that ignores durability entirely and has the Efficiency V enchantment, making it dig blocks so fast that it's slightly difficult to use.

If you need to work out similar code for other Minecraft versions try this generator: digminecraft.com/generators/give_tool.php

  • /teleport ~100 ~ ~-15 - Teleport yourself 100 blocks east and 15 blocks north of current position. ("relative/tilde notation")
  • /teleport ^ ^ ^5 - Teleport yourself 5 blocks forward in the direction your are facing when you cast it. ("local/caret notation")
  • /tell [targets] [message] /w /msg - Multiple aliases to whisper a message to whomever. Target selectors allow you to "mass mail" multiple recipents, but they also work in the message body, being turned into strings listing off whoever the selectors are aimed at.
  • /seed - Prints out the world seed. Now you can share the good ones!
  • /weather [clear/rain/thunder] - Sets the current weather to the one you pick. If unspecified the duration is randomized, or you can append with a unit number. Recommended examples: /weather clear 600s for 600 seconds/10 minutes; /weather rain 6d for 6 game-days/2 hours RL time.
  • /xp add @s 30 levels - Give yourself 30 levels (regardless of what you currently had). Alternatively, /xp add @s 500 points adds them as exp points, which means the levels you may gain follow the leveling curve. (There is also set instead of add, and query (dropping the amount but otherwise identical syntax) to check.)

!! NOTE: major attribute renames in 1.16(?). the following were offered for 1.18+ !!

  • /summon horse ~ ~ ~ {Health:30f,Tame:0b,Variant:516,CustomName:'"Chesapeake"',Attributes:[{Name:generic.max_health,Base:30},{Name:generic.movement_speed,Base:0.3375},{Name:horse.jump_strength,Base:1}]} - summon Chesapeake the painted black horse, who has perfect stats for a horse.
  • /summon horse ~ ~ ~ {Invulnerable:1b,Health:60f,Tame:1b,Variant:256,CustomName:'"Shadowfax"',Attributes:[{Name:generic.max_health,Base:60},{Name:generic.movement_speed,Base:1},{Name:horse.jump_strength,Base:2}]} - summon Shadowfax the immortal white horse, who has stats wildly better than any natural horse.
  • /summon mule ~ ~ ~ {Invulnerable:1b,Health:60f,Tame:1b,CustomName:'"Potomac"',Attributes:[{Name:generic.max_health,Base:60},{Name:generic.movement_speed,Base:0.4},{Name:horse.jump_strength,Base:1.5}]} - summon Potomac the immortal mule, who has impossibly good stats even by horse standards but is more reasonable than Shadowfax. (You can actually catch up to Potomac on foot while not using a lead!)

Server Configs: Gamerule

While in game, use /gamerule [rule] [value] to adjust these.
Underlined value is the default.

  • disableRaids true/false - Whether illager raids are prevented from happening.
  • doDaylightCycle true/false - Whether the world's sun and moon cycle. Freezes time of day if set to false.
  • doFireTick true/false - Whether fire can spread/extinguish.
  • doInsomnia true/false - Whether phantoms can spawn at night if a player doesn't sleep too many nights in a row.
  • doMobSpawning true/false - Whether natural mob spawning happens. Does not impact spawn-inducing special stuff like Spawner cages, raids, etc.
  • doPatrolSpawning true/false - Whether illager patrols can spawn.
  • freezeDamage true/false - Whether players take damage from falling into powder snow.
  • keepInventory true/false - Whether players keep their items & experience on death.
  • lavaSourceConversion true/false - Whether lava source blocks can "snap" to form new source blocks the same way water does.
  • mobGriefing true/false - Whether mobs can interact with blocks and pick up items. Many odd edge cases but turns off creepers blowing your stuff up.
  • playersSleepingPercentage 0-100 - The % of online players who must sleep to skip the night.
  • pvp true/false - Whether players can directly damage other players.
  • randomTickSpeed 0-3-4096 - How often random block ticks fire, per chunk section per game tick. The default works out to 20 ticks per second/1 tick per .05 seconds. 0/negative disables random ticks entirely, numbers over 4096 make farming/decay instantaneous. WARNING: even modest increases from default can have hilarious/terrible repercussions, not the least to server lag.

Server Configs: server.properties

Every multiplayer world gets a server.properties file in the world directory. (Single player is suffering and I can't figure out where to manually edit it, BAWWW.) Edit it while the server is stopped/offline then restart to get the changes applied. Alternatively, make/edit the file and place it in the intended directory before starting a new world to make sure it starts with everything configured correctly (this is crucial for, ex. modded biome generation!)

Again, underlined value is the default.

  • allow-flight true/false - Whether Survival-mode players can spend more than 5 seconds in the air before being auto-kicked. FALSE is good for slowing down griefer players, and thus made default. If instead playing on small whitelist servers with friends, you probably want TRUE to prevent being chain-kicked while in the middle of doing something innocent that happens to have airtime.
  • difficulty peaceful/easy/normal/hard - Sets the Survival-mode difficulty, which governs various multipliers, mob behaviors and spawn rates.
  • enforce-secure-profile true/false - Whether chat messages can be officially reported or not. If disabled, joining players get a message alerting them.
  • enforce-whitelist true/false - Whether non-op players MUST be on the server whitelist to join. Multiplayer whitelist is stored in whitelist.json and can be edited in-game/in server console with commands.
    The commands are pretty few and simple.
    • whitelist on/off toggles the whitelist.
    • whitelist add [player name] adds a player to the list.
    • whitelist remove [player name] will take someone off the whitelist.
    • whitelist list prints everyone currently in the whitelist.
    • whitelist reload will reload the whitelist if the whitelist.json file was edited outside Minecraft.
  • force-gamemode true/false - Whether players are reset to the server's default gamemode every time they rejoin. Relatedly,
  • gamemode survival/creative/adventure/spectator - The server's default gamemode.
  • generate-structures true/false - Whether non-dungeon structures can be generated in new chunks. Does not retroactively change chunks that have been generated!
  • level-name world (string) - The world name & directory path. If there's no world folder with that name in the right place in the server directory, a new world is started. But this is also used to swap back to a previously-loaded world: just name each world on the server something different and change this pointer to swap between them.
  • level-seed (blank!) - The seed used for worldgen. !! This must be configured BEFORE starting the new world in multiplayer !! Does nothing once a world actually exists.
  • level-type minecraft:normal - Relatedly, this is the preset/biome layout type the world generates as. If you want anything besides the default type of vanilla world, you will want to change this.
    Vanilla alone has several types.
    • minecraft:flat aka "Superflat" makes the "empty blank canvas" kind of world. Default 1 layer bedrock + 2 layers dirt + 1 layer grass. You may want to edit generator-settings for this! Example template here.
    • minecraft:large_biomes aka "Large Biomes" is similar to vanilla but each biome is large/extends further.
    • minecraft:amplified aka "Amplified" is similar to vanilla but goes nuts on the vertical axis, making almost every biome impossibly mountainous.
    • minecraft:single_biome_surface aka "Single Biome" makes the entire world one single biome. Default plains. You probablywant to edit generator-settings for this!
    • minecraft:debug makes a bizarre barely-interactive world where a grid of every block in the game hovers above an empty void. You probably don't want this, but it's there.
    • Most biome/worldgen mods add more options. Check mod documentation for how to implement them.
  • motd A Minecraft Server (string) - The message shown on the Multiplayer server select screen for that server. (Supports funky text & coloring codes, use an online tool to generate the right copypaste if you want that)
    • Bonus customization tip: While you're in there setting up this damn config file, you can upload a 64x64-pixel PNG named server-icon.png in the same directory. Now the server has a custom image at Multiplayer server select, too!
  • online-mode true/false - Force connecting players to get their account verified via minecraft.net to join. When enabled, minecraft.net outages will prevent anyone from connecting, but otherwise ensures only legal copies can join. If disabled, cracked/pirated accounts may connect to server.
  • op-ermission-level 1-4 - Default permission level given to ops when using /op.
  • simulation-distance 3-10-32 - How far from the player entities can be before they stop being visible/ticked. Major potential lag nexus, can turn down if the server is chugging.
  • spawn-monsters true/false - Whether hostile mobs spawn naturally at night/in the dark. Irrelevant on Peaceful difficulty. Another potential lag nexus.
  • spawn-protection 0-16-99 - (Move spawn with /setworldspawn) The size of the area around spawn that cannot be altered/destroyed, where 2x+1 = the length of one side of the square. For example, spawn-protection 3 protects a 7x7-size square centered on the spawn block. Set to 0 to turn off spawn protection entirely.
  • white-list true/false - Also turn this on if you want a whitelist server.

back to Minecraft Depot