Scripts
Start Script Templates (3.8.x and up)
Inside the server_files
-directory you will find the three default templates:
default_template.ps1
default_template.sh
default-template.bat
You have two options now:
Edit the existing default templates to your liking and saving them under a different name
Create your own templates or add additional ones for different file-endings
Powershell
Default values
ServerPackCreator always supplies a couple of default key-value-pairs during script creation. These are stored in a separate file called variables.txt
.
The following placeholders will be replaced by ServerPackCreator during the creation of the scripts and variables.txt.
Key | Value |
---|---|
SPC_SERVERPACKCREATOR_VERSION_SPC | The version of ServerPackCreator with which the start script was created. |
SPC_MINECRAFT_VERSION_SPC | The Minecraft version of the modpack from which the server pack is created. |
SPC_MODLOADER_SPC | The modloader of the modpack from which the server pack is created. |
SPC_MODLOADER_VERSION_SPC | The modloader version of the modpack from which the server pack is created. |
SPC_JAVA_ARGS_SPC | Java JVM args which are to be used when running the server pack. |
SPC_JAVA_SPC |
|
SPC_FABRIC_INSTALLER_VERSION_SPC | The latest release version of the Fabric installer during creation. |
SPC_QUILT_INSTALLER_VERSION_SPC | The latest release version of the Quilt installer during creation. |
SPC_LEGACYFABRIC_INSTALLER_VERSION_SPC | The latest release version of the LegacyFabric installer during creation. |
SPC_RECOMMENDED_JAVA_VERSION_SPC | The recommended Java version to use with the modded server, as stated by Mojang themselves. |
SPC_WAIT_FOR_USER_INPUT_SPC | true/false allows you to enable/disable user confirmation upon graceful script ending. |
SPC_ADDITIONAL_ARGS_SPC | Additional arguments to supply to the JVM when starting the server. |
SPC_RESTART_SPC | true/false allows you to enable/disable automatically restarting the server should it crash. |
SPC_SKIP_JAVA_CHECK_SPC | true/false allows you to disable/enable the compatibility check of your Minecraft version and the provided Java version, as well as the automatic installation of a compatible Java version, should JAVA be set to 'java'. |
SPC_JDK_VENDOR_SPC | For the automatic installation of a JDK compatible with the Minecraft version of your server pack. For an extensive list of available vendors, check out https://github.com/Jabba-Team/jabba/blob/c19c6ce2ae9645c39bbdca07b6c4e2ea39155f73/index.json Note - For the installation to take place: - SKIP_JAVA_CHECK must be set to 'false' - JAVA be set to 'java' - No 'java' command be available OR - The available Java version behind 'java' be incompatible with your Minecraft version. |
SPC_JABBA_INSTALL_URL_PS_SPC | The URL to the PowerShell install-script for Jabba. |
SPC_JABBA_INSTALL_URL_SH_SPC | The URL to the Shell install-script for Jabba. |
SPC_JABBA_INSTALL_VERSION_SPC | The version of Jabba to install. |
SPC_SERVERSTARTERJAR_FORCE_FETCH_SPC | Whether the ServerStarterJar, when using Forge or NeoForge, should be refreshed at every start. Also affects updates to newer versions. |
SPC_SERVERSTARTERJAR_VERSION_SPC | The version of the ServerStarterJar to use. Set to 'latest' to always use the latest available version. |
SPC_USE_SSJ_SPC | true/false allows you to enable/disable the usage of the ServerStarterJar by the NeoForge project when you are using Forge. Some Forge versions may be incompatible with said ServerStarterJar. As of right now, people ran into trouble when using Forge and Minecraft 1.20.2 and 1.20.3. |
Jabba is a piece of software which makes the installation and usage of a JDK according to the system you are on very easy. It is used by the install_java.xxx
-scripts to supply the correct Java version for your modded server should the criteria mentioned in the SPC_SKIP_JAVA_CHECK_SPC
and SPC_JDK_VENDOR_SPC
be satisfied.
variables.txt contents
The contents of the variables are as follows. See ### Default values
above for details, descriptions and explanations.
Key | Value |
---|---|
MINECRAFT_VERSION | SPC_MINECRAFT_VERSION_SPC |
MODLOADER | SPC_MODLOADER_SPC |
MODLOADER_VERSION | SPC_MODLOADER_VERSION_SPC |
LEGACYFABRIC_INSTALLER_VERSION | SPC_LEGACYFABRIC_INSTALLER_VERSION_SPC |
FABRIC_INSTALLER_VERSION | SPC_FABRIC_INSTALLER_VERSION_SPC |
QUILT_INSTALLER_VERSION | SPC_QUILT_INSTALLER_VERSION_SPC |
RECOMMENDED_JAVA_VERSION | SPC_RECOMMENDED_JAVA_VERSION_SPC |
JAVA_ARGS | "SPC_JAVA_ARGS_SPC" |
JAVA | "SPC_JAVA_SPC" |
WAIT_FOR_USER_INPUT | SPC_WAIT_FOR_USER_INPUT_SPC |
ADDITIONAL_ARGS | SPC_ADDITIONAL_ARGS_SPC |
RESTART | SPC_RESTART_SPC |
SKIP_JAVA_CHECK | SPC_SKIP_JAVA_CHECK_SPC |
JDK_VENDOR | SPC_JDK_VENDOR_SPC |
JABBA_INSTALL_URL | SPC_JABBA_INSTALL_URL_PS_SPC or SPC_JABBA_INSTALL_URL_SH_SPC |
JABBA_INSTALL_VERSION | SPC_JABBA_INSTALL_VERSION_SPC |
JABBA_INSTALL_VERSION | SPC_JABBA_INSTALL_VERSION_SPC |
SERVERSTARTERJAR_FORCE_FETCH | SPC_SERVERSTARTERJAR_FORCE_FETCH_SPC |
SERVERSTARTERJAR_VERSION | SPC_SERVERSTARTERJAR_VERSION_SPC |
USE_SSJ | SPC_USE_SSJ_SPC |
Plus any additional custom key-value pair you added to your server pack config.
Custom key-value pairs in the variables.txt
In order to add custom key-value pairs to the variables.txt, make sure to pre- and suffix your keys with CUSTOM_
and _CUSTOM
. Every key which matches this criteria gets added to the end of the variables.txt during its creation.
Placeholders and values (3.14.x and up)
As of 3.14.x you can add and edit placeholders. Make sure to map your desired value to the appropriate placeholder key. The GUI provides a table where you can configure these, or any other values, to your liking.
The way this system works is that ServerPackCreator scans the given template for any occurance of a given placeholder, say SPC_JAVA_SPC
, and replaces that occurrence in the template with the assigned value, java
by default unless you changed it. (Also java
for the ZIP-archive, if any is created.) After every configured placeholder has been replaced with the configured value, the resulting text is written to the start scripts, based on the file-endings of your provided templates. BAM! Template engine with customizable content!
Java Install Templates
Starting from version 6.0.0, ServerPackCreator will install the required Java version for the modded Minecraft server using a set of install-scripts. These are based on templates, just like the start scripts.
In the server_files
-directory, you will find a couple of files which follow the naming convention of default_java_template.xxx
where xxx
represents the type of the script, e.g. bat, ps1 or sh.
Changing these templates follows the same procedure as the start scripts. The properties are as follows:
You may also use the GUI, Settings -> Global -> Java Script Templates -> Reset to default values, to reset the entirety of the template setting to factory defaults.
Changing the default templates
Starting from versions 3.13.x and up, the default templates are always overwritten during startup of ServerPackCreator, to ensure any user always has the latest version of the default templates available to them and to ensure any changes made to them, by me, end up in the users hands. This has the benefit of making any migration for future versions not your problem.
The downside: If you want to customize these templates, you will have to create separate templates and set the property for the templates accordingly.
In other words:
Copy the desired template to a name of your liking, e.g.
custom-template.sh
Make your changes to these custom templates
Set
de.griefed.serverpackcreator.serverpack.script.template.sh
to/path/to/custom/templates/custom-template.sh
...
Profit
Repeat the same for ps1
or bat
if you so desire. Keep in mind to change the properties accordingly. The last section of the property-key determines the type of the script, see the following for an example:
Each of these represents the path to a template, for bat, ps1 and sh respectively. If you wish to add a template for another type, simply add a property which ends with your desired type, like so
de.griefed.serverpackcreator.serverpack.script.template.zsh=...
Removing templates
If you wish to return back to the default template for any of the types supported by default (bat, ps1, sh), simply remove the property from the serverpackcreator.properties
and restart ServerPackCreator.
You may also use the GUI, Settings -> Global -> Script Templates -> Reset to default values, to reset the entirety of the template setting to factory defaults.