Update to sos!engine v1-alpha6 + more
All checks were successful
push-build-apidoc / generate-javadoc (push) Successful in 1m4s
push-build-apidoc / build (push) Successful in 1m8s

This commit not only updates the engine, but also adds/changes the following things:
- repository to download from
- engine initialization failures are now properly caught and complained about
- rename package to reflect v1-alpha6's package changes
- update links in README.md
This commit is contained in:
JeremyStar™ 2024-10-16 01:45:40 +02:00
parent 8f8db4e357
commit c55cff04a8
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
19 changed files with 95 additions and 103 deletions

View file

@ -34,7 +34,7 @@ It can do the following things:
## Known issues ## Known issues
### Reflection is broken ### Reflection is broken
Due to how the mod and plugin loaders load JAR files, scanning the classpath for annotations does not work. Due to how the mod and plugin loaders load JAR files, scanning the classpath for annotations does not work.
This means that events have to be registered manually. You can do that by calling [`EventHelper#registerEvent`](https://jd.engine.staropensource.de/v1-alpha5/base/de/staropensource/sosengine/base/implementable/helper/EventHelper.html#registerEvent(java.lang.Class,de.staropensource.sosengine.base.implementable.EventListenerCode,de.staropensource.sosengine.base.type.EventPriority)). This means that events have to be registered manually. You can do that by calling [`EventHelper#registerEvent`](https://jd.engine.staropensource.de/v1-alpha6/base/de/staropensource/engine/base/implementable/helper/EventHelper.html#registerEvent(java.lang.Class,de.staropensource.engine.base.implementable.EventListenerCode,de.staropensource.engine.base.type.EventPriority))).
If you want to use a specific subsystem, either find or make a plugin/mod porting that subsystem to Minecraft (best option), or shade and include the subsystem in your final JAR and hope nothing breaks. Only do that if you have no other choice or the subsystem is specific to your plugin or modification. If you want to use a specific subsystem, either find or make a plugin/mod porting that subsystem to Minecraft (best option), or shade and include the subsystem in your final JAR and hope nothing breaks. Only do that if you have no other choice or the subsystem is specific to your plugin or modification.
## Contributing ## Contributing

View file

@ -98,8 +98,8 @@ allprojects {
// StarOpenSource Engine // StarOpenSource Engine
maven { maven {
name = "staropensource-sosengine" name = "staropensource-engine"
url = "https://mvn.staropensource.de/sosengine" url = "https://mvn.staropensource.de/engine"
} }
// PaperMC // PaperMC

View file

@ -36,7 +36,7 @@ dependencies {
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// StarOpenSource Engine // StarOpenSource Engine
compileOnly("de.staropensource.sosengine:base:${dependencyStarOpenSourceEngine}") compileOnly("de.staropensource.engine:base:${dependencyStarOpenSourceEngine}")
// Adventure // Adventure
compileOnly("net.kyori:adventure-api:${dependencyAdventure}") compileOnly("net.kyori:adventure-api:${dependencyAdventure}")
@ -133,7 +133,7 @@ publishing {
repositories { repositories {
maven { maven {
name = "staropensource" name = "staropensource"
url = uri("https://mvn.staropensource.de/sosengine") url = uri("https://mvn.staropensource.de/engine")
credentials(org.gradle.api.credentials.PasswordCredentials) credentials(org.gradle.api.credentials.PasswordCredentials)
authentication { authentication {
//noinspection GroovyAssignabilityCheck //noinspection GroovyAssignabilityCheck

View file

@ -17,15 +17,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft; package de.staropensource.engine.minecraft;
import de.staropensource.sosengine.base.Engine; import de.staropensource.engine.base.Engine;
import de.staropensource.sosengine.base.EngineInternals; import de.staropensource.engine.base.EngineInternals;
import de.staropensource.sosengine.base.implementable.LoggingAdapter; import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.implementable.ShutdownHandler; import de.staropensource.engine.base.implementable.ShutdownHandler;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.type.InternalAccessArea; import de.staropensource.engine.base.type.InternalAccessArea;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -56,12 +56,17 @@ public final class EngineBootstrapper {
* @param disableClasspathScanning disables classpath scanning support * @param disableClasspathScanning disables classpath scanning support
* @param shutdownHandler {@link ShutdownHandler} implementation, which should ideally shutdown the server * @param shutdownHandler {@link ShutdownHandler} implementation, which should ideally shutdown the server
* @param loggingAdapter {@link LoggingAdapter} implementation, for printing log messages into the server console * @param loggingAdapter {@link LoggingAdapter} implementation, for printing log messages into the server console
* @throws Exception on error
* @since v1-alpha0 * @since v1-alpha0
*/ */
public static void initialize(boolean disableMultithreading, boolean disableClasspathScanning, @NotNull ShutdownHandler shutdownHandler, @NotNull LoggingAdapter loggingAdapter) { public static void initialize(boolean disableMultithreading, boolean disableClasspathScanning, @NotNull ShutdownHandler shutdownHandler, @NotNull LoggingAdapter loggingAdapter) throws Exception {
overwriteSystemProperties(disableMultithreading, disableClasspathScanning); // Overwrites certain system properties to overwrite the engine configuration overwriteSystemProperties(disableMultithreading, disableClasspathScanning); // Overwrites certain system properties to overwrite the engine configuration
Logger.setLoggingAdapter(loggingAdapter); // Install logging adapter Logger.setLoggingAdapter(loggingAdapter); // Install logging adapter
new Engine(); // Initialize engine try {
Engine.initialize(); // Initialize engine
} catch (Exception exception) {
throw exception;
}
configureEngineShutdown(shutdownHandler); // Configures how the engine shuts itself down configureEngineShutdown(shutdownHandler); // Configures how the engine shuts itself down
EngineInternals.getInstance().restrictAccess(InternalAccessArea.ALL_WRITE); // Restrict internal engine access to read-only EngineInternals.getInstance().restrictAccess(InternalAccessArea.ALL_WRITE); // Restrict internal engine access to read-only
initializeSubystems(); // Initialize subsystems initializeSubystems(); // Initialize subsystems

View file

@ -17,12 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft; package de.staropensource.engine.minecraft;
import de.staropensource.sosengine.base.annotation.EngineSubsystem; import de.staropensource.engine.base.annotation.EngineSubsystem;
import de.staropensource.sosengine.base.implementable.SubsystemClass; import de.staropensource.engine.base.implementable.SubsystemClass;
import de.staropensource.sosengine.base.implementation.versioning.StarOpenSourceVersioningSystem; import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.sosengine.base.type.DependencyVector; import de.staropensource.engine.base.type.DependencyVector;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**

View file

@ -17,14 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft; package de.staropensource.engine.minecraft;
import de.staropensource.sosengine.base.Engine; import de.staropensource.engine.base.Engine;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.type.VersionType; import de.staropensource.engine.base.type.VersionType;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.PropertiesReader; import de.staropensource.engine.base.utility.PropertiesReader;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import lombok.Getter; import lombok.Getter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View file

@ -17,15 +17,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.command; package de.staropensource.engine.minecraft.command;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.sosengine.base.utility.ListFormatter; import de.staropensource.engine.base.utility.ListFormatter;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.engine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.PlaceholderEngine; import de.staropensource.engine.base.utility.PlaceholderEngine;
import de.staropensource.sosengine.base.utility.information.EngineInformation; import de.staropensource.engine.base.utility.information.EngineInformation;
import de.staropensource.sosengine.base.utility.information.JvmInformation; import de.staropensource.engine.base.utility.information.JvmInformation;
import de.staropensource.sosengine.minecraft.SubsystemInformation; import de.staropensource.engine.minecraft.SubsystemInformation;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
public class Command { public final class Command {
/** /**
* Constructs this class. * Constructs this class.
* *
@ -70,13 +70,12 @@ public class Command {
String value = switch (arguments[1]) { String value = switch (arguments[1]) {
case "debug" -> String.valueOf(EngineConfiguration.getInstance().isDebug()); case "debug" -> String.valueOf(EngineConfiguration.getInstance().isDebug());
case "debugEvents" -> String.valueOf(EngineConfiguration.getInstance().isDebugEvents()); case "debugEvents" -> String.valueOf(EngineConfiguration.getInstance().isDebugEvents());
case "debugShortcodeConverter" -> String.valueOf(EngineConfiguration.getInstance().isDebugShortcodeConverter());
case "initialPerformSubsystemInitialization" -> String.valueOf(EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization()); case "initialPerformSubsystemInitialization" -> String.valueOf(EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization());
case "initialForceDisableClasspathScanning" -> String.valueOf(EngineConfiguration.getInstance().isInitialForceDisableClasspathScanning()); case "initialForceDisableClasspathScanning" -> String.valueOf(EngineConfiguration.getInstance().isInitialForceDisableClasspathScanning());
case "initialIncludeSubsystemClasses" -> ListFormatter.formatSet(EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses()); case "initialIncludeSubsystemClasses" -> ListFormatter.formatSet(EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses());
case "errorShortcodeConverter" -> String.valueOf(EngineConfiguration.getInstance().isErrorShortcodeConverter()); case "errorShortcodeParser" -> String.valueOf(EngineConfiguration.getInstance().isErrorShortcodeParser());
case "optimizeLogging" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeLogging()); case "optimizeLogging" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeLogging());
case "optimizeEvents" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeEvents()); case "optimizeEvents" -> String.valueOf(EngineConfiguration.getInstance().isOptimizeEvents());

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.command; package de.staropensource.engine.minecraft.command;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View file

@ -23,4 +23,4 @@
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
package de.staropensource.sosengine.minecraft; package de.staropensource.engine.minecraft;

View file

@ -11,10 +11,10 @@ module sosengine.minecraft {
requires net.kyori.adventure.text.minimessage; requires net.kyori.adventure.text.minimessage;
// API access // API access
exports de.staropensource.sosengine.minecraft; exports de.staropensource.engine.minecraft;
exports de.staropensource.sosengine.minecraft.command; exports de.staropensource.engine.minecraft.command;
// Reflection access // Reflection access
opens de.staropensource.sosengine.minecraft; opens de.staropensource.engine.minecraft;
opens de.staropensource.sosengine.minecraft.command; opens de.staropensource.engine.minecraft.command;
} }

View file

@ -42,8 +42,8 @@ pluginRunTask=2.3.1
# Dependencies # Dependencies
dependencyLombok=1.18.32 dependencyLombok=1.18.32
dependencyJetbrainsAnnotations=24.1.0 dependencyJetbrainsAnnotations=24.1.0
dependencyStarOpenSourceEngine=1-alpha5 dependencyStarOpenSourceEngine=1-alpha6
dependencyAdventure=4.17.0 dependencyAdventure=4.17.0
# etc # etc
group = de.staropensource.sosenginemc group = de.staropensource.enginemc

View file

@ -36,7 +36,7 @@ dependencies {
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}") compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// StarOpenSource Engine // StarOpenSource Engine
implementation("de.staropensource.sosengine:base:${dependencyStarOpenSourceEngine}") implementation("de.staropensource.engine:base:${dependencyStarOpenSourceEngine}")
// PaperMC // PaperMC
compileOnly("io.papermc.paper:paper-api:${minecraftMajor}${minecraftMinor}-${paperSnapshot}-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:${minecraftMajor}${minecraftMinor}-${paperSnapshot}-SNAPSHOT")
@ -103,7 +103,7 @@ runServer {
systemProperty("com.mojang.eula.agree", "true") systemProperty("com.mojang.eula.agree", "true")
jvmArguments = [ jvmArguments = [
'-Xlog:gc' //'-Xlog:gc'
] ]
doFirst { doFirst {
@ -129,7 +129,7 @@ publishing {
repositories { repositories {
maven { maven {
name = "staropensource" name = "staropensource"
url = uri("https://mvn.staropensource.de/sosengine") url = uri("https://mvn.staropensource.de/engine")
credentials(org.gradle.api.credentials.PasswordCredentials) credentials(org.gradle.api.credentials.PasswordCredentials)
authentication { authentication {
//noinspection GroovyAssignabilityCheck //noinspection GroovyAssignabilityCheck

View file

@ -17,19 +17,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.bukkit; package de.staropensource.engine.minecraft.bukkit;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.engine.base.EngineConfiguration;
import de.staropensource.sosengine.base.implementable.LoggingAdapter; import de.staropensource.engine.base.implementable.LoggingAdapter;
import de.staropensource.sosengine.base.implementation.shortcode.EmptyShortcodeConverter; import de.staropensource.engine.base.implementation.shortcode.EmptyShortcodeConverter;
import de.staropensource.sosengine.base.type.logging.LogLevel; import de.staropensource.engine.base.type.logging.LogLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* A {@link LoggingAdapter} for the Bukkit API. * A {@link LoggingAdapter} for the Bukkit API.
*/ */
public class BukkitLoggingAdapter implements LoggingAdapter { public final class BukkitLoggingAdapter implements LoggingAdapter {
/** /**
* Constructs this class. * Constructs this class.
* *

View file

@ -17,13 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.bukkit; package de.staropensource.engine.minecraft.bukkit;
import de.staropensource.sosengine.base.Engine; import de.staropensource.engine.base.Engine;
import de.staropensource.sosengine.base.logging.Logger; import de.staropensource.engine.base.logging.Logger;
import de.staropensource.sosengine.base.logging.LoggerInstance; import de.staropensource.engine.base.logging.LoggerInstance;
import de.staropensource.sosengine.minecraft.EngineBootstrapper; import de.staropensource.engine.minecraft.EngineBootstrapper;
import de.staropensource.sosengine.minecraft.bukkit.command.BukkitCommand; import de.staropensource.engine.minecraft.bukkit.command.BukkitCommand;
import lombok.Getter; import lombok.Getter;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -84,6 +84,7 @@ public final class PlatformInitializer extends JavaPlugin {
*/ */
@Override @Override
public void onLoad() { public void onLoad() {
try {
EngineBootstrapper.initialize( EngineBootstrapper.initialize(
true, true,
true, true,
@ -91,12 +92,22 @@ public final class PlatformInitializer extends JavaPlugin {
if (Bukkit.getWorlds().isEmpty()) { if (Bukkit.getWorlds().isEmpty()) {
logger.info("No worlds are loaded, halting JVM"); logger.info("No worlds are loaded, halting JVM");
Runtime.getRuntime().halt(exitcode); Runtime.getRuntime().halt(exitcode);
} else } else if (!Bukkit.isStopping())
if (!Bukkit.isStopping())
Bukkit.shutdown(); Bukkit.shutdown();
}, },
new BukkitLoggingAdapter() new BukkitLoggingAdapter()
); );
} catch (Exception exception) {
getLogger().severe("EngineMC failed to load the StarOpenSource Engine.");
getLogger().severe("Please see above for further information.");
getLogger().severe("The server will now be forcefully shut down to prevent damage.");
// Wait for 1s for log messages to be flushed
long waitTime = System.currentTimeMillis() + 1000;
while (System.currentTimeMillis() < waitTime)
Thread.onSpinWait();
Runtime.getRuntime().halt(0);
}
} }
/** /**

View file

@ -17,9 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.bukkit.command; package de.staropensource.engine.minecraft.bukkit.command;
import de.staropensource.sosengine.minecraft.command.Command; import de.staropensource.engine.minecraft.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
public class BukkitCommand implements CommandExecutor { public final class BukkitCommand implements CommandExecutor {
/** /**
* Constructs this class. * Constructs this class.
* *

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.minecraft.bukkit.command; package de.staropensource.engine.minecraft.bukkit.command;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
public class BukkitPlayer extends de.staropensource.sosengine.minecraft.command.Player { public final class BukkitPlayer extends de.staropensource.engine.minecraft.command.Player {
/** /**
* Contains the Bukkit player this instance refers to. * Contains the Bukkit player this instance refers to.
* *

View file

@ -23,4 +23,4 @@
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
package de.staropensource.sosengine.minecraft.bukkit; package de.staropensource.engine.minecraft.bukkit;

View file

@ -1,23 +0,0 @@
/**
* Bukkit (PaperMC implementation) port of the
* StarOpenSource Engine and EngineMC.
*
* @since v1-alpha0
*/
module sosengine.minecraft.bukkit {
// Dependencies
requires java.logging;
requires sosengine.base;
requires sosengine.minecraft;
requires org.bukkit;
requires net.kyori.adventure;
requires net.kyori.examination.api;
// API access
exports de.staropensource.sosengine.minecraft.bukkit;
exports de.staropensource.sosengine.minecraft.bukkit.command;
// Reflection access
opens de.staropensource.sosengine.minecraft.bukkit;
opens de.staropensource.sosengine.minecraft.bukkit.command;
}

View file

@ -1,6 +1,6 @@
name: "sosenginemc" name: "sosenginemc"
version: "${version}" version: "${version}"
main: "de.staropensource.sosengine.minecraft.bukkit.PlatformInitializer" main: "de.staropensource.engine.minecraft.bukkit.PlatformInitializer"
description: "A port of the StarOpenSource Engine to the Bukkit API." description: "A port of the StarOpenSource Engine to the Bukkit API."
authors: [ "The StarOpenSource EngineMC Authors" ] authors: [ "The StarOpenSource EngineMC Authors" ]
website: "https://git.staropensource.de/StarOpenSource/EngineMC" website: "https://git.staropensource.de/StarOpenSource/EngineMC"