Update to sos!engine v1-alpha5
All checks were successful
push-build-apidoc / build (push) Successful in 1m10s
push-build-apidoc / generate-javadoc (push) Successful in 1m18s

This commit is contained in:
JeremyStar™ 2024-09-23 19:09:12 +02:00
parent e12597e834
commit 7a5c719210
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
5 changed files with 31 additions and 15 deletions

View file

@ -52,13 +52,14 @@ public final class EngineBootstrapper {
/**
* Initializes the engine and environment.
*
* @param disableMultithreading disables multithreading support (except for logging), if enabled
* @param disableMultithreading disables multithreading support (except for logging)
* @param disableClasspathScanning disables classpath scanning support
* @param shutdownHandler {@link ShutdownHandler} implementation, which should ideally shutdown the server
* @param loggingAdapter {@link LoggingAdapter} implementation, for printing log messages into the server console
* @since v1-alpha0
*/
public static void initialize(boolean disableMultithreading, @NotNull ShutdownHandler shutdownHandler, @NotNull LoggingAdapter loggingAdapter) {
overwriteSystemProperties(disableMultithreading); // Overwrites certain system properties to overwrite the engine configuration
public static void initialize(boolean disableMultithreading, boolean disableClasspathScanning, @NotNull ShutdownHandler shutdownHandler, @NotNull LoggingAdapter loggingAdapter) {
overwriteSystemProperties(disableMultithreading, disableClasspathScanning); // Overwrites certain system properties to overwrite the engine configuration
Logger.setLoggingAdapter(loggingAdapter); // Install logging adapter
new Engine(); // Initialize engine
configureEngineShutdown(shutdownHandler); // Configures how the engine shuts itself down
@ -69,16 +70,18 @@ public final class EngineBootstrapper {
/**
* Overwrites system properties to configure the engine.
*
* @param disableMultithreading disables multithreading support if {@code true}
* @param disableMultithreading disables multithreading support (except for logging)
* @param disableClasspathScanning disables classpath scanning support
* @since v1-alpha0
*/
private static void overwriteSystemProperties(boolean disableMultithreading) {
private static void overwriteSystemProperties(boolean disableMultithreading, boolean disableClasspathScanning) {
System.getProperties().setProperty("sosengine.base.loggerTemplate", "[%log_level% %log_path%%log_metadata%] %log_message_prefix%%log_message%");
System.getProperties().setProperty("sosengine.base.optimizeLogging", "true");
System.getProperties().setProperty("sosengine.base.loggerImmediateShutdown", "false");
System.getProperties().setProperty("sosengine.base.optimizeSubsystemInitialization", "false");
if (disableMultithreading)
System.getProperties().setProperty("sosengine.base.optimizeEvents", "false");
if (disableClasspathScanning)
System.getProperties().setProperty("sosengine.base.initialForceDisableClasspathScanning", "true");
}
/**

View file

@ -20,8 +20,10 @@
package de.staropensource.sosengine.minecraft.command;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.utility.ListFormatter;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
import de.staropensource.sosengine.base.utility.information.EngineInformation;
import de.staropensource.sosengine.base.utility.information.JvmInformation;
import de.staropensource.sosengine.minecraft.SubsystemInformation;
import net.kyori.adventure.text.minimessage.MiniMessage;
@ -70,11 +72,14 @@ public class Command {
case "debugEvents" -> String.valueOf(EngineConfiguration.getInstance().isDebugEvents());
case "debugShortcodeConverter" -> String.valueOf(EngineConfiguration.getInstance().isDebugShortcodeConverter());
case "initialPerformSubsystemInitialization" -> String.valueOf(EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization());
case "initialForceDisableClasspathScanning" -> String.valueOf(EngineConfiguration.getInstance().isInitialForceDisableClasspathScanning());
case "initialIncludeSubsystemClasses" -> ListFormatter.formatSet(EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses());
case "errorShortcodeConverter" -> String.valueOf(EngineConfiguration.getInstance().isErrorShortcodeConverter());
case "optimizeLogging" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeLogging());
case "optimizeEvents" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeEvents());
case "optimizeSubsystemInitialization" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeSubsystemInitialization());
case "loggerLevel" -> "LogLevel." + EngineConfiguration.getInstance().getLoggerLevel().name();
case "loggerTemplate" -> "\"" + EngineConfiguration.getInstance().getLoggerTemplate() + "\"";
@ -107,11 +112,14 @@ public class Command {
case "debugEvents" -> System.getProperties().setProperty("sosengine.base.debugEvents", String.valueOf(newValue));
case "debugShortcodeConverter" -> System.getProperties().setProperty("sosengine.base.debugShortcodeConverter", String.valueOf(newValue));
case "initialPerformSubsystemInitialization" -> System.getProperties().setProperty("sosengine.base.initialPerformSubsystemInitialization", String.valueOf(newValue));
case "initialForceDisableClasspathScanning" -> System.getProperties().setProperty("sosengine.base.initialForceDisableClasspathScanning", String.valueOf(newValue));
case "initialIncludeSubsystemClasses" -> System.getProperties().setProperty("sosengine.base.initialIncludeSubsystemClasses", String.valueOf(newValue));
case "errorShortcodeConverter" -> System.getProperties().setProperty("sosengine.base.errorShortcodeConverter", String.valueOf(newValue));
case "optimizeLogging" -> System.getProperties().setProperty("sosengine.base.optimizeLogging", String.valueOf(newValue));
case "optimizeEvents" -> System.getProperties().setProperty("sosengine.base.optimizeEvents", String.valueOf(newValue));
case "optimizeSubsystemInitialization" -> System.getProperties().setProperty("sosengine.base.optimizeSubsystemInitialization", String.valueOf(newValue));
case "loggerLevel" -> System.getProperties().setProperty("sosengine.base.loggerLevel", String.valueOf(newValue));
case "loggerTemplate" -> System.getProperties().setProperty("sosengine.base.loggerTemplate", String.valueOf(newValue));
@ -244,10 +252,10 @@ public class Command {
// Welcome
public static final String welcome =
"<#d60532><bold>EngineMC " + SubsystemInformation.getVersioningString() + " <italic>(on PaperMC Bukkit)</italic>\n" +
"""
<#d60532>This server is running <italic><click:open_url:https://git.staropensource.de/StarOpenSource/EngineMC>EngineMC</click></italic>, a port of the <italic><click:open_url:https://engine.staropensource.de>StarOpenSource Engine</click></italic> to Minecraft.
<#d60532>For a list of all available commands, execute <italic>/enginemc help</italic>""";
"\n" +
"<#d60532>This server is running <italic><click:open_url:https://git.staropensource.de/StarOpenSource/EngineMC>EngineMC</click></italic>, a port of the <italic><click:open_url:https://engine.staropensource.de>StarOpenSource Engine</click> " + EngineInformation.getVersioningString() + "</italic> to Minecraft.\n" +
"\n" +
"<#d60532>For a list of all available commands, execute <italic>/enginemc help</italic>";
// Help
public static final String help =

View file

@ -42,7 +42,7 @@ pluginRunTask=2.3.1
# Dependencies
dependencyLombok=1.18.32
dependencyJetbrainsAnnotations=24.1.0
dependencyStarOpenSourceEngine=1-alpha4
dependencyStarOpenSourceEngine=1-alpha5
dependencyAdventure=4.17.0
# etc

View file

@ -102,6 +102,10 @@ runServer {
// Agree to EULA
systemProperty("com.mojang.eula.agree", "true")
jvmArguments = [
'-Xlog:gc'
]
doFirst {
// Disable bStats
File config = new File(runDirectory.get().getAsFile().getPath() + "/plugins/bStats/config.yml")

View file

@ -85,6 +85,7 @@ public final class PlatformInitializer extends JavaPlugin {
@Override
public void onLoad() {
EngineBootstrapper.initialize(
true,
true,
exitcode -> {
if (Bukkit.getWorlds().isEmpty()) {