Minecraft Server: Difference between revisions
m Add syntax highlighting to code examples |
|||
| (8 intermediate revisions by one other user not shown) | |||
| Line 2: | Line 2: | ||
{{tip/unfree}} | {{tip/unfree}} | ||
[https://minecraft.wiki/w/Server Minecraft Server] is a server for the | [https://minecraft.wiki/w/Server Minecraft Server] is a server for the sandbox game [[Minecraft]]. Currently, only servers for the [https://www.minecraft.net/en-us/article/java-or-bedrock-edition Java Edition] of Minecraft are supported. | ||
== Setup == | == Setup == | ||
| Line 24: | Line 24: | ||
declarative = true; | declarative = true; | ||
whitelist = { | whitelist = { | ||
# This is a mapping | # This is a mapping of Minecraft usernames to to the players' UUIDs | ||
username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; | username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; | ||
username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"; | username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"; | ||
| Line 37: | Line 37: | ||
allow-cheats = true; | allow-cheats = true; | ||
}; | }; | ||
jvmOpts = "-Xms2048M - | jvmOpts = "-Xms2048M -Xmx2048M"; | ||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
You might want to view the [https://minecraft.wiki/w/Server.properties#Keys list of all available server properties for the vanilla server]. | You might want to view the [https://minecraft.wiki/w/Server.properties#Keys list of all available server properties for the vanilla server]. | ||
See [[#See also]] for recommended JVM flags for the <code>jvmOpts</code> option. These primarily depend on your [[Java]] version. | |||
== Tips and tricks == | == Tips and tricks == | ||
=== Accessing the Minecraft server console === | === Accessing the Minecraft server console === | ||
The Minecraft server console allows you to view server logs and issue [https://minecraft.wiki/w/Commands commands] to the server interactively. The Minecraft server console is <strong>not</strong> directly accessible on NixOS—unlike on | The Minecraft server console allows you to view server logs and issue [https://minecraft.wiki/w/Commands commands] to the server interactively. The Minecraft server console is <strong>not</strong> directly accessible on NixOS—unlike on non-declarative systems, where running the server through a shell command provides the interactive console to the current terminal. | ||
==== Accessing logs ==== | ==== Accessing logs ==== | ||
| Line 85: | Line 74: | ||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
=== Use a different server === | |||
To use a specific server version, or another Minecraft server—such as [https://papermc.io/ PaperMC]—change <code>services.minecraft-server.package</code> to a nix package that represents your desired server. | |||
For example: | |||
<syntaxhighlight lang="nix"> | |||
services.minecraft-server.package = pkgs.minecraftServers.vanilla-1-12; | |||
</syntaxhighlight> | |||
or | |||
<syntaxhighlight lang="nix"> | |||
services.minecraft-server.package = pkgs.papermc; | |||
</syntaxhighlight> | |||
=== Prefer IPv4 === | === Prefer IPv4 === | ||
| Line 93: | Line 98: | ||
* [https://github.com/Infinidoge/nix-minecraft nix-minecraft], a [[flake]] based attempt to better support Minecraft related content for the Nix ecosystem. It can be used for more complex server setups, including mods and plugins. | * [https://github.com/Infinidoge/nix-minecraft nix-minecraft], a [[flake]] based attempt to better support Minecraft related content for the Nix ecosystem. It can be used for more complex server setups, including mods and plugins. | ||
* | * https://exa.y2k.diy/garden/jvm-args for setting additional JVM flags in the <code>jvmOpts</code> option. Some server-related software—like the Velocity proxy—have their own recommended JVM flags list. | ||
* https://mcuuid.net to get a player's UUID from their current username or vice versa. | |||
[[Category: Applications]] | [[Category: Applications]] | ||
[[Category: Gaming]] | [[Category: Gaming]] | ||