@Component
public final class ServerPackHandler
extends java.lang.Object
| Constructor and Description |
|---|
ServerPackHandler(ApplicationProperties injectedApplicationProperties,
VersionMeta injectedVersionMeta,
Utilities injectedUtilities,
ApplicationAddons injectedApplicationAddons,
ModScanner injectedModScanner)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
createStartScripts(ConfigurationModel configurationModel,
boolean isLocal)
Create start-scripts for the generated server pack.
|
void |
createStartScripts(java.util.HashMap<java.lang.String,java.lang.String> scriptSettings,
java.lang.String destination,
boolean isLocal)
Create start-scripts for the generated server pack.
|
java.util.List<java.io.File> |
getModsToInclude(ConfigurationModel configurationModel)
Generates a list of all mods to include in the server pack.
|
java.util.List<java.io.File> |
getModsToInclude(java.lang.String modsDir,
java.util.List<java.lang.String> userSpecifiedClientMods,
java.lang.String minecraftVersion,
java.lang.String modloader)
Generates a list of all mods to include in the server pack.
|
java.lang.String |
getServerPackDestination(ConfigurationModel configurationModel)
Acquire the destination directory in which the server pack will be generated.
|
void |
installServer(ConfigurationModel configurationModel)
Installs the modloader server for the specified modloader, modloader version and Minecraft
version.
|
void |
installServer(java.lang.String modLoader,
java.lang.String minecraftVersion,
java.lang.String modLoaderVersion,
java.lang.String destination)
Installs the modloader server for the specified modloader, modloader version and Minecraft
version.
|
void |
provideImprovedFabricServerLauncher(ConfigurationModel configurationModel)
Download and provide the improved Fabric Server Launcher, if it is available for the given
Minecraft and Fabric version.
|
void |
provideImprovedFabricServerLauncher(java.lang.String minecraftVersion,
java.lang.String fabricVersion,
java.lang.String destination)
Download and provide the improved Fabric Server Launcher, if it is available for the given
Minecraft and Fabric version.
|
boolean |
run(@NotNull ConfigurationModel configurationModel)
Create a server pack from a given instance of
ConfigurationModel. |
ServerPackModel |
run(@NotNull ServerPackModel serverPackModel)
Create a server pack from a given instance of
ServerPackModel via webUI. |
void |
zipBuilder(ConfigurationModel configurationModel)
Creates a ZIP-archive of the server pack previously generated.
|
void |
zipBuilder(java.lang.String minecraftVersion,
boolean includeServerInstallation,
java.lang.String destination,
java.lang.String modloader,
java.lang.String modloaderVersion)
Creates a ZIP-archive of the server pack previously generated.
|
@Autowired public ServerPackHandler(ApplicationProperties injectedApplicationProperties, VersionMeta injectedVersionMeta, Utilities injectedUtilities, ApplicationAddons injectedApplicationAddons, ModScanner injectedModScanner) throws java.io.IOException
Used for Dependency Injection.
Receives an instance of I18n or creates one if the received one is null. Required
for use of localization.
injectedApplicationProperties - Instance of Properties required for various
different things.injectedVersionMeta - Instance of VersionMeta required for everything
version related.injectedUtilities - Instance of Utilities.injectedApplicationAddons - Instance of ApplicationAddons.injectedModScanner - Instance of ModScanner required to determine
sideness of mods.java.io.IOException - if the VersionMeta could not be instantiated.public ServerPackModel run(@NotNull @NotNull ServerPackModel serverPackModel)
ServerPackModel via webUI.serverPackModel - An instance of ServerPackModel which contains the configuration
of the modpack.ServerPackModel which got altered during the creation of
said server pack.public java.lang.String getServerPackDestination(ConfigurationModel configurationModel)
Survive Create Prosper 4 - 5.0.1 would become Survive_Create_Prosper_4_-_5.0.1
Even though it is the year 2022, spaces in paths can and do still cause trouble. Such as for
Powershell scripts. Powershell throws a complete fit if the path contains spaces....configurationModel - Model containing the modpack directory of the modpack from which the
server pack will be generated.public boolean run(@NotNull
@NotNull ConfigurationModel configurationModel)
ConfigurationModel.configurationModel - An instance of ConfigurationModel which contains the
configuration of the modpack from which the server pack is to be
created.public void provideImprovedFabricServerLauncher(ConfigurationModel configurationModel)
configurationModel - ConfigurationModel containing the Minecraft and Fabric version for
which to acquire the improved Fabric Server Launcher.public void provideImprovedFabricServerLauncher(java.lang.String minecraftVersion,
java.lang.String fabricVersion,
java.lang.String destination)
minecraftVersion - The Minecraft version the modpack uses and the Fabric Server Launcher
should be downloaded for.fabricVersion - The modloader version the modpack uses and the Fabric Server Launcher
should be downloaded for.destination - The destination of the server pack.public void createStartScripts(ConfigurationModel configurationModel, boolean isLocal)
configurationModel - Configuration model containing modpack specific values. keys to be
replaced with their respective values in the start scripts, as well
as the modpack directory from which the destination of the server
pack is acquired.isLocal - Whether the start scripts should be created for a locally usable
server pack. Use false if the start scripts should be created
for a server pack about to be zipped.public void createStartScripts(java.util.HashMap<java.lang.String,java.lang.String> scriptSettings,
java.lang.String destination,
boolean isLocal)
scriptSettings - Key-value pairs to replace in the script. A given key in the script is
replaced with its value.destination - The destination where the scripts should be created in.isLocal - Whether the start scripts should be created for a locally usable server
pack. Use false if the start scripts should be created for a
server pack about to be zipped.public java.util.List<java.io.File> getModsToInclude(ConfigurationModel configurationModel)
configurationModel - The configurationModel containing the modpack directory, list of
clientside-only mods to exclude, Minecraft version used by the
modpack and server pack and the modloader used by the modpack and
server pack.public java.util.List<java.io.File> getModsToInclude(java.lang.String modsDir,
java.util.List<java.lang.String> userSpecifiedClientMods,
java.lang.String minecraftVersion,
java.lang.String modloader)
modsDir - String. The mods-directory of the modpack of which to generate a
list of all its contents.userSpecifiedClientMods - List String. A list of all clientside-only mods.minecraftVersion - String. The Minecraft version the modpack uses. When the
modloader is Forge, this determines whether Annotations or Tomls
are scanned.modloader - String The modloader the modpack uses.public void installServer(ConfigurationModel configurationModel)
configurationModel - Contains the used modloader, Minecraft version, modloader version,
path to the java executable/binary and modpack directory in order to
acquire the destination at which to install the server.public void installServer(java.lang.String modLoader,
java.lang.String minecraftVersion,
java.lang.String modLoaderVersion,
java.lang.String destination)
modLoader - The modloader for which to install the server software. Either Forge or
Fabric.minecraftVersion - The Minecraft version for which to install the modloader and Minecraft
server.modLoaderVersion - The modloader version for which to install the modloader and Minecraft
server.destination - The destination where the modloader server should be installed into.public void zipBuilder(ConfigurationModel configurationModel)
ApplicationProperties.isZipFileExclusionEnabled(), files will be excluded. To customize
the files which will be excluded, see
ApplicationProperties.getFilesToExcludeFromZipArchive()configurationModel - Contains the Minecraft version used by the modpack and server pack,
whether the modloader server was installed, the modpack directory to
acquire the destination of the server pack, the modloader used by the
modpack and server pack and the modloader version.public void zipBuilder(java.lang.String minecraftVersion,
boolean includeServerInstallation,
java.lang.String destination,
java.lang.String modloader,
java.lang.String modloaderVersion)
ApplicationProperties.isZipFileExclusionEnabled(), files will be excluded. To customize
the files which will be excluded, see
ApplicationProperties.getFilesToExcludeFromZipArchive()minecraftVersion - Determines the name of the Minecraft server JAR to exclude
from the ZIP-archive if the modloader is Forge.includeServerInstallation - Determines whether the Minecraft server JAR info should be
printed.destination - The destination where the ZIP-archive should be created in.modloader - The modloader the modpack and server pack use.modloaderVersion - The modloader version the modpack and server pack use.