opened image

Creating Minecraft Java Servers.

Java is required for minecraft servers (JDK 17+ for minecraft 1.12+ and jre8 for versions below 1.12)
Command to download JDK17 for Ubuntu
apt install openjdk-17-jdk openjdk-17-jre

There are three server options.

1. Modified.

2. Plugins.

3. Clean server.


Let's break it down by category.


Server with modifications:
For a server with modifications, we need Forge or Fabric server cores.
Mods can change the game beyond recognition and add many different things, blocks, creatures (Mobs), mechanics, but they also require a lot of server resources.


On average, a build with 20 modifications requires 4-10GB of RAM, of course, it all depends on the modifications themselves.


If you build with modifications, then you need to remember that the one who wants to go to your server must have all the same modifications as on your server (Even the same version). The only exceptions are mods like JEI or Minimap, or those that optimize graphics for example sodium on the fabric core (Because they do not work with servers, but configure the game client).


Servers with plugins:
Unlike a modified server, you can connect to it without downloading additional resources (mods). For this we need Spigot or Bukkit kernels.


Due to the peculiarities of such assemblies, you can connect without downloading modifications, but the plugins themselves have limited functionality. For example, you can make transport in the game (For example, a car), but here they will be made from blocks that are in a pure game.
In such assemblies, there are many plugins that will allow you to both administer the server and add mini-games (BedWars is an example of this).
Such servers are best used in conjunction with resource packs (Textures plus some scripts).
There is a geyserMC plugin that allows you to enter the java version of minecraft from phones.


Clean:
Here you can simply use Spigot or Bukkit cores or a clean core from the official minecraft site. (If you need a specific version for example 1.16.5 then it is better to download Bukkit kernels as they are more stable than pure kernels).
Normal minecraft is just over the network, there are no special features.

There are also much more exotic server cores tailored for certain tasks, but about them in another article.
In this article, I will only talk about the main server cores and their installation.


Let's start with Bukkit / Spigot (Pure servers are installed in the same way, only downloaded from the official site).
1. Select the folder (Directory) where our server will be. In my case /home/server/
2. Download the core from the site https://getbukkit.org/download/craftbukkit (The version with which you will enter the server). For example, if the server is 1.19.2 then the client must be 1.19.2.
3. Rename the file itself to server.jar (Command for linux - mv name of the downloaded file server.jar).
4. Give permission to run with the command chmod +x server.jar (For linux)
5. Run the kernel with the command java -Xmx500M * 3 -jar server.jar --nogui * 2 (In windows, double-click the left mouse button on the server.jar file)
6. As soon as it knocks out an error for the first time, the eula.txt file will appear in the server folder, edit it. In it, change the value eula=false to eula=true and save.


7. Start the server again.
As soon as the server writes Done in the console, then you can log in.
Done Your server is essentially ready.
To run via bat or sh, simply add the start command to the run.bat/run.sh file (The run.sh file needs to be given the right to run with the chmod a+x run.sh command).
The file must be in the folder with the server.

Let's continue.
Forge.
1. Download the installer from https://files.minecraftforge.net/net/minecraftforge/forge/


There is a nuance in that for the correct installation you need either:
1.1. Run command java -Xmx500M -jar filename.jar via mobaXterm (For linux) (On windows just double click on the file).

(MobaXterm has a built-in graphics renderer, so if the server does not even have Xserver (Responsible for graphics in linux), then it will draw some windows by itself) Let's get a similar window.

Choose Install Server

1.1.2 After installation, we will get the following window.

Or the second option. We install the server on our personal computer in any folder and copy it to the server.


2. It’s already more difficult here, for the first time you need to start the server from under the folder through the run.sh script (run.bat - windows) since the server file itself is located in the libraries folder.
3. Edit run.sh. At the end of the line where the java command is indicated, add --nogui (this is necessary so that the graphical interface does not appear).
4. As soon as it knocks out an error for the first time, the eula.txt file will appear in the server folder, edit it. In it, change the value eula=false to eula=true and save.
5. Start the server again.

We are waiting for the Done message in the console. Then you can go to the server.


Mods are added to the mods folder.

fabric.
1. Download the installer from the official kernel site https://fabricmc.net/use/server/2. Rename the file itself to server.jar (The command for linux is mv the name of the downloaded file is server.jar).


3. Give permission to run with the command chmod +x server.jar (For linux)
4. Run the kernel with the command java -Xmx500M*3 -jar server.jar --nogui *2 (In windows, launch by double-clicking the left mouse button on the server.jar file)
5. As soon as it knocks out an error for the first time, the eula.txt file will appear in the server folder, edit it. In it, change the value eula=false to eula=true and save.

 

6. Start the server again.
As soon as the server writes Done in the console, then you can log in.


Footnotes:
Need to open ports *1
If you want to make a server on your computer, then make sure that you have a static ip, otherwise you can only access the server via the local network.

*1 - Ports need to be opened by those that the game uses. (You can configure the server-port= item in the server.propperties file) (standard 25565)
*2 - The --nogui setting allows you to run applications without a graphical interface (needed for the server - do not use the forge installer to run, it simply will not work).
*3 - -Xmx500M Change the maximum number of megabytes that the server can use Xmx500M = 500MB-RAM Xmx1G = 1GB-RAM.
Chunk - game area 16x16 blocks in size
Mob - any creature in the game (Cow, sheep, zombie, etc.)

To be able to auto start forge servers from under linux (in windows there are no problems with auto start via run.bat)
We create a start.sh batch file somewhere (the name can be any main thing, not run.sh so that there is no confusion).
We write the following into it:
cd /home/server/ && ./run.sh

This will allow you to start the server from any folder. Without this script, autorun can be done by editing the run.sh file.


The installation for Windows is no different (only the installation of the jdk itself)
For auto start, you need to (press the Windows logo key + R, type shell: startup, then click OK) move the run.bat shortcut there or the server.jar shortcut


Configuration file, what and where to change: server.propperties
Here are the main parameters that can be changed, it is better not to touch the rest if you do not know why they are.

gamemode=survival (standard survival) creative (creative mode) adventure (limited survival) -- Change game mode
motd= Description of the server
pvp=true (Combat between players is enabled - if false then disabled)
difficulty=easy (difficulty easy normal hard)
max-players=20 (maximum number of players)
online-mode=true (Only with a game license will be able to enter, if false then everyone will be able to enter)
allow-flight=false (flying is not allowed (Better to change to true as players can be disconnected from the game just when they try to jump into a boat or a mob.
view-distance=10 (the number of chunks that the server loads for each player - it's better to set 8)
server-ip= Sets what IP the game will use (Enter server IP here)
server-port= port on which players will connect (default port 25565)
white-list= turns on the white list mode, this mode allows only those who are listed in the white list to enter.
simulation-distance= 5. How many chunks the server processes (for example, the piston is visible from a distance of 10 chunks, but it will only work if the player approaches it at a distance of 5 chunks).
force-gamemode= if enabled then everyone who had creative mode when entering the server will be in survival mode.

 

Here is a small article that came out, in the following articles I will write how to make servers for minecraft bedrock (telephone, console, computer), what other kernels are there for minecraft java edition servers.