Starting Local Server

### Purpose

This guide is NOT intended to teach you how to run a public server on your computer. It is intended to teach you how to run your server on your own computer temporarily for testing or setting up purposes. This guide is built for Windows computers. For Mac and Linux the steps may vary slightly.

### Why to Have a Test Server

If you're trying to fix bugs on your server or test new features, you should be doing it on a test server whenever possible. Why? Well, let's say you need to modify one or more files to try fixing the issue and something goes wrong. If you just did it on the main server, you just messed up your server that people are actively playing on. Your player base will probably be very unhappy that you have to shut the server down temporarily to fix the issue. If were doing it on a test server then you can either fix it or delete the files and copy and paste the same files from your main server to the test server.

It is recommended to have the same plugins on your test server as on your main server so you can test bugs with the same plugins. In other words, if your main server has a bug that only occurs when there are two specific plugins installed (for example), then your test server should also have all of the same plugins so you can replicate the bug.

To summarize, it prevents unnecessary downtime or bugs and allows you to fix bugs easily then make the same changes on the main server to fix the bugs there too.

### Requirements

1. Determine how much RAM your computer has.
	* Do not give your server more than half of your computer's RAM.
	* Minimum RAM to give your server: 2 GB
	* Maximum RAM: 10 GB
	* Giving more than 10 GB of RAM will start to *negatively* impact server performance due to how Java works.
	* **How to find your RAM amount on a Windows computer:**
		+ Go to the search bar on your task bar. This is usually found at the bottom of the screen and may be a search bar or magnifier icon.
		+ Search "System Information" and open the result.
		+ In the "System Summary" tab (default) scroll down until you find "Installed Physical Memory (RAM)". To the right of that it will specify how many gigabytes (GB) you have.
2. 1 GB or more of free disk space.

### Steps

1. Install Java on your computer if you have not done so already. Minecraft 1.18+ requires Java 17. Download it here then run the installer. If it asks you whether you want to add it to your PATH then choose yes.
2. Download your desired server software jar (I.e. Spigot, Paper, or Forge).
3. Create a folder that will contain your server files. Then drag the server jar to that folder.
4. Rename the server jar to "server.jar".
5. Create a "start.bat" file and determine how much RAM you wish to give your server.
	* First, in the Windows search bar type "notepad" and open the Notepad application.
	* Second, copy and paste the contents below into your Notepad software.
		+ ```
		@echo off
		java -Xms2G -Xmx2G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
		pause

		```
		**For Macs** use this instead. **For Linux** use this.
	* Third, in the notepad file where it says "-Xms2G -Xmx2G" change the 2G's to however many GB of RAM you wish to give your server (I.e. "-Xms4G -Xmx4G"). As mentioned above, do not give your server more than half of the RAM your computer has.
	* Fourth, go to the "File" tab > "Save As..." > then find the folder you created where you wish to store your server files and save it there.
6. Double-click the "**start.bat**" file to start your server.
	* It'll open a command-prompt window and start loading it.
	* If it seems frozen then select the window and press "Enter" to refresh it.
7. The first time you do this it will create a "EULA.txt" file that you'll need to edit. The command prompt window will say:
	* ```
	[18:29:46 WARN]: Failed to load eula.txt
	[18:29:46 INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
	Press any key to continue . . .
	```
	* Close the command prompt.
	* In your server files open the "eula.txt" file. If it is not there click the refresh button in File Explorer. Change the "false" to "true" within the file so it reads:
	* ```
	#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
	#Sun Feb 05 18:33:52 MST 2023
	eula=true
	```
	* Save the file using the "File" tab > "Save" or by holding down CTRL+S.
8. Run "**start.bat**" again. If you have done everything properly it should start the server.
	* Once the command prompt stops showing new messages it is done starting up.
9. Test it by starting your Minecraft client and inserting "localhost" as the IP to see if you can login.

### Command Prompt Usage as Console

* When using the command prompt as a console you may insert commands by not including the slash ('/') for commands. I.e. To op Steve you would do "op Steve".
* If the command prompt ever seems frozen and not loading new messages then you can refresh it by selecting the Command Prompt window and pressing Enter on your keyboard.

### Getting Support

If your start.bat is not working for some reason and you have closely followed the steps above then it is time to ask for support. If you're using Spigot ask for assistance on the SpigotMC forums. If you're using PaperMC then check their support options on their website. For other server software ask on their relevant official websites or Discord servers.