-
- true
- true
- false
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index 0f1668035..31e7e659f 100644
--- a/README.md
+++ b/README.md
@@ -1,91 +1,11 @@
-# StarOpenSource Engine
-The StarOpenSource Engine (or sos!engine for short) is a modular, extensible and easy to use Java game and application engine.
+
+
+
+
-## WARNING
-The StarOpenSource Engine is under heavy development and is extremely unstable. Code will break often, prepare for potential major refactors when trying the engine out.
+
-## Index
-- [About](#about)
- - [... the engine](#-the-engine)
- - [... the repository](#-the-repository)
- - [Priorities](#priorities)
-- [Documentation](#documentation)
-- [Contributing](#contributing)
- - [Requirements](#requirements)
- - [What IDE to use?](#what-ide-to-use)
- - [Code style](#code-style)
- - [Pull request guidelines](#pull-request-guidelines)
- - [Making your first contribution](#making-your-first-contribution)
- - [Gradle properties](#gradle-properties)
-
-## About
-### ... the engine
-The StarOpenSource Engine is a modular and extensible framework for building applications and games written in [one of the multiple JVM programming languages](https://en.wikipedia.org/wiki/List_of_JVM_languages).
-The engine consists of various subsystems, each separate and responsible for only a few closely-related tasks.
- \
-Not only that. The engine also features various useful classes, interfaces and methods making development fun and simpler, while being lightweight.
-### ... the repository
-The sos!engine repository is a monorepo, consisting of [the core engine](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/base), multiple official subsystems and [their documentation](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/docs).
-### Priorities
-These are in no particular order.
-
-- configurable
-- [do one thing and do it well](https://en.wikipedia.org/wiki/Unix_philosophy) (subsystems concept)
-- fast
-- few runtime dependencies (note: we will cut down on some of them during development)
-- modular & extensible
-- small & lightweight
-
-## Documentation
-You can view the engine documentation at [engine.staropensource.de](https://engine.staropensource.de). It provides information, guides and tutorials about the core engine and subsystems.
-If you want the API reference, you can [visit the Javadoc](https://jd.engine.staropensource.de) for the engine and it's subsystems.
-
-## Contributing
-### Requirements
-You need the following things to be able to contribute code to the StarOpenSource Engine:
-- knowledge of Java
-- knowledge about the internals of engine
-### What IDE to use?
-We recommend and are using [IntelliJ IDEA Community Edition](https://github.com/JetBrains/intellij-community) for development because it is flexible, extendable, customizable, provides good completions and error detection. It's also open source.
-### Code style
-We recommend looking at existing classes and code for a good understanding on how we'd like code to be written.
-Here's a quick rundown on the most important things:
-- Document EVERYTHING. Every single class, field and method, even if private.
-- Make comments about your code, unless it's extremely simple and easy to understand.
-- Make sure to add and update `@since` in javadoc comments (update if the javadoc changes a good amount).
-- Keep stuff simple, no need to elaborate what a logger is. Though remember to not make it *too* simple.
-- Make sure every field and method has a newline to separate it.
-- Files must end with a newline or cats might get angry.
-- Use your brain.
-### Pull request guidelines
-Before creating a pull request, make sure you've:
-- created tests for the functionality you've added, changed or removed (if applicable),
-- tested your changes,
-- made sure that everything works,
-- is compatible with other code in the monorepo, and
-- is compatible with other applications. If not, tell us in your pull request description.
-### Making your first contribution
-TODO
-### Gradle properties
-Gradle's behaviour can be changed by changing gradle project properties.
-To change them, simply append `-P` or `-P=`, like this: `./gradlew -Pjobs=4 test`.
-#### Parallelism
-Use the `jobs` property to control how many jobs will get executed simultaneously.
-On Linux, specify `-Pjobs=$(nproc)`. Defaults to `8`.
-#### Rendering
-You can use the `renderingPlatform` property to control which rendering platform to initialize for.
-#### JVM Home
-You can use the `graalHome` property to specify the `$JAVA_HOME` of your local GraalVM installation.
-Only used in the `nativeImage` task. Useful if you aren't using GraalVM as your primary JDK.
-#### Testing
-You can use the following properties to modify the behaviour of the `test`-task:
-- `test.control.mode` (default *empty*)
- - `force-enable`: Disables all test classes except the ones specified
- - `force-disable`: Enables all test classes except the ones specified
- - *everything else*: Enables all test classes
-- `test.control.classes` (default *empty*): A comma-separated, case-sensitive list of test classes
- which (depending on `test.control.mode`'s value) enable or disable the specified classes.
- Example: `-Ptest.control.mode=MiscellaneousTest,DependencyResolverTest,EngineConfigurationTest`
-- `test.control.warning` (default `false`): If `true`, will emit a warning before a restricted test method exits
-- `test.loggerLevel` (default `silent_warning`): Will set `UnitLogger`'s logger level.
- Works like `-Dsosengine.base.loggerLevel`. See `UnitLogger#loggerLevel` for more information
+# TODO
+We haven't yet been able to finish the README yet, sorry.
+You can however still look at [the old README](https://git.staropensource.de/StarOpenSource/Engine/src/commit/1e978e314687109fefa4a0966d772bb0facac338/README.md).
diff --git a/ansi/build.gradle b/ansi/build.gradle
deleted file mode 100644
index 75b7dd26e..000000000
--- a/ansi/build.gradle
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-// Plugins
-plugins {
- id("java")
- id("io.freefair.lombok") version("${pluginLombok}")
- id("maven-publish")
-}
-
-// Dependencies
-dependencies {
- // Lombok
- compileOnly("org.projectlombok:lombok:${dependencyLombok}")
- annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
-
- // JetBrains Annotations
- compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
-
- // Jansi
- implementation("org.fusesource.jansi:jansi:${dependencyJansi}")
-
- // Project
- implementation(project(":base"))
-}
-
-// Javadoc configuration
-javadoc {
- outputs.upToDateWhen { false } // Force task execution
- dependsOn(delombok) // Make sure the source is delomboked first
-
- javadoc {
- setClasspath(files(project.sourceSets.main.compileClasspath)) // Include dependencies
-
- options {
- if (new File(projectDir, "src/main/javadoc/theme.css").exists())
- stylesheetFile = new File(projectDir, "src/main/javadoc/theme.css") // Theming is cool :3
- setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
- setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
- setLocale("en_US") // 你好
- addStringOption("Xwerror", "-quiet") // Fail build on warning
-
- setJFlags([
- "-Duser.language=en_US" // See above
- ])
- }
- }
-}
-
-// Include javadoc and source jar during publishing
-java {
- withJavadocJar()
- withSourcesJar()
-}
-
-// Build publishing configuration
-// Note: You can safely ignore any errors or warnings thrown by your IDE here
-publishing {
- repositories {
- maven {
- name = "staropensource"
- url = uri("https://mvn.staropensource.de/engine")
- credentials(org.gradle.api.credentials.PasswordCredentials)
- authentication {
- //noinspection GroovyAssignabilityCheck
- basic (BasicAuthentication)
- }
- }
- }
- publications {
- //noinspection GroovyAssignabilityCheck
- maven (MavenPublication) {
- groupId = group
- artifactId = project.getName()
- version = version
- //noinspection GroovyAssignabilityCheck
- from components.java
- }
- }
-}
-
-// Fix delombok task
-delombok.doFirst {
- File target = file("${project.projectDir}/src/main/module-info.java")
- File source = file("${project.projectDir}/src/main/java/module-info.java")
-
- target.delete()
- source.renameTo(target)
-}
-delombok.doLast {
- File target = file("${project.projectDir}/src/main/java/module-info.java")
- File source = file("${project.projectDir}/src/main/module-info.java")
-
- target.delete()
- source.renameTo(target)
-}
diff --git a/ansi/gradle b/ansi/gradle
deleted file mode 120000
index 3337596a2..000000000
--- a/ansi/gradle
+++ /dev/null
@@ -1 +0,0 @@
-../gradle
\ No newline at end of file
diff --git a/ansi/gradlew b/ansi/gradlew
deleted file mode 120000
index 502f5a2d3..000000000
--- a/ansi/gradlew
+++ /dev/null
@@ -1 +0,0 @@
-../gradlew
\ No newline at end of file
diff --git a/ansi/gradlew.bat b/ansi/gradlew.bat
deleted file mode 120000
index 284013288..000000000
--- a/ansi/gradlew.bat
+++ /dev/null
@@ -1 +0,0 @@
-../gradlew.bat
\ No newline at end of file
diff --git a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiLoggingAdapter.java b/ansi/src/main/java/de/staropensource/engine/ansi/AnsiLoggingAdapter.java
deleted file mode 100644
index 8ac94b3fd..000000000
--- a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiLoggingAdapter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.ansi;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.implementable.LoggingAdapter;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.fusesource.jansi.Ansi;
-import org.fusesource.jansi.AnsiConsole;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Prints colored log output using the Jansi library.
- *
- * @see Logger
- * @see LoggingAdapter
- * @since v1-alpha2
- */
-public class AnsiLoggingAdapter implements LoggingAdapter {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha2
- */
- public AnsiLoggingAdapter() {}
-
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings({ "resource" }) // Using try-with-resources will cause issues here
- public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
- // Convert to Ansi
- Ansi output = new AnsiShortcodeParser(format, true).getAnsi();
-
- // Print message
- if (level == LogLevel.ERROR || level == LogLevel.CRASH)
- if (EngineConfiguration.getInstance().isLogForceStandardOutput())
- AnsiConsole.out().println(output);
- else
- AnsiConsole.err().println(output);
- else
- AnsiConsole.out().println(output);
- }
-}
diff --git a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiShortcodeParser.java b/ansi/src/main/java/de/staropensource/engine/ansi/AnsiShortcodeParser.java
deleted file mode 100644
index 233cf257f..000000000
--- a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiShortcodeParser.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.ansi;
-
-import de.staropensource.engine.base.implementable.ShortcodeParser;
-import de.staropensource.engine.base.exception.ParserException;
-import org.fusesource.jansi.Ansi;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Implementation of the {@link ShortcodeParser} class
- * with ANSI support using the Jansi library.
- *
- * @see ShortcodeParser
- * @since v1-alpha8
- */
-public final class AnsiShortcodeParser extends ShortcodeParser {
- /**
- * Creates and initializes an instance of this class.
- *
- * @param string string to convert
- * @param ignoreInvalidEscapes will ignore invalid escapes and print treat them like regular text
- * @throws ParserException when parsing failed
- * @since v1-alpha2
- */
- public AnsiShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
- super(string, ignoreInvalidEscapes);
- }
-
- /**
- * Returns the parsed string as an {@link Ansi} sequence.
- *
- * @return {@link Ansi} sequence
- * @since v1-alpha2
- */
- public @NotNull Ansi getAnsi() {
- Ansi ansi = Ansi.ansi();
- Set<@NotNull String> status = new HashSet<>();
-
- for (String component : components)
- if (component.equals("RESET")) {
- ansi.a(Ansi.Attribute.RESET);
- status.clear();
- } else if (component.startsWith("TEXT:"))
- ansi.a(component.substring(5));
- else if (component.startsWith("COLOR:")) {
- if (component.startsWith("COLOR:FOREGROUND:"))
- ansi.fg(Ansi.Color.valueOf(component.substring(17)));
- else if (component.startsWith("COLOR:BACKGROUND:"))
- ansi.bg(Ansi.Color.valueOf(component.substring(17)));
- } else if (component.startsWith("ATTRIBUTE:"))
- if (component.startsWith("ATTRIBUTE:BLINK")) {
- if (status.contains("ATTRIBUTE:BLINK"))
- continue;
-
- ansi.a(Ansi.Attribute.BLINK_SLOW);
- status.add("ATTRIBUTE:BLINK");
- } else if (component.startsWith("ATTRIBUTE:BOLD")) {
- if (status.contains("ATTRIBUTE:BOLD"))
- continue;
-
- ansi.a(Ansi.Attribute.INTENSITY_BOLD);
- status.add("ATTRIBUTE:BOLD");
- } else if (component.startsWith("ATTRIBUTE:ITALIC")) {
- if (status.contains("ATTRIBUTE:ITALIC"))
- continue;
-
- ansi.a(Ansi.Attribute.ITALIC);
- status.add("ATTRIBUTE:ITALIC");
- } else if (component.startsWith("ATTRIBUTE:STRIKETHROUGH")) {
- if (status.contains("ATTRIBUTE:STRIKETHROUGH"))
- continue;
-
- ansi.a(Ansi.Attribute.STRIKETHROUGH_ON);
- status.add("ATTRIBUTE:STRIKETHROUGH");
- } else if (component.startsWith("ATTRIBUTE:UNDERLINE")) {
- if (status.contains("ATTRIBUTE:UNDERLINE"))
- continue;
-
- ansi.a(Ansi.Attribute.UNDERLINE);
- status.add("ATTRIBUTE:UNDERLINE");
- }
-
-
- return ansi;
- }
-}
diff --git a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiSubsystem.java b/ansi/src/main/java/de/staropensource/engine/ansi/AnsiSubsystem.java
deleted file mode 100644
index a70180014..000000000
--- a/ansi/src/main/java/de/staropensource/engine/ansi/AnsiSubsystem.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.ansi;
-
-import de.staropensource.engine.base.annotation.EngineSubsystem;
-import de.staropensource.engine.base.implementable.SubsystemClass;
-import de.staropensource.engine.base.implementation.logging.PlainLoggingAdapter;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.DependencyVector;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Main class of the ANSI Compatibility subsystem.
- *
- * @since v1-alpha2
- */
-@EngineSubsystem
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class AnsiSubsystem extends SubsystemClass {
- /**
- * Contains the class instance.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns the class instance.
- *
- * @return class instance unless the subsystem is uninitialized
- * @since v1-alpha2
- */
- @Getter
- private static AnsiSubsystem instance = null;
-
- /**
- * Initializes this subsystem.
- *
- * @since v1-alpha2
- */
- public AnsiSubsystem() {
- // Check if subsystem has already initialized
- if (instance == null)
- instance = this;
- else
- Logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "ansi";
- }
-
- /** {@inheritDoc} */
- @Override
- public void initializeSubsystem() {
- if (Logger.getLoggingAdapter().getClass().getName().equals(PlainLoggingAdapter.class.getName()))
- Logger.setLoggingAdapter(new AnsiLoggingAdapter());
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull DependencyVector getDependencyVector() {
- return new DependencyVector.Builder()
- .setIdentifier("ansi")
- .setVersioningSystem(StarOpenSourceVersioningSystem.class)
- .setVersion(EngineInformation.getVersioningString())
- .build();
- }
-}
diff --git a/ansi/src/main/java/module-info.java b/ansi/src/main/java/module-info.java
deleted file mode 100644
index 9ae351dda..000000000
--- a/ansi/src/main/java/module-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * The ANSI subsystem, allowing the engine to
- * use ANSI escape codes using the Jansi library.
- *
- * @since v1-alpha2
- */
-module sosengine.ansi {
- // Dependencies
- // -> Java
- requires transitive java.management;
- // -> Engine
- requires transitive sosengine.base;
- // -> Libraries
- requires transitive static lombok;
- requires transitive org.jetbrains.annotations;
- requires org.fusesource.jansi;
-
- // API access
- exports de.staropensource.engine.ansi;
-
- // Reflection access
- opens de.staropensource.engine.ansi;
-}
diff --git a/ansi/src/main/javadoc/overview.html b/ansi/src/main/javadoc/overview.html
deleted file mode 100644
index a4a6a76c9..000000000
--- a/ansi/src/main/javadoc/overview.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
Welcome to the sos!engine API documentation!
- You are currently in the documentation for the ansi subsystem, allowing ANSI escape sequences to be used using Jansi.
-
diff --git a/ansi/src/main/javadoc/theme.css b/ansi/src/main/javadoc/theme.css
deleted file mode 120000
index 681484a8e..000000000
--- a/ansi/src/main/javadoc/theme.css
+++ /dev/null
@@ -1 +0,0 @@
-../../../../src/main/javadoc/theme.css
\ No newline at end of file
diff --git a/base/.gitignore b/base/.gitignore
deleted file mode 100644
index 33fe2c907..000000000
--- a/base/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-src/main/resources/git.properties
diff --git a/base/README.md b/base/README.md
deleted file mode 100644
index bee8c927c..000000000
--- a/base/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# The `base` subsystem
-This is not just a subsystem, this is the core engine. It contains data types, logging infrastructure, an event system, a crash reporter and much more stuff required for basic applications.
diff --git a/base/build.gradle b/base/build.gradle
deleted file mode 100644
index bbb1dcb84..000000000
--- a/base/build.gradle
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-import java.nio.file.Files
-// Plugins
-plugins {
- id("java")
- id("io.freefair.lombok") version("${pluginLombok}")
- id("com.gorylenko.gradle-git-properties") version("${pluginGitProperties}")
- id("maven-publish")
-}
-
-// Dependencies
-dependencies {
- // -> Runtime
- // Lombok
- compileOnly("org.projectlombok:lombok:${dependencyLombok}")
- annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
-
- // JetBrains Annotations
- compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
-
- // Reflections
- implementation("org.reflections:reflections:${dependencyReflections}")
-
- // -> Testing
- // Jetbrains Annotations
- testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
-
- // JUnit
- testImplementation(platform("org.junit:junit-bom:${dependencyJunit}"))
- testImplementation("org.junit.jupiter:junit-jupiter")
- testRuntimeOnly("org.junit.platform:junit-platform-launcher")
-
- // Project
- testImplementation(project(":testing"))
-}
-
-// Javadoc configuration
-javadoc {
- outputs.upToDateWhen { false } // Force task execution
- dependsOn(delombok) // Make sure the source is delomboked first
-
- javadoc {
- setClasspath(files(project.sourceSets.main.compileClasspath)) // Include dependencies
-
- options {
- if (new File(projectDir, "src/main/javadoc/theme.css").exists())
- stylesheetFile = new File(projectDir, "src/main/javadoc/theme.css") // Theming is cool :3
- setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
- setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
- setLocale("en_US") // 你好
- addStringOption("Xwerror", "-quiet") // Fail build on warning
-
- setJFlags([
- "-Duser.language=en_US" // See above
- ])
- }
- }
-}
-
-// Unit testing configuration
-test {
- useJUnitPlatform()
-
- // Pass test configuration to test VMs
- Map testConfiguration = new HashMap<>();
- for (String property : project.properties.keySet())
- if (property.startsWith("test."))
- testConfiguration.put(property, project.properties.get(property).toString())
- systemProperties(testConfiguration)
-
- setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8)
- setForkEvery(1)
- setFailFast(true)
-
- testLogging {
- events("passed", "skipped", "failed")
- }
-}
-
-// Include javadoc and source jar during publishing
-java {
- withJavadocJar()
- withSourcesJar()
-}
-
-// Build publishing configuration
-// Note: You can safely ignore any errors or warnings thrown by your IDE here
-publishing {
- repositories {
- maven {
- name = "staropensource"
- url = uri("https://mvn.staropensource.de/engine")
- credentials(org.gradle.api.credentials.PasswordCredentials)
- authentication {
- //noinspection GroovyAssignabilityCheck
- basic (BasicAuthentication)
- }
- }
- }
- publications {
- //noinspection GroovyAssignabilityCheck
- maven (MavenPublication) {
- groupId = group
- artifactId = project.getName()
- version = version
- //noinspection GroovyAssignabilityCheck
- from components.java
- }
- }
-}
-
-// Copy gradle.properties file
-// for inclusion in final build
-tasks.register("copyGradleProperties") {
- doFirst {
- File target = file("${project.projectDir}/src/main/resources/sosengine-gradle.properties")
- File source = file(project(":").projectDir.getPath() + "/gradle.properties")
- target.delete()
- Files.copy(source.toPath(), target.toPath())
- }
-
- outputs.upToDateWhen({ false }) // Force task execution
-}
-processResources.dependsOn(copyGradleProperties)
-
-// Git properties configuration
-// Allows us to embed git commit information in the engine build
-gitProperties {
- dotGitDirectory = file("${rootProject.rootDir}/.git")
- failOnNoGitDirectory = false // Allow continuing if .git directory is missing for the few who use tarballs
- extProperty = "gitProps"
-
- dateFormat = "yyyy-MM-dd'T'HH:mmZ"
- dateFormatTimeZone = "UTC"
-}
-
-tasks.register("writeGitProperties") { // This task's only purpose is to copy the git.properties from our git properties plugin to the resources directory so it's included in the final build
- doLast {
- File target = file("${project.projectDir}/src/main/resources/sosengine-git.properties")
- File source = file("${project.projectDir}/build/resources/main/git.properties")
-
- target.delete()
- source.renameTo(target)
- }
-
- outputs.upToDateWhen({ false }) // Force task execution
-}
-generateGitProperties.outputs.upToDateWhen({ false }) // Force task execution
-processResources.dependsOn(writeGitProperties) // Ensure git.properties file is present
-
-// Fix delombok task
-delombok.doFirst {
- File target = file("${project.projectDir}/src/main/module-info.java")
- File source = file("${project.projectDir}/src/main/java/module-info.java")
-
- target.delete()
- source.renameTo(target)
-}
-delombok.doLast {
- File target = file("${project.projectDir}/src/main/java/module-info.java")
- File source = file("${project.projectDir}/src/main/module-info.java")
-
- target.delete()
- source.renameTo(target)
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/package-info.java b/base/build.gradle.kts
similarity index 78%
rename from base/src/main/java/de/staropensource/engine/base/implementation/versioning/package-info.java
rename to base/build.gradle.kts
index f421a5644..8ed0fbb48 100644
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/package-info.java
+++ b/base/build.gradle.kts
@@ -2,6 +2,7 @@
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* Licensed under the GNU Affero General Public License v3
+ * with an exception allowing classpath linking.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -17,10 +18,11 @@
* along with this program. If not, see .
*/
-/**
- * Built-in versioning systems which
- * can be used to represent versions of some work.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.implementation.versioning;
+// Dependencies
+dependencies {
+ // Kotlin support
+ kotlin(property("dependencyKotlinStdIdentifier") as String)
+
+ // sos!engine
+ implementation(project(":logging"))
+}
diff --git a/base/gradle b/base/gradle
deleted file mode 120000
index 3337596a2..000000000
--- a/base/gradle
+++ /dev/null
@@ -1 +0,0 @@
-../gradle
\ No newline at end of file
diff --git a/base/gradlew b/base/gradlew
deleted file mode 120000
index 502f5a2d3..000000000
--- a/base/gradlew
+++ /dev/null
@@ -1 +0,0 @@
-../gradlew
\ No newline at end of file
diff --git a/base/gradlew.bat b/base/gradlew.bat
deleted file mode 120000
index 284013288..000000000
--- a/base/gradlew.bat
+++ /dev/null
@@ -1 +0,0 @@
-../gradlew.bat
\ No newline at end of file
diff --git a/base/src/main/java/de/staropensource/engine/base/Engine.java b/base/src/main/java/de/staropensource/engine/base/Engine.java
deleted file mode 100644
index bc4d989f3..000000000
--- a/base/src/main/java/de/staropensource/engine/base/Engine.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base;
-
-import de.staropensource.engine.base.annotation.EngineSubsystem;
-import de.staropensource.engine.base.event.*;
-import de.staropensource.engine.base.exception.IllegalAccessException;
-import de.staropensource.engine.base.exception.dependency.UnmetDependenciesException;
-import de.staropensource.engine.base.implementable.ShutdownHandler;
-import de.staropensource.engine.base.implementable.SubsystemClass;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
-import de.staropensource.engine.base.event.InternalEngineShutdownEvent;
-import de.staropensource.engine.base.internal.type.DependencySubsystemVector;
-import de.staropensource.engine.base.logging.PrintStreamService;
-import de.staropensource.engine.base.logging.*;
-import de.staropensource.engine.base.logging.backend.async.LoggingQueue;
-import de.staropensource.engine.base.logging.backend.async.LoggingThread;
-import de.staropensource.engine.base.type.DependencyVector;
-import de.staropensource.engine.base.type.EngineState;
-import de.staropensource.engine.base.utility.DependencyResolver;
-import de.staropensource.engine.base.utility.FileAccess;
-import de.staropensource.engine.base.utility.misc.Miscellaneous;
-import de.staropensource.engine.base.utility.PlaceholderEngine;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-import org.reflections.Reflections;
-import org.reflections.scanners.Scanners;
-import org.reflections.util.ClasspathHelper;
-import org.reflections.util.ConfigurationBuilder;
-
-import java.util.*;
-
-/**
- * Main class of the sos!engine.
- *
- * @see EngineConfiguration
- * @since v1-alpha0
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Engine extends SubsystemClass {
- /**
- * Contains the class instance.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the class instance.
- *
- * @return class instance unless {@link Engine} is uninitialized
- * @since v1-alpha0
- */
- @Getter
- private static Engine instance = null;
-
- /**
- * Contains the thread group of the engine.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns the thread group of the engine.
- *
- * @return engine thread group
- * @since v1-alpha2
- */
- @Getter
- private static final ThreadGroup threadGroup = new ThreadGroup("sos!engine");
-
- /**
- * Contains the engine state.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns the engine state.
- *
- * @return shutdown state
- * @since v1-alpha2
- */
- @Getter
- private @NotNull EngineState state;
-
- /**
- * Contains a list of all registered subsystems.
- * The list is sorted after initialization order.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns a list of all registered subsystems.
- * The list is sorted after initialization order.
- *
- * @return subsystem list
- * @since v1-alpha1
- */
- @Getter
- private @NotNull List<@NotNull DependencySubsystemVector> subsystems = Collections.emptyList();
-
- /**
- * Contains the engine's shutdown handler.
- * The shutdown handler is responsible for
- * shutting down the JVM safely.
- *
- * @see ShutdownHandler
- * @since v1-alpha2
- * -- GETTER --
- * Returns the engine's shutdown handler.
- * The shutdown handler is responsible for
- * shutting down the JVM safely.
- *
- * @return shutdown handler
- * @see ShutdownHandler
- * @since v1-alpha2
- * -- SETTER --
- * Sets the engine's shutdown handler.
- * The shutdown handler is responsible for
- * shutting down the JVM safely.
- *
- * @param shutdownHandler new shutdown handler
- * @see ShutdownHandler
- * @since v1-alpha2
- */
- @Getter(value = AccessLevel.MODULE)
- @Setter(value = AccessLevel.MODULE)
- private @NotNull ShutdownHandler shutdownHandler = new Engine.JvmShutdownHandler();
-
- /**
- * Contains the JVM shutdown hook thread,
- * which ensures that the engine is fully shut
- * down before the JVM exits.
- *
- * @see EngineInternals#installSafetyShutdownHook(boolean)
- * @since v1-alpha4
- */
- @Getter(AccessLevel.MODULE)
- private final @NotNull Thread safetyShutdownHook = Thread.ofPlatform()
- .name("Engine shutdown thread")
- .group(getThreadGroup())
- .unstarted(() -> {
- // Check if already shutting down
- switch (state) {
- case UNKNOWN, SHUTDOWN, CRASHED -> {
- return;
- }
- }
-
- // Print warning about shutdown
- Logger.warn("Trying to shut down engine using shutdown hook.\nThis approach to shutting down the engine and JVM is NOT RECOMMENDED, please use Engine#shutdown() instead.");
-
- // Shutdown
- Engine.getInstance().shutdown();
-
- // Print last message
- Logger.warn("Engine successfully shut down using shutdown hook. PLEASE USE Engine#shutdown() INSTEAD OF System#exit() or Runtime#exit()!");
- });
-
- /**
- * Initializes the StarOpenSource Engine.
- *
- * @throws RuntimeException for all exceptions thrown by this constructor
- * @since v1-alpha8
- */
- private Engine() throws RuntimeException {
- try {
- instance = this;
- state = EngineState.EARLY_STARTUP;
-
- // For measuring the initialization time
- long initTimeEarly = System.currentTimeMillis();
- long initTimeLate = initTimeEarly;
-
- // Check for incompatible JVM implementations
- checkJvmIncompatibilities();
-
- // Display that the engine is initializing
- Logger.verb("Initializing engine");
-
- // Start the logging thread
- Logger.diag("Starting logging infrastructure");
- LoggingThread.startThread(false);
- PrintStreamService.initializeStreams();
-
- // Initialize EngineInternals
- Logger.diag("Initializing EngineInternals class");
- new EngineInternals();
-
- // Load engine configuration
- Logger.diag("Loading engine configuration");
- new EngineConfiguration();
- EngineConfiguration.getInstance().loadConfiguration();
-
- // Load engine build information
- Logger.diag("Loading engine build information");
- EngineInformation.update();
-
- // Check for reflective classpath scanning compatibility
- checkReflectiveClasspathScanningCompatibility();
-
- // Check for Java version incompatibilities
- checkJavaVersion();
-
- // Initialize PlaceholderEngine
- Logger.diag("Initializing PlaceholderEngine");
- PlaceholderEngine.initialize();
-
- // Initialize static FileAccess instances
- Logger.diag("Initializing static FileAccess instances");
- FileAccess.initializeInstances();
-
- // Install the safety shutdown hook
- Logger.diag("Installing safety shutdown hook");
- EngineInternals.getInstance().installSafetyShutdownHook(true);
-
- // Cache events
- Logger.diag("Caching event listeners");
- cacheEvents();
-
- // Complete early initialization stage
- Logger.verb("Completing early initialization stage");
- state = EngineState.STARTUP;
- initTimeEarly = System.currentTimeMillis() - initTimeEarly;
-
- // Perform automatic subsystem initialization
- if (EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization()) {
- // Collect all subsystems
- Logger.diag("Collecting subsystems");
- collectSubsystems();
-
- // Initialize subsystems
- try {
- initializeSubsystems();
- } catch (Exception exception) {
- Logger.error("Subsystem dependency resolution failed");
- }
- }
-
- // Complete late initialization stage
- Logger.verb("Completing late initialization stage");
- state = EngineState.RUNNING;
- initTimeLate = System.currentTimeMillis() - initTimeLate;
-
- // Print welcome message
- Logger.info(
- """
- Welcome to the StarOpenSource Engine "%engine_version_codename%" %engine_version%!
- Running commit %engine_git_commit_id_long% (dirty %engine_git_dirty%).
- Initialization took %init_time_total%ms (early %init_time_early%ms, late %init_time_late%ms).
-
- Copyright (c) 2024 The StarOpenSource Engine Authors
- Licensed under the GNU Affero General Public License v3"""
- .replace("%init_time_total%", String.valueOf(initTimeEarly + initTimeLate))
- .replace("%init_time_early%", String.valueOf(initTimeEarly))
- .replace("%init_time_late%", String.valueOf(initTimeLate))
- );
- } catch (Exception exception) {
- throw new RuntimeException(exception);
- }
- }
-
- /**
- * Initializes the StarOpenSource
- * Engine, if it isn't already.
- *
- * @throws IllegalStateException when running in an incompatible environment
- * @throws RuntimeException on engine initialization failure
- * @since v1-alpha6
- */
- public static void initialize() throws RuntimeException {
- try {
- if (instance == null)
- new Engine();
- } catch (RuntimeException exception) {
- Logger.error("Engine initialization failed\n" + Miscellaneous.stacktraceAsStringRecursive(exception.getCause(), true, true));
- Logger.flush();
-
- throw new RuntimeException("Engine initialization failed", exception.getCause());
- }
- }
-
- /**
- * Checks if the running JVM implementation is not supported by the engine.
- *
- * @since v1-alpha8
- */
- private void checkJvmIncompatibilities() {
- if (System.getProperties().getProperty("sosengine.base.allowUnsupportedJVMInitialization", "false").equals("true")) {
- Logger.warn("Skipping JVM implementation incompatibilities check");
- return;
- }
-
- // Substrate VM (GraalVM Community)
- if (JvmInformation.getImplementationName().equals("Substrate VM") && JvmInformation.getImplementationVendor().equals("GraalVM Community")) {
- Logger.error("##############################################################################################");
- Logger.error("## Running in Substrate VM, which is the name of the JVM used by GraalVM native-image. ##");
- Logger.error("## The StarOpenSource Engine does not support native-image as using reflection in a certain ##");
- Logger.error("## way seems to cause the Substrate JVM to crash. Workarounds have failed. ##");
- Logger.error("## This has already been noted in issue #3, which you can view here: ##");
- Logger.error("## https://git.staropensource.de/StarOpenSource/Engine/issues/3 ##");
- Logger.error("## ##");
- Logger.error("## While this is sad, we unfortunately can't do anything against it unless we introduce ##");
- Logger.error("## annoying and stupid changes into the engine, which we don't want to do. ##");
- Logger.error("## ##");
- Logger.error("## We're truly sorry for this inconvenience. The sos!engine will now terminate. ##");
- Logger.error("##############################################################################################");
- Runtime.getRuntime().exit(255);
- }
- }
-
- /**
- * Checks if reflective classpath scanning is supported.
- *
- * @since v1-alpha8
- */
- private void checkReflectiveClasspathScanningCompatibility() {
- // Check if reflective classpath scanning is supported
- if (System.getProperties().getProperty("sosengine.base.considerEnvironmentUnfriendlyToClasspathScanning", "false").equals("true")) {
- Logger.warn("Running in an classpath scanning-unfriendly environment, disabling classpath scanning support.");
- Logger.warn("If shit doesn't work and is expected to be discovered by annotations, you'll need to");
- Logger.warn("either register it first or have to update some engine configuration setting.");
- Logger.warn("Please consult sos!engine's documentation for more information about this issue.");
- EngineInternals.getInstance().overrideReflectiveClasspathScanning(false);
- }
- }
-
- /**
- * Checks and warns if the Java version of the
- * running JVM is higher than the engine supports.
- *
- * @since v1-alpha8
- */
- private void checkJavaVersion() {
- if (JvmInformation.getJavaVersion() > EngineInformation.getJavaSource())
- Logger.warn("The StarOpenSource Engine is running on an untested Java version.\nThings may not work as expected or features which can improve performance, stability, compatibility or ease of use may be missing.\nIf you encounter issues, try running a JVM implementing Java " + EngineInformation.getJavaSource());
- }
-
- /**
- * Caches all base engine events.
- *
- * @since v1-alpha0
- */
- private void cacheEvents() {
- EventHelper.cacheEvent(EngineCrashEvent.class);
- EventHelper.cacheEvent(EngineShutdownEvent.class);
- EventHelper.cacheEvent(EngineSoftCrashEvent.class);
- EventHelper.cacheEvent(InternalEngineShutdownEvent.class);
- EventHelper.cacheEvent(LogEvent.class);
- }
-
- /**
- * Collects all subsystems by their {@link EngineSubsystem} annotation.
- *
- * @since v1-alpha1
- */
- private void collectSubsystems() {
- ArrayList<@NotNull DependencySubsystemVector> subsystemsMutable = new ArrayList<>();
- Object initializedClassRaw;
- SubsystemClass initializedClass;
-
- // Check and initialize all classes, get dependency vector and check version, then add to 'subsystemsMutable'
- for (Class> clazz : getRawSubsystemClasses())
- try {
- // Create new instance
- initializedClassRaw = clazz.getDeclaredConstructor().newInstance();
- initializedClass = null;
-
- // Check if class implements SubsystemMainClass
- if (initializedClassRaw instanceof SubsystemClass)
- initializedClass = (SubsystemClass) initializedClassRaw;
- else
- Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Does not implement " + SubsystemClass.class.getName());
-
- //noinspection DataFlowIssue // the crash call will prevent a NullPointerException
- subsystemsMutable.add(new DependencySubsystemVector(initializedClass.getDependencyVector(), initializedClass));
- } catch (Exception exception) {
- if (exception.getClass() == IllegalStateException.class && exception.getMessage().startsWith("The version string is invalid: "))
- Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Invalid version string: " + exception.getMessage().replace("The version string is invalid: ", ""));
- Logger.crash("Failed to initialize subsystem " + clazz.getName() + ": Method invocation error", exception);
- }
-
- // Update 'subsystems'
- subsystems = Collections.unmodifiableList(subsystemsMutable);
- }
-
- /**
- * Returns a list of classes which are potentially
- * eligible for subsystem initialization.
- *
- * @return potential subsystem classes
- * @since v1-alpha5
- */
- private Set<@NotNull Class>> getRawSubsystemClasses() {
- Set<@NotNull Class>> classes = new HashSet<>();
-
- if (EngineInternals.getInstance().getReflectiveClasspathScanning()) {
- // Scan entire classpath using the Reflections library
- Reflections reflections = new Reflections(
- new ConfigurationBuilder()
- .setUrls(ClasspathHelper.forJavaClassPath())
- .setScanners(Scanners.TypesAnnotated)
- );
-
- // Get annotated methods
- classes = reflections.getTypesAnnotatedWith(EngineSubsystem.class);
- } else
- for (String path : EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses())
- try {
- Logger.diag("Resolving class " + path);
- classes.add(Class.forName(path));
- } catch (ClassNotFoundException exception) {
- Logger.error("Failed loading subsystem class " + path + ": Class not found");
- }
-
- return classes;
- }
-
- /**
- * Initializes all subsystems.
- *
- * @throws Exception exceptions thrown by the {@link DependencyResolver}
- * @since v1-alpha1
- */
- private void initializeSubsystems() throws Exception {
- DependencyResolver resolver = new DependencyResolver();
- LinkedList order = new LinkedList<>();
-
- // Add vectors
- resolver.addVector(getDependencyVector());
- resolver.addVectors(subsystems);
-
- // Resolve dependencies and get order
- Logger.diag("Resolving subsystem dependencies");
- try {
- for (DependencyVector vector : resolver.resolve().getOrder()) // smol workaround
- order.add((DependencySubsystemVector) vector);
- } catch (Throwable throwable) {
- if (throwable instanceof UnmetDependenciesException exception) {
- List<@NotNull String> unmetDependencies = exception.getUnmetDependencies();
- StringBuilder list = new StringBuilder();
-
- for (String error : unmetDependencies)
- list
- .append("\n")
- .append("- ")
- .append(error);
-
- Logger.crash("Found unresolved dependencies:" + list, throwable);
- return;
- }
- Logger.crash("An error occurred trying to resolve subsystem dependencies: " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
- throw throwable;
- }
-
- // Initialize subsystems
- Logger.diag("Initializing engine subsystems");
- long initTime;
- for (DependencySubsystemVector vector : subsystems) {
- Logger.diag("Initializing subsystem '" + vector.getSubsystemClass().getName() + "' (" + vector.getSubsystemClass().getClass().getName() + ")");
- try {
- initTime = Miscellaneous.measureExecutionTime(() -> vector.getSubsystemClass().initializeSubsystem());
- } catch (Throwable throwable) {
- Logger.crash("An error occurred trying to initialize subsystem " + vector.getSubsystemClass().getName() + " (" + vector.getSubsystemClass().getClass().getName() + "): " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
- throw throwable;
- }
- Logger.diag("Initialized subsystem '" + vector.getSubsystemClass().getName() + "' (" + vector.getSubsystemClass().getClass().getName() + ") in " + initTime + "ms");
- }
-
- // Update 'subsystems'
- subsystems = Collections.unmodifiableList(order);
- }
-
- /**
- * Shuts the engine down.
- *
- * @param exitCode code to exit with, from 0-255
- * @since v1-alpha0
- */
- public synchronized void shutdown(@Range(from = 0, to = 255) int exitCode) {
- if (state == EngineState.UNKNOWN || state == EngineState.SHUTDOWN)
- return;
-
- Logger.info("Shutting engine down");
- if (state != EngineState.CRASHED)
- state = EngineState.SHUTDOWN;
-
- // Make engine single-threaded
- Properties properties = new Properties();
- properties.setProperty("sosengine.base.optimizeLogging", "false");
- properties.setProperty("sosengine.base.optimizeEvents", "false");
- EngineConfiguration.getInstance().loadConfiguration(properties);
-
- // Flush log messages
- LoggingQueue.flush();
-
- // Disable safety shutdown hook
- try {
- Runtime.getRuntime().removeShutdownHook(safetyShutdownHook);
- } catch (Exception ignored) {}
-
- // Send events
- Logger.verb("Notifying classes about shutdown");
- new EngineShutdownEvent().callEvent();
-
- Logger.verb("Notifying subsystems about shutdown");
- new InternalEngineShutdownEvent().callEvent();
-
- // Delete scheduled files
- FileAccess.deleteScheduled();
-
- // Invoke shutdown handler
- Logger.verb("Invoking shutdown handler (code " + exitCode + ")");
- shutdownHandler.shutdown((short) exitCode);
- }
-
- /**
- * Shuts the engine down.
- *
- * @since v1-alpha0
- */
- public void shutdown() {
- if (instance != null)
- instance.shutdown(0);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "base";
- }
-
- /**
- * This method does nothing.
- *
- * @since v1-alpha1
- */
- @Override
- public void initializeSubsystem() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull DependencyVector getDependencyVector() {
- return new DependencyVector.Builder()
- .setIdentifier("engine")
- .setVersioningSystem(StarOpenSourceVersioningSystem.class)
- .setVersion(EngineInformation.getVersioningString())
- .build();
- }
-
- /**
- * Sets the engine state.
- *
- * @param state new state
- * @throws IllegalAccessException if the caller class is unauthorized
- * @since v1-alpha2
- */
- public void setState(@NotNull EngineState state) throws IllegalAccessException {
- if (!Thread.currentThread().getStackTrace()[2].getClassName().startsWith("de.staropensource.engine.base."))
- throw new IllegalAccessException("Only classes inside the \"de.staropensource.engine.base\" package are allowed to call this method.");
-
- this.state = state;
- }
-
- /**
- * The default shutdown handler, which causes the JVM to exit.
- *
- * @see ShutdownHandler
- * @see System#exit(int)
- * @since v1-alpha2
- */
- public static final class JvmShutdownHandler implements ShutdownHandler {
- /**
- * Constructs this class.
- *
- * @since v1-alpha2
- */
- public JvmShutdownHandler() {}
-
- /** {@inheritDoc} */
- @Override
- public void shutdown(short exitCode) {
- // Check if already shutting down
- try {
- Thread thread = Thread.ofVirtual().unstarted(() -> {});
-
- Runtime.getRuntime().addShutdownHook(thread);
- Runtime.getRuntime().removeShutdownHook(thread);
- } catch (IllegalStateException exception) {
- Logger.warn("Terminating JVM: Already shutting down, skipping");
- return;
- }
-
- Logger.warn("Terminating JVM");
- Runtime.getRuntime().exit(exitCode);
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java b/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java
deleted file mode 100644
index f367258c8..000000000
--- a/base/src/main/java/de/staropensource/engine/base/EngineConfiguration.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base;
-
-import de.staropensource.engine.base.annotation.EngineSubsystem;
-import de.staropensource.engine.base.event.LogEvent;
-import de.staropensource.engine.base.implementable.Configuration;
-import de.staropensource.engine.base.implementable.ShortcodeParser;
-import de.staropensource.engine.base.implementable.SubsystemClass;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.logging.backend.async.LoggingThread;
-import de.staropensource.engine.base.type.EngineState;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import de.staropensource.engine.base.type.vector.Vec2f;
-import de.staropensource.engine.base.type.vector.Vec2i;
-import de.staropensource.engine.base.utility.PropertiesReader;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * Provides the base engine configuration.
- *
- * This class does not only provide engine settings but is also
- * responsible for loading them into memory from {@link Properties} objects.
- *
- * Now you might ask why we didn't go with the string-based approach.
- * The answer is simple: It's a maintenance burden.
- * Having various settings strings scattered across many classes will cause
- * trouble at some point, which will cause some strings to be undocumented
- * or have an inconsistent naming scheme. Containing settings as variables in
- * one centralized place mitigates this.
- *
- * @since v1-alpha0
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class EngineConfiguration extends Configuration {
- /**
- * Contains the class instance.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the class instance.
- *
- * @return class instance unless {@link Engine} is uninitialized
- * @since v1-alpha0
- */
- @Getter
- private static EngineConfiguration instance;
-
- /**
- * Contains the configuration prefix.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the configuration prefix.
- *
- * @return property group
- * @since v1-alpha0
- */
- private final @NotNull String group = "sosengine.base.";
-
-
- /**
- * Contains if debugging options should be allowed.
- * All debugging options will be forcefully set to
- * {@code false} if this option is set to {@code false}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns if debugging options should be allowed.
- * All debugging options will be forcefully set to
- * {@code false} if this option is set to {@code false}.
- *
- * @return debugging enabled?
- * @since v1-alpha0
- */
- private boolean debug;
-
- /**
- * Contains whether or not to log
- * events being emitted.
- *
- * This will cause all events to
- * be logged, with the exception
- * of the {@link LogEvent}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns whether or not to log
- * events being emitted.
- *
- * This will cause all events to
- * be logged, with the exception
- * of the {@link LogEvent}.
- *
- * @return detailed event logging enabled?
- * @since v1-alpha0
- */
- private boolean debugEvents;
-
-
- /**
- * Contains whether or not to automatically discover
- * and initialize any class extending {@link SubsystemClass}
- * whilst being annotated with {@link EngineSubsystem}.
- *
- * This mechanism may fail in certain situations, where
- * manual subsystem initialization may be desired. Make
- * sure to disable this setting before engine startup
- * and then initialize all subsystems manually.
- *
- * @see Engine
- * @since v1-alpha5
- * -- GETTER --
- * Returns whether or not to automatically discover
- * and initialize any class extending {@link SubsystemClass}
- * whilst being annotated with {@link EngineSubsystem}.
- *
- * This mechanism may fail in certain situations, where
- * manual subsystem initialization may be desired. Make
- * sure to disable this setting before engine startup
- * and then initialize all subsystems manually.
- *
- * @return automatically discover and initialize subsystems?
- * @since v1-alpha5
- */
- private boolean initialPerformSubsystemInitialization;
-
- /**
- * Contains a set of class names to try to load
- * and initialize as subsystems. Will only take effect
- * if {@link #initialPerformSubsystemInitialization} is
- * turned off.
- *
- * @since v1-alpha5
- * -- GETTER --
- * Returns a set of class names to try to load
- * and initialize as subsystems. Will only take effect
- * if {@link #getInitialIncludeSubsystemClasses()} is
- * turned off.
- *
- * @return set of class names to try and initialize as subsystems
- * @since v1-alpha5
- */
- private Set<@NotNull String> initialIncludeSubsystemClasses;
-
-
- /**
- * Contains whether or not to complain about invalid
- * shortcodes.
- *
- * Requires the active log level to be set at least
- * to {@link LogLevel#SILENT_WARNING} to have effect.
- *
- * @see #logLevel
- * @since v1-alpha0
- * -- GETTER --
- * Returns whether or not to complain about invalid
- * shortcodes.
- *
- * Requires the active log level to be set at least
- * to {@link LogLevel#SILENT_WARNING} to have effect.
- *
- * @return complain about invalid shortcodes?
- * @see #getLogLevel()
- * @since v1-alpha0
- */
- private boolean errorShortcodeParser;
-
-
- /**
- * Contains if to log asynchronously.
- *
- * If enabled, will cause a logging thread
- * to spawn. All log messages will be queued
- * and printed after a set delay
- * ({@link #logPollingSpeed}).
- * Highly recommended to keep enabled, or
- * the performance of your application will
- * very likely suffer.
- *
- * @see #logPollingSpeed
- * @since v1-alpha0
- * -- GETTER --
- * Returns if to log asynchronously.
- *
- * If enabled, will cause a logging thread
- * to spawn. All log messages will be queued
- * and printed after a set delay
- * ({@link #getLogPollingSpeed()}).
- * Highly recommended to keep enabled, or
- * the performance of your application will
- * very likely suffer.
- *
- * @return log asynchronously?
- * @see #getLogPollingSpeed()
- * @since v1-alpha0
- */
- private boolean optimizeLogging;
-
- /**
- * Contains whether or not to emit events
- * asynchronously.
- *
- * This will cause a
- * VirtualThread
- * to spawn every time an event is emitted.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Contains whether or not to emit events
- * asynchronously.
- *
- * This will cause a
- * VirtualThread
- * to spawn every time an event is emitted.
- *
- * @return emit events asynchronously?
- * @since v1-alpha0
- */
- private boolean optimizeEvents;
-
-
- /**
- * Contains the minimum allowed log level.
- *
- * The priority list is as follows (from high to low priority):
- *
- * The priority list is as follows (from high to low priority):
- *
- *
{@link LogLevel#CRASH}
- *
{@link LogLevel#ERROR}
- *
{@link LogLevel#WARNING}
- *
{@link LogLevel#INFORMATIONAL}
- *
{@link LogLevel#SILENT_WARNING}
- *
{@link LogLevel#VERBOSE}
- *
{@link LogLevel#DIAGNOSTIC}
- *
- *
- * @return minimum allowed log level
- * @since v1-alpha0
- */
- private LogLevel logLevel;
-
- /**
- * Contains a comma-separated list of optional
- * features to add to the final log output.
- *
- * Available features (in order of appearance):
- *
- *
formatting
- *
runtime
- *
date
- *
time
- *
shortIssuerClass
- *
moduleName
- *
moduleVersion (requires moduleName)
- *
methodName
- *
lineNumber
- *
- *
- * @since v1-alpha8
- * -- GETTER --
- * Returns a comma-separated list of optional
- * features to add to the final log output.
- *
- * Available features (in order of appearance):
- *
- *
formatting
- *
runtime
- *
date
- *
time
- *
shortIssuerClass
- *
moduleName
- *
moduleVersion (requires moduleName)
- *
methodName
- *
lineNumber
- *
level
- *
origin
- *
- *
- * @return optional features to enable
- * @since v1-alpha8
- */
- private Set<@NotNull String> logFeatures;
-
- /**
- * Contains how fast the logging thread will
- * poll for queued messages in milliseconds.
- * This also causes messages to be buffered.
- *
- * Only applies if {@code optimizeLogging} is turned on.
- * Values below {@code 1} will poll for queued messages
- * as fast as it can. This however has pretty much no
- * benefit. Leave it at {@code 5}, it works quite well.
- *
- * @see #optimizeLogging
- * @since v1-alpha4
- * -- GETTER --
- * Contains how fast the logging thread will
- * poll for queued messages, in milliseconds.
- * This also causes messages to be buffered.
- *
- * Only applies if {@code optimizeLogging} is turned on.
- * Values below {@code 1} will poll for queued messages
- * as fast as it can. This however has pretty much no
- * benefit. Leave it at {@code 5}, it works quite well.
- *
- * @return logging thread polling speed in milliseconds
- * @see #isOptimizeLogging()
- * @since v1-alpha4
- */
- private int logPollingSpeed;
-
- /**
- * Contains whether or not to forcefully write
- * to the standard output instead of the
- * standard error stream.
- *
- * This only applies to the {@link LogLevel#ERROR} and
- * {@link LogLevel#CRASH} log levels, as these use
- * the standard error stream by default.
- *
- * @see man page about standard streams
- * @since v1-alpha0
- * -- GETTER --
- * Contains whether or not to forcefully write
- * to the standard output instead of the
- * standard error stream.
- *
- * This only applies to the {@link LogLevel#ERROR} and
- * {@link LogLevel#CRASH} log levels, as these use
- * the standard error stream by default.
- *
- * @return force use stdout?
- * @see man page about standard streams
- * @since v1-alpha0
- */
- private boolean logForceStandardOutput;
-
-
- /**
- * Contains if to truncate the full path
- * of a class when invoking using their
- * {@link #toString()} method.
- *
- * Here's an example: Lets say that you have a
- * {@link Vec2f} instance and want to convert
- * it to a String. You can do that by using
- * {@link Vec2f}'s {@link Vec2f#toString()}
- * method. With this flag disabled it will
- * return
- * {@code de.staropensource.engine.base.types.vectors.}{@link Vec2i}{@code (x=64 y=64)}.
- * With this flag enabled however the method will return
- * {@link Vec2i}{@code (x=64 y=64)},
- * which is much smaller.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns if to truncate the full path
- * of a class when invoking using their
- * {@link #toString()} method.
- *
- * Here's an example: Lets say that you have a
- * {@link Vec2f} instance and want to convert
- * it to a String. You can do that by using
- * {@link Vec2f}'s {@link Vec2f#toString()}
- * method. With this flag disabled it will
- * return
- * {@code de.staropensource.engine.base.types.vectors.}{@link Vec2i}{@code (x=64 y=64)}.
- * With this flag enabled however the method will return
- * {@link Vec2i}{@code (x=64 y=64)},
- * which is much smaller.
- *
- * @return truncate class paths?
- * @since v1-alpha2
- */
- private boolean hideFullTypePath;
-
- /**
- * Constructs this class.
- *
- * @see Engine
- * @since v1-alpha6
- */
- EngineConfiguration() {
- super();
-
- instance = this;
-
- // Load default configuration
- loadDefaultConfiguration();
- }
-
- /** {@inheritDoc} */
- @Override
- protected void matchProperty(@NotNull PropertiesReader parser, @NotNull String property) {
- try {
- switch (property) {
- case "debug" -> debug = parser.getBoolean(group + property);
- case "debugEvents" -> debugEvents = parser.getBoolean(group + property);
-
- case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property);
- case "initialIncludeSubsystemClasses" -> {
- initialIncludeSubsystemClasses = new HashSet<>();
- initialIncludeSubsystemClasses.addAll(Arrays.stream(parser.getString(group + property).split(",")).toList());
- }
-
- case "errorShortcodeParser" -> errorShortcodeParser = parser.getBoolean(group + property);
-
- case "optimizeLogging" -> {
- optimizeLogging = parser.getBoolean(group + property);
-
- // Start logging thread automatically
- if (optimizeLogging && Engine.getInstance().getState() == EngineState.RUNNING) {
- LoggingThread.startThread(false);
- }
- }
- case "optimizeEvents" -> optimizeEvents = parser.getBoolean(group + property);
-
- case "logLevel" -> {
- try {
- logLevel = LogLevel.valueOf(parser.getString(group + property).toUpperCase());
- } catch (IllegalArgumentException ignored) {
- Logger.error("The log level '" + parser.getString(group + property) + "' is not valid");
- }
- }
- case "logFeatures" -> logFeatures = Set.copyOf(Arrays.stream(parser.getString(group + property).split(",")).toList());
- case "logPollingSpeed" -> logPollingSpeed = parser.getInteger(group + property, true);
- case "logForceStandardOutput" -> logForceStandardOutput = parser.getBoolean(group + property);
-
- case "hideFullTypePath" -> hideFullTypePath = parser.getBoolean(group + property);
- }
- } catch (NullPointerException ignored) {}
- }
-
- /** {@inheritDoc} */
- @Override
- protected void processSettings(@NotNull PropertiesReader parser) {
- // Disable all debugging switches if 'debug' is disabled
- if (!debug) {
- debugEvents = false;
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void loadDefaultConfiguration() {
- debug = false;
- debugEvents = false;
-
- initialPerformSubsystemInitialization = true;
- initialIncludeSubsystemClasses = new HashSet<>();
-
- errorShortcodeParser = true;
-
- optimizeLogging = true;
- optimizeEvents = true;
-
- logLevel = LogLevel.INFORMATIONAL;
- logFeatures = Set.of("formatting", "time", "methodName", "lineNumber", "level", "origin");
- logPollingSpeed = 5;
- logForceStandardOutput = false;
-
- hideFullTypePath = false;
- }
-
- /** {@inheritDoc} */
- @Override
- public @Nullable Object getSetting(@NotNull String setting) {
- return switch (setting) {
- case "debug" -> debug;
- case "debugEvents" -> debugEvents;
-
- case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
- case "initialIncludeSubsystemClasses" -> initialIncludeSubsystemClasses;
-
- case "errorShortcodeParser" -> errorShortcodeParser;
-
- case "optimizeLogging" -> optimizeLogging;
- case "optimizeEvents" -> optimizeEvents;
-
- case "logLevel" -> logLevel;
- case "logFeatures" -> logFeatures;
- case "logPollingSpeed" -> logPollingSpeed;
- case "logForceStandardOutput" -> logForceStandardOutput;
-
- case "hideFullTypePath" -> hideFullTypePath;
- default -> null;
- };
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/EngineInternals.java b/base/src/main/java/de/staropensource/engine/base/EngineInternals.java
deleted file mode 100644
index 740833ea6..000000000
--- a/base/src/main/java/de/staropensource/engine/base/EngineInternals.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base;
-
-import de.staropensource.engine.base.exception.IllegalAccessException;
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.EventListenerCode;
-import de.staropensource.engine.base.implementable.ShutdownHandler;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.InternalAccessArea;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Class which allows access to the internals
- * and changing the behaviour of the engine.
- *
- * @since v1-alpha4
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class EngineInternals {
- /**
- * Contains the class instance.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the class instance.
- *
- * @return class instance unless the engine is uninitialized
- * @since v1-alpha4
- */
- @Getter
- private static EngineInternals instance;
-
- /**
- * Contains all disabled internal access areas.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns all disabled internal access areas.
- *
- * @return restricted areas
- * @since v1-alpha4
- */
- @Getter
- private final @NotNull List<@NotNull InternalAccessArea> restrictedAreas = new ArrayList<>();
-
- /**
- * Contains whether the engine should reflectively
- * search the classpath for events or other annotations.
- *
- * If disabled, code will either have to manually call
- * registration methods or certain classes have to
- * be created in a certain package, depending on the
- * use case and application.
- *
- * @see EventHelper#registerEvent(Class, EventListenerCode)
- * @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
- * @since v1-alpha5
- */
- private boolean reflectiveClasspathScanning = true;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha6
- */
- EngineInternals() {
- // Only allow one instance
- if (instance == null && Engine.getInstance() != null)
- instance = this;
- else
- Logger.crash("Only one instance of this class is allowed, use getInstance() instead of creating a new instance");
- }
-
- /**
- * Determines whether access to the specified area is allowed.
- *
- * @param area internal access area to check
- * @throws IllegalAccessException when restricted
- * @since v1-alpha4
- */
- private void isRestricted(@NotNull InternalAccessArea area) throws IllegalAccessException {
- if (restrictedAreas.contains(area))
- throw new IllegalAccessException("The internal access area " + area.name() + " has been restricted");
- }
-
- /**
- * Restricts access to certain areas of this class.
- *
- * @param area area to restrict
- * @since v1-alpha4
- */
- public void restrictAccess(@NotNull InternalAccessArea area) {
- switch (area) {
- case ALL -> {
- List<@NotNull InternalAccessArea> areas = new ArrayList<>(List.of(InternalAccessArea.values()));
- areas.remove(InternalAccessArea.ALL);
- areas.remove(InternalAccessArea.ALL_READ);
- areas.remove(InternalAccessArea.ALL_WRITE);
- areas.remove(InternalAccessArea.ALL_READ_ESSENTIAL);
- restrictedAreas.addAll(areas);
- }
- case ALL_WRITE -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesWriteOnly()).toList());
- case ALL_READ -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesReadOnly()).toList());
- case ALL_READ_ESSENTIAL -> restrictedAreas.addAll(Arrays.stream(InternalAccessArea.valuesEssentialReadOnly()).toList());
- default -> restrictedAreas.add(area);
- }
- }
-
- /**
- * Installs or uninstalls the JVM shutdown
- * hook, which prevents the JVM from exiting
- * before the engine has fully shut down.
- * Highly recommended to keep enabled.
- *
- * @param status {@code true} to install, {@code false} otherwise
- * @throws IllegalAccessException when restricted ({@link InternalAccessArea#SAFETY_SHUTDOWN_HOOK_UPDATE})
- * @since v1-alpha4
- */
- public void installSafetyShutdownHook(boolean status) throws IllegalAccessException {
- isRestricted(InternalAccessArea.SAFETY_SHUTDOWN_HOOK_UPDATE);
-
- try {
- if (status)
- Runtime.getRuntime().addShutdownHook(Engine.getInstance().getSafetyShutdownHook());
- else
- Runtime.getRuntime().removeShutdownHook(Engine.getInstance().getSafetyShutdownHook());
- } catch (IllegalArgumentException | IllegalStateException ignored) {}
- }
-
- /**
- * Gets the engine's shutdown handler.
- * The shutdown handler is responsible for
- * shutting down the JVM safely.
- *
- * @return shutdown handler
- * @throws IllegalAccessException when restricted ({@link InternalAccessArea#SHUTDOWN_HANDLER_GET})
- * @since v1-alpha4
- */
- public @NotNull ShutdownHandler getShutdownHandler() throws IllegalAccessException {
- isRestricted(InternalAccessArea.SHUTDOWN_HANDLER_GET);
- return Engine.getInstance().getShutdownHandler();
- }
-
- /**
- * Sets the engine's shutdown handler.
- * The shutdown handler is responsible for
- * shutting down the JVM safely.
- *
- * @param shutdownHandler new shutdown handler
- * @throws IllegalAccessException when restricted ({@link InternalAccessArea#SHUTDOWN_HANDLER_UPDATE})
- * @since v1-alpha4
- */
- public void setShutdownHandler(@NotNull ShutdownHandler shutdownHandler) throws IllegalAccessException {
- isRestricted(InternalAccessArea.SHUTDOWN_HANDLER_UPDATE);
- Engine.getInstance().setShutdownHandler(shutdownHandler);
- }
-
- /**
- * Returns whether the engine should reflectively
- * search the classpath for events or other annotations.
- *
- * If disabled, code will either have to manually call
- * registration methods or certain classes have to
- * be created in a certain package, depending on the
- * use case and application.
- *
- * @return reflective classpath scanning flag state
- * @throws IllegalAccessException when restricted ({@link InternalAccessArea#REFLECTIVE_CLASSPATH_SCANNING_GET})
- * @see EventHelper#registerEvent(Class, EventListenerCode)
- * @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
- * @since v1-alpha5
- */
- public boolean getReflectiveClasspathScanning() throws IllegalAccessException {
- isRestricted(InternalAccessArea.REFLECTIVE_CLASSPATH_SCANNING_GET);
- return reflectiveClasspathScanning;
- }
-
- /**
- * Overrides whether the engine should reflectively
- * search the classpath for events or other annotations.
- *
- * If disabled, code will either have to manually call
- * registration methods or certain classes have to
- * be created in a certain package, depending on the
- * use case and application.
- *
- * Enabling reflective classpath scanning in an unsupported
- * environment may cause minor to extreme side effects,
- * including but not limited to bugs, exceptions, engine
- * or even whole JVM crashes. You have been warned!
- *
- * @param reflectiveClasspathScanning new reflective classpath scanning
- * @throws IllegalAccessException when restricted ({@link InternalAccessArea#REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE})
- * @see EventHelper#registerEvent(Class, EventListenerCode)
- * @see EventHelper#registerEvent(Class, EventListenerCode, Event.Priority)
- * @since v1-alpha5
- */
- public void overrideReflectiveClasspathScanning(boolean reflectiveClasspathScanning) throws IllegalAccessException {
- isRestricted(InternalAccessArea.REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE);
- this.reflectiveClasspathScanning = reflectiveClasspathScanning;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/annotation/EngineSubsystem.java b/base/src/main/java/de/staropensource/engine/base/annotation/EngineSubsystem.java
deleted file mode 100644
index 6bbb71d45..000000000
--- a/base/src/main/java/de/staropensource/engine/base/annotation/EngineSubsystem.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.annotation;
-
-import de.staropensource.engine.base.implementable.SubsystemClass;
-
-import java.lang.annotation.*;
-
-/**
- * Marks a class as a subsystem main class.
- * Make sure your subsystem implements {@link SubsystemClass}.
- *
- * @see SubsystemClass
- * @since v1-alpha1
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-public @interface EngineSubsystem {}
diff --git a/base/src/main/java/de/staropensource/engine/base/annotation/EventListener.java b/base/src/main/java/de/staropensource/engine/base/annotation/EventListener.java
deleted file mode 100644
index f835a9693..000000000
--- a/base/src/main/java/de/staropensource/engine/base/annotation/EventListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.annotation;
-
-import de.staropensource.engine.base.implementable.Event;
-import org.jetbrains.annotations.NotNull;
-
-import java.lang.annotation.*;
-
-/**
- * Marks a method as an event listener, allowing it
- * to respond to an events when it is emitted.
- *
- * @since v1-alpha0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Documented
-public @interface EventListener {
- /**
- * Specifies the event to listen for.
- *
- * @return event to listen on
- * @see Event
- * @since v1-alpha0
- */
- @NotNull Class extends Event> event();
-
- /**
- * Specifies the priority of the event.
- *
- * @return event priority
- * @see Event.Priority
- * @since v1-alpha0
- */
- @NotNull Event.Priority priority() default Event.Priority.DEFAULT;
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/event/EngineCrashEvent.java b/base/src/main/java/de/staropensource/engine/base/event/EngineCrashEvent.java
deleted file mode 100644
index ea9a36524..000000000
--- a/base/src/main/java/de/staropensource/engine/base/event/EngineCrashEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.event;
-
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-
-/**
- * Called in the event of an engine crash.
- *
- * @since v1-alpha0
- */
-public final class EngineCrashEvent implements Event {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineCrashEvent() {}
-
- /** {@inheritDoc} */
- @Override
- public void callEvent() {
- EventHelper.invokeAnnotatedMethods(getClass());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/event/EngineShutdownEvent.java b/base/src/main/java/de/staropensource/engine/base/event/EngineShutdownEvent.java
deleted file mode 100644
index 1f1910a93..000000000
--- a/base/src/main/java/de/staropensource/engine/base/event/EngineShutdownEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.event;
-
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-
-/**
- * Called when the engine is about to shutdown.
- *
- * @since v1-alpha0
- */
-public final class EngineShutdownEvent implements Event {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineShutdownEvent() {}
-
- /** {@inheritDoc} */
- @Override
- public void callEvent() {
- EventHelper.invokeAnnotatedMethods(getClass());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/event/EngineSoftCrashEvent.java b/base/src/main/java/de/staropensource/engine/base/event/EngineSoftCrashEvent.java
deleted file mode 100644
index 743cc7715..000000000
--- a/base/src/main/java/de/staropensource/engine/base/event/EngineSoftCrashEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.event;
-
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-import de.staropensource.engine.base.logging.Logger;
-
-/**
- * Called in the event of a soft engine crash
- * ie. when a crash report is thrown but marked
- * as handled.
- *
- * @see Logger#crash(Class, String, String, String, Throwable, boolean)
- * @since v1-alpha0
- */
-public final class EngineSoftCrashEvent implements Event {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineSoftCrashEvent() {}
-
- /** {@inheritDoc} */
- @Override
- public void callEvent() {
- EventHelper.invokeAnnotatedMethods(getClass());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/event/InternalEngineShutdownEvent.java b/base/src/main/java/de/staropensource/engine/base/event/InternalEngineShutdownEvent.java
deleted file mode 100644
index 7daf15e02..000000000
--- a/base/src/main/java/de/staropensource/engine/base/event/InternalEngineShutdownEvent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.event;
-
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-
-/**
- * Called when the engine is about to shutdown, after {@link de.staropensource.engine.base.event.EngineShutdownEvent}.
- *
- * Meant for subsystems to perform cleanup and shutdown routines, not for applications.
- *
- * @since v1-alpha0
- */
-public final class InternalEngineShutdownEvent implements Event {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public InternalEngineShutdownEvent() {}
-
- /** {@inheritDoc} */
- @Override
- public void callEvent() {
- EventHelper.invokeAnnotatedMethods(getClass());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/event/LogEvent.java b/base/src/main/java/de/staropensource/engine/base/event/LogEvent.java
deleted file mode 100644
index 6de307fb5..000000000
--- a/base/src/main/java/de/staropensource/engine/base/event/LogEvent.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.event;
-
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Called before a new log message is printed.
- *
- * @since v1-alpha0
- */
-public final class LogEvent implements Event {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public LogEvent() {}
-
- /**
- * {@inheritDoc}
- *
- * @deprecated use the {@code callEvent} method with arguments
- * @see #callEvent(LogLevel, Class, String, String, String)
- */
- @Deprecated
- @Override
- public void callEvent() {}
-
- /**
- * Emits the event and calls all event listeners.
- *
- * @param level level
- * @param issuerClass issuer class
- * @param issuerOrigin issuer origin
- * @param issuerMetadata issuer metadata
- * @param message message
- * @since v1-alpha0
- */
- public void callEvent(@NotNull LogLevel level, @NotNull Class> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message) {
- EventHelper.invokeAnnotatedMethods(getClass(), level, issuerClass, issuerOrigin, issuerMetadata, message);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/ParserException.java b/base/src/main/java/de/staropensource/engine/base/exception/ParserException.java
deleted file mode 100644
index 9b39d1d55..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/ParserException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when something fails to parse.
- *
- * @since v1-alpha2
- */
-public class ParserException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param message parsing error
- * @since v1-alpha2
- */
- public ParserException(@NotNull String message) {
- super(message);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/TristateConversionException.java b/base/src/main/java/de/staropensource/engine/base/exception/TristateConversionException.java
deleted file mode 100644
index 858b9353f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/TristateConversionException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception;
-
-import de.staropensource.engine.base.type.Tristate;
-
-/**
- * Thrown when converting a {@link Tristate} into a {@link Boolean} fails.
- *
- * This exception inherits {@link RuntimeException} on purpose,
- * as sometimes you may sure/have already validated that the
- * {@link Tristate} is not {@link Tristate#UNSET}.
- *
- * @since v1-alpha2
- */
-public class TristateConversionException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @since v1-alpha2
- */
- public TristateConversionException() {
- super("Tristate.UNSET cannot be converted into a boolean");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/UnexpectedCheckEndException.java b/base/src/main/java/de/staropensource/engine/base/exception/UnexpectedCheckEndException.java
deleted file mode 100644
index 072130da9..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/UnexpectedCheckEndException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when a sequence of if checks or switch cases fail unexpectedly.
- *
- * @since v1-alpha2
- */
-public class UnexpectedCheckEndException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param checkOccurrence the sequence of checks that failed
- * @since v1-alpha2
- */
- public UnexpectedCheckEndException(@NotNull String checkOccurrence) {
- super("A sequence of if checks or switch cases failed unexpectedly while " + checkOccurrence);
- }
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @since v1-alpha2
- */
- public UnexpectedCheckEndException() {
- super("A sequence of if checks or switch cases failed unexpectedly");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/dependency/DependencyCycleException.java b/base/src/main/java/de/staropensource/engine/base/exception/dependency/DependencyCycleException.java
deleted file mode 100644
index 10a7fb160..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/dependency/DependencyCycleException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.dependency;
-
-import de.staropensource.engine.base.utility.DependencyResolver;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when the {@link DependencyResolver} detects a dependency cycle.
- *
- * @since v1-alpha1
- */
-public class DependencyCycleException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param path cycle path
- * @since v1-alpha1
- */
- public DependencyCycleException(@NotNull String path) {
- super("Dependency cycle detected: " + path);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/dependency/UnmetDependenciesException.java b/base/src/main/java/de/staropensource/engine/base/exception/dependency/UnmetDependenciesException.java
deleted file mode 100644
index d76654e61..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/dependency/UnmetDependenciesException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.dependency;
-
-import de.staropensource.engine.base.type.DependencyVector;
-import de.staropensource.engine.base.utility.DependencyResolver;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * Thrown when the {@link DependencyResolver} cannot resolve one
- * or more {@link DependencyVector}s due to unmet dependencies.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public class UnmetDependenciesException extends Exception {
- /**
- * Contains the unmet dependencies list supplied to the constructor.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the unmet dependencies list supplied to the constructor.
- *
- * @return unmet dependencies list
- * @since v1-alpha4
- */
- private final @NotNull List<@NotNull String> unmetDependencies;
-
- /**
- * Creates and initializes an instance of this event.
- *
- * @param unmetDependencies map of all unmet dependencies
- * @see #unmetDependencies
- * @since v1-alpha4
- */
- public UnmetDependenciesException(@NotNull List<@NotNull String> unmetDependencies) {
- this.unmetDependencies = unmetDependencies;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/IncompatibleTypeException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/IncompatibleTypeException.java
deleted file mode 100644
index 345b4ab25..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/IncompatibleTypeException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import de.staropensource.engine.base.type.reflection.ClassType;
-import de.staropensource.engine.base.utility.misc.ListFormatter;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when the invoked method does not apply to the type of the class.
- *
- * @since v1-alpha2
- */
-public class IncompatibleTypeException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param methodName name of the method that failed
- * @param requiredClassType class type received by the method
- * @param compatibleTypes class types the method is compatible with
- */
- public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType @NotNull [] compatibleTypes) {
- super("The method ReflectionClass#" + methodName + " only applies to type(s) " + ListFormatter.formatArray(compatibleTypes) + ", not " + requiredClassType.name());
- }
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param methodName name of the method that failed
- * @param requiredClassType class type received by the method
- * @param compatibleType class type the method is compatible with
- */
- public IncompatibleTypeException(@NotNull String methodName, @NotNull ClassType requiredClassType, @NotNull ClassType compatibleType) {
- super("The method ReflectionClass#" + methodName + " only applies to type(s) " + ListFormatter.formatArray(new ClassType[]{ compatibleType }) + ", not " + requiredClassType.name());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InstanceMethodFromStaticContextException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/InstanceMethodFromStaticContextException.java
deleted file mode 100644
index 791af7680..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InstanceMethodFromStaticContextException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when trying to call an instance (non-static) method from a static context.
- *
- * @since v1-alpha2
- */
-public class InstanceMethodFromStaticContextException extends Exception {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param methodName name of the method
- * @since v1-alpha2
- */
- public InstanceMethodFromStaticContextException(@NotNull String methodName) {
- super("Method " + methodName + " could not be called as the method is non-static and was called from a static context");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidFieldException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidFieldException.java
deleted file mode 100644
index 010171d75..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidFieldException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import de.staropensource.engine.base.reflection.ReflectionClass;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when a field could not be found.
- *
- * @since v1-alpha2
- */
-public class InvalidFieldException extends Exception {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param clazz caller {@link ReflectionClass}
- * @param fieldName name of the invalid field
- */
- public InvalidFieldException(@NotNull ReflectionClass clazz, @NotNull String fieldName) {
- super("Invalid field name \"" + fieldName + "\" in class " + clazz.getPath());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodException.java
deleted file mode 100644
index 0f84ace55..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import de.staropensource.engine.base.reflection.ReflectionClass;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when a method could not be found.
- *
- * @since v1-alpha2
- */
-public class InvalidMethodException extends Exception {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param clazz caller {@link ReflectionClass}
- * @param fieldName name of the invalid method
- */
- public InvalidMethodException(@NotNull ReflectionClass clazz, @NotNull String fieldName) {
- super("Invalid method name \"" + fieldName + "\" in class " + clazz.getPath());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodSignatureException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodSignatureException.java
deleted file mode 100644
index 8fd1a8b80..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/InvalidMethodSignatureException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when a method could not be found due to an invalid method signature.
- *
- * @since v1-alpha5
- */
-public class InvalidMethodSignatureException extends Exception {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param methodName method name
- * @since v1-alpha5
- */
- public InvalidMethodSignatureException(@NotNull String methodName) {
- super("Method " + methodName + " has a different method signature");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/NoAccessException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/NoAccessException.java
deleted file mode 100644
index f2cb06443..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/NoAccessException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown if access to some class, method or field has been denied.
- *
- * @since v1-alpha2
- */
-public class NoAccessException extends Exception {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param type {@code class}, {@code method} or {@code field}
- * @param name class, method or field name
- * @since v1-alpha2
- */
- public NoAccessException(@NotNull String type, @NotNull String name) {
- super("Access to " + type + " " + name + " has been denied");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/StaticInitializerException.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/StaticInitializerException.java
deleted file mode 100644
index 8c4f9af15..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/StaticInitializerException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.reflection;
-
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Thrown when an exception is thrown by a static initializer.
- *
- * @since v1-alpha2
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public class StaticInitializerException extends Exception {
- /**
- * Contains the throwable thrown by the static initializer.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns the throwable thrown by the static initializer.
- *
- * @return throwable thrown by the static initializer
- * @since v1-alpha2
- */
- private final @NotNull Throwable throwable;
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param throwable throwable thrown by the static initializer
- * @since v1-alpha2
- */
- public StaticInitializerException(@NotNull Throwable throwable) {
- this.throwable = throwable;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/reflection/package-info.java b/base/src/main/java/de/staropensource/engine/base/exception/reflection/package-info.java
deleted file mode 100644
index 183923b6e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/reflection/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Exceptions related to reflection.
- *
- * @see de.staropensource.engine.base.reflection
- * @since v1-alpha2
- */
-package de.staropensource.engine.base.exception.reflection;
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/versioning/IncompatibleVersioningSystemException.java b/base/src/main/java/de/staropensource/engine/base/exception/versioning/IncompatibleVersioningSystemException.java
deleted file mode 100644
index eeb2fe92f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/versioning/IncompatibleVersioningSystemException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-
-/**
- * Thrown when trying to compare a {@link VersioningSystem} against another
- * {@link VersioningSystem}, which it does not support.
- *
- * @since v1-alpha1
- */
-public class IncompatibleVersioningSystemException extends RuntimeException {
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param required required versioning system ie. the versioning system throwing this error
- * @param found found versioning system ie. the incompatible one
- * @since v1-alpha1
- */
- public IncompatibleVersioningSystemException(VersioningSystem required, VersioningSystem found) {
- super("The versioning system " + required + " is incompatible with " + found);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/versioning/InvalidVersionStringException.java b/base/src/main/java/de/staropensource/engine/base/exception/versioning/InvalidVersionStringException.java
deleted file mode 100644
index 545b30417..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/versioning/InvalidVersionStringException.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.exception.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-
-/**
- * Thrown when an invalid version string is supplied
- * to an implementation of {@link VersioningSystem}.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public class InvalidVersionStringException extends Exception {
- /**
- * Contains the throwable supplied to the constructor.
- *
- * @see #InvalidVersionStringException(VersioningSystem, String, Throwable)
- * @see #InvalidVersionStringException(VersioningSystem, String, String, Throwable)
- * @since v1-alpha1
- * -- GETTER --
- * Returns the throwable supplied by the constructor.
- *
- * @return throwable
- * @see #InvalidVersionStringException(VersioningSystem, String, Throwable)
- * @see #InvalidVersionStringException(VersioningSystem, String, String, Throwable)
- * @since v1-alpha1
- */
- private final @Nullable Throwable throwable;
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param versioningSystem versioning system that is unable to parse version strings
- * @param versionString version string {@code a}
- * @param message some error message
- * @param throwable throwable that caused the parsing error
- * @since v1-alpha1
- */
- public InvalidVersionStringException(@NotNull VersioningSystem versioningSystem, @NotNull String versionString, @NotNull String message, @NotNull Throwable throwable) {
- super("Versioning system " + versioningSystem.getName() + " can't parse version string \"" + versionString + "\": " + message);
- this.throwable = throwable;
- }
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param versioningSystem versioning system that is unable to parse version strings
- * @param versionString version string {@code a}
- * @param message some error message
- * @since v1-alpha1
- */
- public InvalidVersionStringException(@NotNull VersioningSystem versioningSystem, @NotNull String versionString, @NotNull String message) {
- super("Versioning system " + versioningSystem.getName() + " can't parse version string \"" + versionString + "\": " + message);
- throwable = null;
- }
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param versioningSystem versioning system that is unable to parse version strings
- * @param versionString version string {@code a}
- * @param throwable throwable that caused the parsing error
- * @since v1-alpha1
- */
- public InvalidVersionStringException(@NotNull VersioningSystem versioningSystem, @NotNull String versionString, @NotNull Throwable throwable) {
- super("Versioning system " + versioningSystem.getName() + " can't parse version string \"" + versionString + "\"");
- this.throwable = throwable;
- }
-
- /**
- * Creates and initializes an instance of this exception.
- *
- * @param versioningSystem versioning system that is unable to parse version strings
- * @param versionString version string {@code a}
- * @since v1-alpha1
- */
- public InvalidVersionStringException(@NotNull VersioningSystem versioningSystem, @NotNull String versionString) {
- super("Versioning system " + versioningSystem.getName() + " can't parse version string \"" + versionString + "\"");
- this.throwable = null;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/exception/versioning/package-info.java b/base/src/main/java/de/staropensource/engine/base/exception/versioning/package-info.java
deleted file mode 100644
index 29809525e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/exception/versioning/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Exceptions thrown by implementations of {@link de.staropensource.engine.base.implementable.VersioningSystem}s.
- *
- * @see de.staropensource.engine.base.implementable.VersioningSystem
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.exception.versioning;
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/Configuration.java b/base/src/main/java/de/staropensource/engine/base/implementable/Configuration.java
deleted file mode 100644
index dce06c037..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/Configuration.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.utility.PropertiesReader;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Properties;
-
-/**
- * Interface for implementing configuration classes.
- *
- * Configuration classes use {@link Properties} objects to modify
- * their settings as they can be supplied to the JVM's arguments
- * and can be written to and read from during runtime.
- *
- * @since v1-alpha2
- */
-public abstract class Configuration {
- /**
- * Creates and initializes an instance of this abstract class.
- *
- * @since v1-alpha2
- */
- protected Configuration() {
- // Load default configuration
- loadDefaultConfiguration();
- }
-
- /**
- * Loads all settings from the specified {@link Properties} object.
- * Unless you want to override settings, consider invoking {@link #loadDefaultConfiguration()} first.
- *
- * @param properties {@link Properties} to read from
- * @see #loadDefaultConfiguration()
- * @since v1-alpha2
- */
- public void loadConfiguration(@NotNull Properties properties) {
- PropertiesReader parser = new PropertiesReader(properties);
-
- // Loop through all properties
- for (String property : properties.stringPropertyNames()) {
- // Check if property name starts with group
- if (!property.startsWith(getGroup()))
- continue;
-
- // Remove group
- property = property.substring(getGroup().length());
-
- // Overwrite matching settings
- try {
- matchProperty(parser, property);
- } catch (NullPointerException ignored) {}
- }
-
- processSettings(parser);
- }
-
- /**
- * Loads all settings from the system properties.
- * Useful if you want to allow the user to modify settings at startup.
- *
- * @see #loadConfiguration(Properties)
- * @see System#getProperties()
- * @since v1-alpha2
- */
- public void loadConfiguration() {
- loadConfiguration(System.getProperties());
- }
-
- /**
- * Returns prefix properties must begin with.
- *
- * @return property group
- * @since v1-alpha2
- */
- public abstract @NotNull String getGroup();
-
- /**
- * Loads the default subsystem configuration.
- *
- * @see #loadConfiguration()
- * @see #loadConfiguration(Properties)
- * @since v1-alpha0
- */
- public abstract void loadDefaultConfiguration();
-
- /**
- * Matches the given {@code property} against all settings.
- * If a match has been found, the setting will be overwritten with the property's value.
- *
- * @param parser matching {@link PropertiesReader}
- * @param property property to match
- * @since v1-alpha2
- */
- protected abstract void matchProperty(@NotNull PropertiesReader parser, @NotNull String property);
-
- /**
- * Allows the implementor to process all settings and potentially
- * modify them before {@link #loadConfiguration(Properties)} returns.
- *
- * @param parser matching {@link PropertiesReader}
- * @since v1-alpha2
- */
- protected abstract void processSettings(@NotNull PropertiesReader parser);
-
- /**
- * Returns a configuration setting.
- *
- * @param setting setting name
- * @return setting's value or {@code null} if not found
- */
- public abstract @Nullable Object getSetting(@NotNull String setting);
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/Event.java b/base/src/main/java/de/staropensource/engine/base/implementable/Event.java
deleted file mode 100644
index 4fbf1d9ec..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/Event.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.annotation.EventListener;
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-
-/**
- * Represents an event.
- *
- * @see EventHelper
- * @since v1-alpha0
- */
-public interface Event {
- /**
- * Emits the event and calls all event listeners.
- *
- * @since v1-alpha0
- */
- void callEvent();
-
- /**
- * Specifies in which order {@link EventListener}s shall be called.
- *
- * @since v1-alpha9
- */
- @SuppressWarnings({ "unused" })
- enum Priority {
- /**
- * {@link EventListener}s with this
- * priority are called before all others.
- *
- * This priority is exclusive to the
- * engine and subsystems and should
- * not be used by applications.
- *
- * @since v1-alpha9
- */
- EXCLUSIVELY_IMPORTANT,
-
- /**
- * {@link EventListener}s with
- * this priority are called 2nd.
- *
- * @since v1-alpha9
- */
- VERY_IMPORTANT,
-
- /**
- * {@link EventListener}s with
- * this priority are called 3rd.
- *
- * @since v1-alpha9
- */
- IMPORTANT,
-
- /**
- * {@link EventListener}s with
- * this priority are called 4th.
- *
- * @since v1-alpha9
- */
- DEFAULT,
-
- /**
- * {@link EventListener}s with
- * this priority are called 5th.
- *
- * @since v1-alpha9
- */
- UNIMPORTANT,
-
- /**
- * {@link EventListener}s with
- * this priority are called 6th.
- *
- * @since v1-alpha9
- */
- VERY_UNIMPORTANT,
-
- /**
- * {@link EventListener}s with this
- * priority are called after all others.
- *
- * This priority is exclusive to the
- * engine and subsystems and should
- * not be used by applications.
- *
- * @since v1-alpha9
- */
- EXCLUSIVELY_UNIMPORTANT
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/EventListenerCode.java b/base/src/main/java/de/staropensource/engine/base/implementable/EventListenerCode.java
deleted file mode 100644
index c1b3e09e4..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/EventListenerCode.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.implementable.helper.EventHelper;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Used by {@link EventHelper} to execute event listeners.
- *
- * @see Runnable
- * @since v1-alpha5
- */
-public abstract class EventListenerCode {
- /**
- * Contains the priority of this
- * event listener.
- *
- * Set automatically by {@link EventHelper},
- * do not change this manually.
- *
- * @since v1-alpha5
- */
- public @NotNull Event.Priority priority = Event.Priority.DEFAULT;
-
- /**
- * Creates and initializes an instance of this abstract class.
- *
- * @since v1-alpha5
- */
- protected EventListenerCode() {}
-
- /**
- * Invokes the event listener.
- *
- * @param arguments arguments passed along by the event
- * @throws Exception exceptions thrown
- * @since v1-alpha5
- */
- public abstract void run(Object... arguments) throws Exception;
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/LoggingAdapter.java b/base/src/main/java/de/staropensource/engine/base/implementable/LoggingAdapter.java
deleted file mode 100644
index 062e8f60f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/LoggingAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Interface for implementing custom logger implementations.
- *
- * @see Logger#setLoggingAdapter(LoggingAdapter)
- * @since v1-alpha0
- */
-public interface LoggingAdapter {
- /**
- * Prints a log message.
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message raw message
- * @param format processed log call output (print this!)
- * @since v1-alpha2
- */
- void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format);
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/Placeholder.java b/base/src/main/java/de/staropensource/engine/base/implementable/Placeholder.java
deleted file mode 100644
index decaa85ce..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/Placeholder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.utility.PlaceholderEngine;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Interface for implementing placeholders.
- *
- * @see PlaceholderEngine
- * @since v1-alpha0
- */
-public interface Placeholder {
- /**
- * Replaces the placeholder with content.
- *
- * @param text text to process
- * @return processed text
- * @since v1-alpha2
- */
- @NotNull String replace(@NotNull String text);
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/ShortcodeParser.java b/base/src/main/java/de/staropensource/engine/base/implementable/ShortcodeParser.java
deleted file mode 100644
index fcf83a6d1..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/ShortcodeParser.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.exception.ParserException;
-import de.staropensource.engine.base.logging.Logger;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.LinkedList;
-import java.util.Locale;
-
-/**
- * Base class for implementing a shortcode parser.
- *
- * This class parses a string and converts it into a list of
- * components, which can then be in turn be converted to something
- * else, for example, ANSI escape codes.
- *
- * The following shortcodes are available and can be used:
- *
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public abstract class ShortcodeParser {
- /**
- * Contains a list of components the parsed text is made out of.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns a list of components the parsed text is made out of.
- *
- * @return component list
- * @since v1-alpha1
- */
- protected final @NotNull LinkedList components;
-
- /**
- * Creates and initializes an instance of this abstract class.
- *
- * @param string string to parse
- * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
- * @throws ParserException on error
- * @since v1-alpha2
- */
- protected ShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
- components = parse(string, ignoreInvalidEscapes);
- }
-
- /**
- * Parses the input string and returns a list
- * of components the text is made out of.
- *
- * @param string string to parse
- * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
- * @return list of components
- * @throws ParserException on error
- * @see EngineConfiguration#errorShortcodeParser
- * @since v1-alpha2
- */
- protected @NotNull LinkedList<@NotNull String> parse(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
- LinkedList components = new LinkedList<>(); // List of components
- boolean tagActive = false; // Indicates that a tag is being parsed
- boolean escape = false; // Indicates whether the last character was a \ character
- StringBuilder part = new StringBuilder(); // Temporary string. May be a tag, may be regular text
-
- // Iterate through every character
- for (char character : string.toCharArray()) {
- // Escaping
- if (escape) {
- if (character == '\\' || character == '<')
- part.append(character);
- else if (!(character == 'r' || character == 'n'))
- if (ignoreInvalidEscapes)
- part.append("\\").append(character);
- else
- throw new ParserException("Invalid escape \\" + character);
-
- escape = false;
- continue;
- }
- if (character == '\\') {
- escape = true;
- continue;
- }
-
- if (tagActive) {
- // A tag is being parsed
- if (character == '>') {
- // Tag is ending, disable tag parsing
- tagActive = false;
-
- // fg:*
- if (part.toString().startsWith("fg:"))
- if (isValidColor(part.substring(3).toUpperCase()))
- components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
- else {
- // Complain about invalid shortcode
- if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
- Logger.sarn("Invalid shortcode: " + part);
-
- // Convert tag regular text
- components.add("TEXT:" + "<" + part + ">");
- }
- // bg:*
- else if (part.toString().startsWith("bg:"))
- if (isValidColor(part.substring(3).toUpperCase()))
- components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
- else {
- // Complain about invalid shortcode
- if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
- Logger.sarn("Invalid shortcode: " + part);
-
- // Convert tag regular text
- components.add("TEXT:" + "<" + part + ">");
- }
- // bold
- else if (part.toString().equals("bold"))
- components.add("ATTRIBUTE:BOLD");
- // italic
- else if (part.toString().equals("italic"))
- components.add("ATTRIBUTE:ITALIC");
- // strikethrough
- else if (part.toString().equals("strikethrough"))
- components.add("ATTRIBUTE:STRIKETHROUGH");
- // underline
- else if (part.toString().equals("underline"))
- components.add("ATTRIBUTE:UNDERLINE");
- // blink
- else if (part.toString().equals("blink"))
- components.add("ATTRIBUTE:BLINK");
- // reset
- else if (part.toString().equals("reset"))
- components.add("RESET");
-
- // error case
- else {
- // Complain about invalid shortcode
- if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeParser())
- Logger.sarn("Invalid shortcode: " + part);
-
- // Convert tag regular text
- components.add("TEXT:" + "<" + part + ">");
- }
-
- // Empty 'part'
- part = new StringBuilder();
- } else
- // Tag has not ended yet, add character to 'part'
- // It bloats the code to do it with StringBuilder
- part.append(character);
- } else {
- // Regular text is being parsed
- if (character == '<') {
- if (!part.isEmpty()) {
- // Tag is starting, insert previous text
- components.add("TEXT:" + part);
- part = new StringBuilder();
- }
-
- tagActive = true; // Enable tag processing
- } else
- // Regular text, add character to 'part'
- // It bloats the code to do it with StringBuilder
- part.append(character);
- }
- }
-
- // Processing ended, insert leftover text
- if (!part.isEmpty())
- components.add("TEXT:" + part);
-
- return components;
- }
-
- /**
- * Returns if the specified color is valid
- *
- * @return {@code true} if valid, {@code false} otherwise
- * @since v1-alpha2
- */
- private boolean isValidColor(@NotNull String color) {
- return switch (color.toLowerCase(Locale.ROOT)) {
- case "black", "white", "red",
- "green", "blue", "yellow",
- "magenta", "cyan" -> true;
- default -> false;
- };
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/ShutdownHandler.java b/base/src/main/java/de/staropensource/engine/base/implementable/ShutdownHandler.java
deleted file mode 100644
index d5f1c1d1e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/ShutdownHandler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.Engine;
-import org.jetbrains.annotations.Range;
-
-/**
- * Interface for custom shutdown handlers.
- *
- * Shutdown handlers are responsible for shutting down
- * the platform safely after the engine has shut down.
- *
- * @see Engine#setShutdownHandler(ShutdownHandler)
- * @since v1-alpha2
- */
-public interface ShutdownHandler {
- /**
- * Executes the shutdown handler.
- *
- * @param exitCode exit code
- * @since v1-alpha2
- */
- void shutdown(@Range(from = 0, to = 255) short exitCode);
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/SubsystemClass.java b/base/src/main/java/de/staropensource/engine/base/implementable/SubsystemClass.java
deleted file mode 100644
index 316ef8e67..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/SubsystemClass.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.annotation.EngineSubsystem;
-import de.staropensource.engine.base.annotation.EventListener;
-import de.staropensource.engine.base.event.InternalEngineShutdownEvent;
-import de.staropensource.engine.base.type.DependencyVector;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Abstract class for building subsystem main classes.
- *
- * @see EngineSubsystem
- * @since v1-alpha0
- */
-public abstract class SubsystemClass {
- /**
- * Creates and initializes an instance of this abstract class.
- *
- * @since v1-alpha2
- */
- protected SubsystemClass() {}
-
- /**
- * Returns the name of the subsystem.
- *
- * @return subsystem name
- * @since v1-alpha2
- */
- public abstract @NotNull String getName();
-
- /**
- * Initializes the subsystem.
- *
- * @since v1-alpha1
- */
- public abstract void initializeSubsystem();
-
- /**
- * Returns a matching {@link DependencyVector}.
- * Used for dependency resolution during startup.
- *
- * @return matching {@link DependencyVector} for the subsystem
- * @throws IllegalStateException when building the DependencyVector fails, see {@link DependencyVector.Builder#build()}
- * @see DependencyVector
- * @since v1-alpha4
- */
- public abstract @NotNull DependencyVector getDependencyVector() throws IllegalStateException;
-
- /**
- * Called on engine shutdown.
- *
- * @see Engine#shutdown()
- * @see Engine#shutdown(int)
- * @since v1-alpha0
- */
- @EventListener(event = InternalEngineShutdownEvent.class)
- @SuppressWarnings({ "unused" })
- protected static void shutdownSubsystem() {}
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/VersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementable/VersioningSystem.java
deleted file mode 100644
index c7808b21b..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/VersioningSystem.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable;
-
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-/**
- * Interface for building a versioning system (parser).
- *
- * @since v1-alpha1
- */
-public interface VersioningSystem {
- /**
- * Returns the name of the versioning system.
- *
- * @return versioning system name
- * @since v1-alpha1
- */
- @NotNull String getName();
-
- /**
- * Compares a {@link VersioningSystem} with another.
- *
- * @param version {@link VersioningSystem} to compare against
- * @return {@code 0} if the supplied version is bigger, {@code 1} if equal and {@code 2} if smaller
- * @throws IncompatibleVersioningSystemException incompatible with the supplied versioning system
- * @since v1-alpha1
- */
- @Range(from = 0, to = 2)
- int compare(@NotNull VersioningSystem version) throws IncompatibleVersioningSystemException;
-
- /**
- * Returns the version string.
- *
- * @return version string
- * @since v1-alpha9
- */
- @Override
- @NotNull String toString();
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/helper/EventHelper.java b/base/src/main/java/de/staropensource/engine/base/implementable/helper/EventHelper.java
deleted file mode 100644
index 839940d40..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/helper/EventHelper.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementable.helper;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.EngineInternals;
-import de.staropensource.engine.base.annotation.EventListener;
-import de.staropensource.engine.base.event.LogEvent;
-import de.staropensource.engine.base.exception.reflection.InstanceMethodFromStaticContextException;
-import de.staropensource.engine.base.exception.reflection.InvalidMethodSignatureException;
-import de.staropensource.engine.base.exception.reflection.NoAccessException;
-import de.staropensource.engine.base.exception.reflection.StaticInitializerException;
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.EventListenerCode;
-import de.staropensource.engine.base.internal.implementation.EventListenerMethod;
-
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.utility.misc.ListFormatter;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.reflections.Reflections;
-import org.reflections.scanners.Scanners;
-import org.reflections.util.ClasspathHelper;
-import org.reflections.util.ConfigurationBuilder;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.*;
-
-/**
- * Simplifies event logging and calling.
- *
- * @since v1-alpha0
- */
-@Getter
-public final class EventHelper {
- /**
- * Holds all cached events.
- *
- * @since v1-alpha5
- */
- private static final @NotNull Map<@NotNull Class extends Event>, LinkedList<@NotNull EventListenerCode>> cachedEventListeners = new HashMap<>();
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha0
- */
- private EventHelper() {}
-
- /**
- * Registers a new {@link Event}.
- *
- * This method does nothing if classpath searching is disabled.
- *
- * @param event {@link Event} to register for
- * @param eventListener {@link EventListenerCode} to register
- * @param priority priority of the listener
- * @see EngineInternals#getReflectiveClasspathScanning()
- * @since v1-alpha5
- */
- public static synchronized void registerEvent(@NotNull Class extends Event> event, @NotNull EventListenerCode eventListener, @NotNull Event.Priority priority) {
- if (EngineInternals.getInstance().getReflectiveClasspathScanning())
- return;
-
- // Update 'eventListener' priority
- eventListener.priority = priority;
-
- // Check if event already exists in map
- // If not, create entry with a LinkedList
- if (cachedEventListeners.containsKey(event))
- if (cachedEventListeners.get(event).contains(eventListener))
- return;
- else
- cachedEventListeners.get(event).add(eventListener);
- else {
- LinkedList<@NotNull EventListenerCode> list = new LinkedList<>();
- list.add(eventListener);
- cachedEventListeners.put(event, list);
- }
-
- Logger.diag("Registered event listener " + eventListener + " for event " + event + " with priority " + priority.name());
- }
-
- /**
- * Registers a new {@link Event}.
- *
- * This method does nothing if classpath searching is disabled.
- *
- * @param event {@link Event} to register for
- * @param eventListener {@link EventListenerCode} to register
- * @see EngineInternals#getReflectiveClasspathScanning()
- * @since v1-alpha5
- */
- public static void registerEvent(@NotNull Class extends Event> event, @NotNull EventListenerCode eventListener) {
- registerEvent(event, eventListener, Event.Priority.DEFAULT);
- }
-
- /**
- * (Re-)Caches all event listeners for some {@link Event}.
- *
- * This method does nothing if classpath searching is enabled.
- *
- * @param event event to (re-)cache. Set to {@code null} to recompute all cached events
- * @see EngineInternals#getReflectiveClasspathScanning()
- * @since v1-alpha5
- */
- public static synchronized void cacheEvent(@Nullable Class extends Event> event) {
- if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
- return;
-
- if (event == null)
- for (Class extends Event> cachedEvent : cachedEventListeners.keySet())
- cacheEvent(cachedEvent);
- else {
- LinkedList<@NotNull EventListenerCode> annotatedMethods = getAnnotatedMethods(event);
-
- if (cachedEventListeners.containsKey(event))
- cachedEventListeners.replace(event, annotatedMethods);
- else
- cachedEventListeners.put(event, annotatedMethods);
- }
- }
-
- /**
- * Removes an event from the event listener cache.
- *
- * This method does nothing if classpath searching is enabled.
- *
- * @param event event to uncache. Set to {@code null} to clear the entire cache
- * @see EngineInternals#getReflectiveClasspathScanning()
- * @since v1-alpha5
- */
- public static synchronized void uncacheEvent(@Nullable Class extends Event> event) {
- if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
- return;
-
- if (event == null)
- cachedEventListeners.clear();
- else
- cachedEventListeners.remove(event);
- }
-
- /**
- * Invokes all event listeners.
- *
- * @param event event class
- * @param arguments arguments to pass to event listeners
- * @since v1-alpha5
- */
- public static void invokeAnnotatedMethods(@NotNull Class extends Event> event, Object... arguments) {
- if (event != LogEvent.class && EngineConfiguration.getInstance().isDebugEvents())
- if (arguments.length == 0)
- Logger.diag("Event " + event.getName() + " was emitted");
- else
- Logger.diag("Event " + event.getName() + " was emitted, passing arguments " + ListFormatter.formatArray(arguments));
-
- Runnable eventCode = () -> {
- for (EventListenerCode eventListener : getAnnotatedMethods(event)) {
- try {
- eventListener.run(arguments);
- } catch (NoAccessException exception) {
- Logger.warn("Event listener " + eventListener + " could not be called as the method could not be accessed");
- } catch (InvalidMethodSignatureException exception) {
- Logger.warn("Event listener " + eventListener + " has an invalid method signature");
- } catch (InvocationTargetException exception) {
- Logger.crash("Event listener " + eventListener + " threw a throwable", exception.getTargetException(), true);
- } catch (InstanceMethodFromStaticContextException exception) {
- Logger.warn("Event listener " + eventListener + " is not static. Event listener methods must be static for them to be called.");
- } catch (StaticInitializerException exception) {
- Logger.crash("Event listener " + eventListener + " could not be called as the static initializer failed", exception.getThrowable(), true);
- } catch (Exception exception) {
- Logger.crash("Event listener " + eventListener + " could not be called as an error occurred during reflection", exception, true);
- }
- }
- };
-
- if (EngineConfiguration.getInstance().isOptimizeEvents())
- Thread
- .ofVirtual()
- .name("Event " + event.getName())
- .start(eventCode);
- else
- eventCode.run();
- }
-
- /**
- * Returns all {@link EventListener}s listening on some event.
- * The classpath will be scanned for listeners, unless cached results exist and {@code !forceScanning}.
- *
- * @param event event class
- * @param forceScanning forces scanning the classpath for listeners. not recommended due to a huge performance penalty
- * @return list of event listeners
- * @see #cacheEvent(Class)
- * @since v1-alpha5
- */
- public static @NotNull LinkedList getAnnotatedMethods(@NotNull Class extends Event> event, boolean forceScanning) {
- LinkedList eventListeners = new LinkedList<>();
-
- if (!EngineInternals.getInstance().getReflectiveClasspathScanning())
- return Objects.requireNonNullElse(cachedEventListeners.get(event), eventListeners);
-
- if (forceScanning || !cachedEventListeners.containsKey(event)) {
- Reflections reflections = new Reflections(
- new ConfigurationBuilder()
- .setUrls(ClasspathHelper.forJavaClassPath())
- .setScanners(Scanners.MethodsAnnotated)
- );
-
- // Get annotated methods
- Set<@NotNull Method> annotatedMethods = reflections.getMethodsAnnotatedWith(EventListener.class);
-
- // Sort event listeners not listening for the specified event out
- for (Method method : annotatedMethods)
- if (method.getAnnotation(EventListener.class).event() == event)
- eventListeners.add(new EventListenerMethod(method));
-
- // Sort list after event priority
- eventListeners.sort(Comparator.comparing(method -> Objects.requireNonNull(((EventListenerMethod) method).getAnnotation(EventListener.class)).priority()));
- } else
- // Event listeners are cached and !forceScanning, return cached results
- eventListeners = cachedEventListeners.get(event);
-
- return eventListeners;
- }
-
- /**
- * Returns all {@link EventListener}s listening on some event.
- * The classpath will be scanned for listeners, unless cached results exist.
- *
- * @param event event class
- * @return list of event listeners
- * @since v1-alpha5
- */
- public static @NotNull LinkedList getAnnotatedMethods(@NotNull Class extends Event> event) {
- return getAnnotatedMethods(event, false);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/helper/package-info.java b/base/src/main/java/de/staropensource/engine/base/implementable/helper/package-info.java
deleted file mode 100644
index ab160bf13..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/helper/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Not necessarily interfaces or extendable classes. Rather, they
- * support implementing classes by providing useful or complex code.
- *
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.implementable.helper;
diff --git a/base/src/main/java/de/staropensource/engine/base/implementable/package-info.java b/base/src/main/java/de/staropensource/engine/base/implementable/package-info.java
deleted file mode 100644
index 5d418a027..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementable/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Interfaces and abstract classes which can be used for implementing classes.
- *
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.implementable;
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/logging/PlainLoggingAdapter.java b/base/src/main/java/de/staropensource/engine/base/implementation/logging/PlainLoggingAdapter.java
deleted file mode 100644
index f16294e63..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/logging/PlainLoggingAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.logging;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.implementable.LoggingAdapter;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import de.staropensource.engine.base.implementation.shortcode.EmptyShortcodeParser;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Prints log messages to the console, without any fancy colors or formatting.
- *
- * @see Logger
- * @see LoggingAdapter
- * @since v1-alpha1
- */
-public class PlainLoggingAdapter implements LoggingAdapter {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha1
- */
- public PlainLoggingAdapter() {}
-
- /** {@inheritDoc} */
- @Override
- public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
- format = new EmptyShortcodeParser(format, true).getClean();
- if (level == LogLevel.ERROR || level == LogLevel.CRASH)
- if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isLogForceStandardOutput())
- System.out.println(format);
- else
- System.err.println(format);
- else
- System.out.println(format);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/logging/QuietLoggingAdapter.java b/base/src/main/java/de/staropensource/engine/base/implementation/logging/QuietLoggingAdapter.java
deleted file mode 100644
index fe80cf56f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/logging/QuietLoggingAdapter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.logging;
-
-import de.staropensource.engine.base.implementable.LoggingAdapter;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * An implementation of {@link LoggingAdapter}, which does nothing.
- * Useful if you want to silence engine startup messages.
- *
- * @since v1-alpha4
- */
-public class QuietLoggingAdapter implements LoggingAdapter {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha4
- */
- public QuietLoggingAdapter() {}
-
- /** {@inheritDoc} */
- @Override
- public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {}
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/logging/RawLoggingAdapter.java b/base/src/main/java/de/staropensource/engine/base/implementation/logging/RawLoggingAdapter.java
deleted file mode 100644
index 1dbba9c9f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/logging/RawLoggingAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.logging;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.implementable.LoggingAdapter;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Prints log messages to the console, without performing any message changes.
- * Will reveal shortcodes as they will not be replaced.
- *
- * @see Logger
- * @see LoggingAdapter
- * @since v1-alpha1
- */
-public class RawLoggingAdapter implements LoggingAdapter {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha1
- */
- public RawLoggingAdapter() {}
-
- /** {@inheritDoc} */
- @Override
- public void print(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message, @NotNull String format) {
- if (level == LogLevel.ERROR || level == LogLevel.CRASH)
- if (EngineConfiguration.getInstance().isLogForceStandardOutput())
- System.out.println(format);
- else
- System.err.println(format);
- else
- System.out.println(format);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/logging/package-info.java b/base/src/main/java/de/staropensource/engine/base/implementation/logging/package-info.java
deleted file mode 100644
index ce4cc75c0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/logging/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * A set of built-in {@link de.staropensource.engine.base.implementable.LoggingAdapter}s.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.implementation.logging;
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/EmptyShortcodeParser.java b/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/EmptyShortcodeParser.java
deleted file mode 100644
index 3161b01d0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/EmptyShortcodeParser.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.shortcode;
-
-import de.staropensource.engine.base.implementable.ShortcodeParser;
-import de.staropensource.engine.base.exception.ParserException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Cleans the string of any tags.
- *
- * @see ShortcodeParser
- * @since v1-alpha8
- */
-public final class EmptyShortcodeParser extends ShortcodeParser {
- /**
- * Creates and initializes an instance of this class.
- *
- * @param string string to parse
- * @param ignoreInvalidEscapes if {@code true}, will ignore and treat invalid escapes as text
- * @throws ParserException on error
- * @since v1-alpha8
- */
- public EmptyShortcodeParser(@NotNull String string, boolean ignoreInvalidEscapes) throws ParserException {
- super(string, ignoreInvalidEscapes);
- }
-
- /**
- * Returns the parsed string without any tags.
- *
- * @return cleaned input string
- * @since v1-alpha8
- */
- public @NotNull String getClean() {
- StringBuilder output = new StringBuilder();
-
- for (String component : components)
- if (component.startsWith("TEXT:"))
- output.append(component.substring(5));
-
- return output.toString();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/package-info.java b/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/package-info.java
deleted file mode 100644
index 17b44499e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/shortcode/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Classes which convert data.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.implementation.shortcode;
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/FourNumberVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/FourNumberVersioningSystem.java
deleted file mode 100644
index 59cb8c8ab..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/FourNumberVersioningSystem.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.utility.misc.StringUtil;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-/**
- * Represents a four-numbered versioning system, where an application or work is versioning by four arbitrary numbers.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class FourNumberVersioningSystem implements VersioningSystem {
- /**
- * Contains the first number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the first number vector.
- *
- * @return first number vector
- * @since v1-alpha1
- */
- private final int number1;
-
- /**
- * Contains the second number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the second number vector.
- *
- * @return second number vector
- * @since v1-alpha1
- */
- private final int number2;
-
- /**
- * Contains the third number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the third number vector.
- *
- * @return third number vector
- * @since v1-alpha1
- */
- private final int number3;
-
- /**
- * Contains the fourth number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the fourth number vector.
- *
- * @return fourth number vector
- * @since v1-alpha1
- */
- private final int number4;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "n4";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public FourNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- String[] separatorList = new String[]{ ".", "-" };
- String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 3);
-
- // Escape separator or throw error if invalid
- switch (separator) {
- case "." -> separator = "\\.";
- case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are either three dots ('.') or hyphens ('-')");
- default -> {}
- }
-
- // Split the version string at every separator
- String[] versionStringSplit = versionString.split(separator);
-
- // Convert to integers
- try {
- this.number1 = Integer.parseUnsignedInt(versionStringSplit[0]);
- this.number2 = Integer.parseUnsignedInt(versionStringSplit[1]);
- this.number3 = Integer.parseUnsignedInt(versionStringSplit[2]);
- this.number4 = Integer.parseUnsignedInt(versionStringSplit[3]);
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
- }
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof FourNumberVersioningSystem version) {
- if (version.getNumber1() < number1)
- return 0;
- if (version.getNumber1() > number1)
- return 2;
-
- if (version.getNumber2() < number2)
- return 0;
- if (version.getNumber2() > number2)
- return 2;
-
- if (version.getNumber3() < number3)
- return 0;
- if (version.getNumber3() > number3)
- return 2;
-
- if (version.getNumber4() < number4)
- return 0;
- if (version.getNumber4() > number4)
- return 2;
-
- return 1;
-
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return number1 + "." + number2 + "." + number3 + "." + number4;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/OneNumberVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/OneNumberVersioningSystem.java
deleted file mode 100644
index 5972c9b8c..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/OneNumberVersioningSystem.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-/**
- * Represents a one-numbered versioning system, where an application or work is versioned by one arbitrary number.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class OneNumberVersioningSystem implements VersioningSystem {
- /**
- * Contains the number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the number vector.
- *
- * @return number vector
- * @since v1-alpha1
- */
- private final int number;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "n1";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public OneNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- // Convert to integers
- try {
- this.number = Integer.parseUnsignedInt(versionString);
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting the version string into an integer", exception);
- }
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof OneNumberVersioningSystem version) {
- if (version.getNumber() < number)
- return 0;
- if (version.getNumber() > number)
- return 2;
-
- return 1;
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return String.valueOf(number);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/SemanticVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/SemanticVersioningSystem.java
deleted file mode 100644
index 30d56eef9..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/SemanticVersioningSystem.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.utility.misc.StringUtil;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.Range;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Represents the semantic versioning system (version 2.0.0), where an application
- * or work is versioning by a {@code MAJOR} version, {@code MINOR} version,
- * {@code PATCH} version and optionally, a pre-release vector and a build number.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class SemanticVersioningSystem implements VersioningSystem {
- /**
- * Contains the {@code MAJOR} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code MAJOR} vector.
- *
- * @return {@code MAJOR} vector
- * @since v1-alpha1
- */
- private final int major;
-
- /**
- * Contains the {@code MINOR} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code MINOR} vector.
- *
- * @return {@code MINOR} vector
- * @since v1-alpha1
- */
- private final int minor;
-
- /**
- * Contains the {@code PATCH} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code PATCH} vector.
- *
- * @return {@code PATCH} vector
- * @since v1-alpha1
- */
- private final int patch;
-
- /**
- * Contains the {@code PRERELEASE} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code PRERELEASE} vector.
- *
- * @return {@code PRERELEASE} vector
- * @since v1-alpha1
- */
- private final @Nullable String prerelease;
-
- /**
- * Contains the {@code BUILD} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code BUILD} vector.
- *
- * @return {@code BUILD} vector
- * @since v1-alpha1
- */
- private final int build;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "Semantic";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public SemanticVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- String[] separatorList = new String[]{ "." };
- String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 2);
-
- // Escape separator or throw error if invalid
- switch (separator) {
- case "." -> separator = "\\.";
- case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are two dots ('.')");
- default -> {}
- }
-
- // Split the version string at every separator
- List versionStringSplit = new ArrayList<>(Arrays.stream(versionString.split(separator)).toList());
-
- // Get pre-release and build vectors
- String build = null;
- String prerelease = null;
- if (versionStringSplit.get(2).contains("+")) { // Build vector
- int position = versionStringSplit.get(2).indexOf("+");
- build = versionStringSplit.get(2).substring(position + 1);
- versionStringSplit.set(2, versionStringSplit.get(2).substring(0, position));
- }
- if (versionStringSplit.get(2).contains("-")) {
- int position = versionStringSplit.get(2).indexOf("-");
- prerelease = versionStringSplit.get(2).substring(position + 1);
- versionStringSplit.set(2, versionStringSplit.get(2).substring(0, position));
- }
-
- // Convert to integers
- try {
- this.major = Integer.parseUnsignedInt(versionStringSplit.get(0));
- this.minor = Integer.parseUnsignedInt(versionStringSplit.get(1));
- this.patch = Integer.parseUnsignedInt(versionStringSplit.get(2));
- this.prerelease = prerelease;
- if (build == null)
- this.build = 0;
- else
- this.build = Integer.parseUnsignedInt(build);
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
- }
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof SemanticVersioningSystem version) {
- if (version.getMajor() < major)
- return 0;
- if (version.getMajor() > major)
- return 2;
-
- if (version.getMinor() < minor)
- return 0;
- if (version.getMinor() > minor)
- return 2;
-
- if (version.getPatch() < patch)
- return 0;
- if (version.getPatch() > patch)
- return 2;
-
- if (version.getPrerelease() == null && prerelease != null)
- return 2;
- else if (version.getPrerelease() != null && prerelease == null)
- return 0;
- else if (version.getPrerelease() != null)
- switch (prerelease) {
- case "alpha" -> {
- switch (version.getPrerelease()) {
- case "beta", "releasecandidate", "release-candidate", "rc" -> {
- return 2;
- }
- }
- }
- case "beta" -> {
- switch (version.getPrerelease()) {
- case "alpha" -> {
- return 0;
- }
- case "releasecandidate", "release-candidate", "rc" -> {
- return 2;
- }
- }
- }
- case "releasecandidate", "release-candidate", "rc" -> {
- switch (version.getPrerelease()) {
- case "alpha", "beta" -> {
- return 0;
- }
- }
- }
- }
-
- if (version.getBuild() < build)
- return 0;
- if (version.getBuild() > build)
- return 2;
-
- return 1;
-
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return major + "." + minor + "." + patch + (prerelease == null ? "" : "-" + prerelease) + (build == 0 ? "" : "+" + build);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/StarOpenSourceVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/StarOpenSourceVersioningSystem.java
deleted file mode 100644
index eeb17b156..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/StarOpenSourceVersioningSystem.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.type.VersionType;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.Range;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Represents the StarOpenSource versioning
- * system version two, where an application
- * or work is versioning by the {@code RELEASE},
- * {@code TYPE}, {@code TYPERELEASE} and
- * optionally, the {@code FORK} and
- * {@code COMPANION} vectors.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class StarOpenSourceVersioningSystem implements VersioningSystem {
- /**
- * Contains the {@code RELEASE} vector.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns the {@code RELEASE} vector.
- *
- * @return {@code RELEASE} vector
- * @since v1-alpha9
- */
- private final int release;
-
- /**
- * Contains the {@code TYPE} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code TYPE} vector.
- *
- * @return {@code TYPE} vector
- * @since v1-alpha1
- */
- private final VersionType type;
-
- /**
- * Contains the {@code TYPERELEASE} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code TYPERELEASE}- vector.
- *
- * @return {@code TYPERELEASE} vector
- * @since v1-alpha1
- */
- private final int typerelease;
-
- /**
- * Contains the {@code COMPANION} vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code COMPANION} vector.
- *
- * @return {@code COMPANION} vector
- * @since v1-alpha1
- */
- private final @Nullable String companion;
-
- /**
- * Contains the FORK vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the FORK vector.
- *
- * @return FORK vector
- * @since v1-alpha1
- */
- private final String fork;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "StarOpenSource";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public StarOpenSourceVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- // Split the version string at every separator
- StringBuilder charSequence = new StringBuilder();
- /*
- * 0 = 'v'
- * 1 = release vector
- * 3 = type vector
- * 4 = typerelease vector
- * 5 = companion vector
- * 6 = fork vector
- */
- int parsingId = 0;
- List versionStringSplit = new ArrayList<>();
- String companion = null;
- String fork = null;
-
- // Iterate through all characters
- for (Character character : versionString.toCharArray()) {
- switch (parsingId) {
- case 0 -> { // 'v' character
- if (character != 'v')
- throw new InvalidVersionStringException(this, versionString, "Does not start with the character 'v'");
- parsingId++;
- }
- case 1 -> { // Version vector
- if (character == '-') {
- versionStringSplit.add(charSequence.toString());
- charSequence = new StringBuilder();
- parsingId++;
- } else
- charSequence.append(character);
- }
- case 2 -> { // Type vector
- charSequence.append(character);
-
- if (charSequence.toString().equals("alpha") || charSequence.toString().equals("beta") || charSequence.toString().equals("release")) {
- versionStringSplit.add(charSequence.toString());
- charSequence = new StringBuilder();
- parsingId++;
- } else if (versionStringSplit.size() == 2 && versionStringSplit.get(1).contains("releasec") && charSequence.toString().equals("andidate")) {
- versionStringSplit.set(1, versionStringSplit.get(1) + charSequence);
- charSequence = new StringBuilder();
- parsingId++;
- }
- }
- case 3 -> { // Typerelease vector
- if (character == '-' || character == '+') {
- versionStringSplit.add(charSequence.toString());
- charSequence = new StringBuilder();
- parsingId++;
- if (character == '+')
- parsingId++;
- } else
- if (character == 'c' && versionStringSplit.get(1).equals("release")) {
- versionStringSplit.set(1, versionStringSplit.get(1) + character);
- parsingId--;
- } else
- charSequence.append(character);
- }
- case 4 -> { // Fork vector
- if (character == '+') {
- fork = charSequence.toString();
- charSequence = new StringBuilder();
- parsingId++;
- } else
- charSequence.append(character);
- }
- case 5 -> // Companion vector
- charSequence.append(character);
- }
- }
-
- switch (parsingId) {
- case 0, 1, 2 -> throw new InvalidVersionStringException(this, versionString, "Required vectors not found");
- case 3 -> {
- if (charSequence.isEmpty())
- throw new InvalidVersionStringException(this, versionString, "Required vectors not found");
- else {
- if (versionStringSplit.size() == 2 && versionStringSplit.get(1).contains("releasec") && charSequence.toString().equals("andidate")) {
- versionStringSplit.set(1, versionStringSplit.get(1) + charSequence);
- } else
- versionStringSplit.add(charSequence.toString());
- }
- }
- case 5 -> {
- if (charSequence.isEmpty())
- throw new InvalidVersionStringException(this, versionString, "Fork vector not found");
- else
- fork = charSequence.toString();
- }
- case 6 -> {
- if (charSequence.isEmpty())
- throw new InvalidVersionStringException(this, versionString, "Companion vector not found");
- else
- companion = charSequence.toString();
- }
- }
-
- // Rewrite type
- if (versionStringSplit.get(1).equals("releasecandidate"))
- versionStringSplit.set(1, "RELEASE_CANDIDATE");
- else
- versionStringSplit.set(1, versionStringSplit.get(1).toUpperCase(Locale.ROOT));
-
-
- // Update variables
- try {
- this.release = Integer.parseUnsignedInt(versionStringSplit.get(0));
- this.type = VersionType.valueOf(versionStringSplit.get(1));
- this.typerelease = Integer.parseUnsignedInt(versionStringSplit.get(2));
- this.companion = companion;
- this.fork = fork;
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
- }
-
- if (this.release == 0)
- throw new InvalidVersionStringException(this, versionString, "The version vector must start at 1");
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof StarOpenSourceVersioningSystem versionCompare) {
- if (versionCompare.getRelease() < this.release)
- return 0;
- if (versionCompare.getRelease() > this.release)
- return 2;
-
- if (type.compareTo(versionCompare.getType()) > 0)
- return 0;
- if (type.compareTo(versionCompare.getType()) < 0)
- return 2;
-
- if (versionCompare.getTyperelease() < typerelease)
- return 0;
- if (versionCompare.getTyperelease() > typerelease)
- return 2;
-
- return 1;
-
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return "v" + release + "-" + type.name().toLowerCase(Locale.ROOT) + typerelease + (fork == null ? "" : "-" + fork) + (companion == null ? "" : "+" + companion);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/ThreeNumberVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/ThreeNumberVersioningSystem.java
deleted file mode 100644
index e92c4c654..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/ThreeNumberVersioningSystem.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.utility.misc.StringUtil;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-/**
- * Represents a three-numbered versioning system, where an application or work is versioning by three arbitrary numbers.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class ThreeNumberVersioningSystem implements VersioningSystem {
- /**
- * Contains the first number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the first number vector.
- *
- * @return first number vector
- * @since v1-alpha1
- */
- private final int number1;
-
- /**
- * Contains the second number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the second number vector.
- *
- * @return second number vector
- * @since v1-alpha1
- */
- private final int number2;
-
- /**
- * Contains the third number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the third number vector.
- *
- * @return third number vector
- * @since v1-alpha1
- */
- private final int number3;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "n3";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public ThreeNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- String[] separatorList = new String[]{ ".", "-" };
- String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 2);
-
- // Escape separator or throw error if invalid
- switch (separator) {
- case "." -> separator = "\\.";
- case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are either two dots ('.') or hyphens ('-')");
- default -> {}
- }
-
- // Split the version string at every separator
- String[] versionStringSplit = versionString.split(separator);
-
- // Convert to integers
- try {
- this.number1 = Integer.parseUnsignedInt(versionStringSplit[0]);
- this.number2 = Integer.parseUnsignedInt(versionStringSplit[1]);
- this.number3 = Integer.parseUnsignedInt(versionStringSplit[2]);
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
- }
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof ThreeNumberVersioningSystem version) {
- if (version.getNumber1() < number1)
- return 0;
- if (version.getNumber1() > number1)
- return 2;
-
- if (version.getNumber2() < number2)
- return 0;
- if (version.getNumber2() > number2)
- return 2;
-
- if (version.getNumber3() < number3)
- return 0;
- if (version.getNumber3() > number3)
- return 2;
-
- return 1;
-
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return number1 + "." + number2 + "." + number3;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/TwoNumberVersioningSystem.java b/base/src/main/java/de/staropensource/engine/base/implementation/versioning/TwoNumberVersioningSystem.java
deleted file mode 100644
index 1ab750279..000000000
--- a/base/src/main/java/de/staropensource/engine/base/implementation/versioning/TwoNumberVersioningSystem.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.implementation.versioning;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.IncompatibleVersioningSystemException;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.utility.misc.StringUtil;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-/**
- * Represents a two-numbered versioning system, where an application or work is versioning by two arbitrary numbers.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class TwoNumberVersioningSystem implements VersioningSystem {
- /**
- * Contains the first number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the first number vector.
- *
- * @return first number vector
- * @since v1-alpha1
- */
- private final int number1;
-
- /**
- * Contains the second number vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the second number vector.
- *
- * @return second number vector
- * @since v1-alpha1
- */
- private final int number2;
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String getName() {
- return "n2";
- }
-
- /**
- * Tries to parse the specified version string
- * and if successful, return a new instance.
- *
- * @param versionString version string to parse
- * @throws InvalidVersionStringException if the version string is invalid
- */
- public TwoNumberVersioningSystem(@NotNull String versionString) throws InvalidVersionStringException {
- String[] separatorList = new String[]{ ".", "-" };
- String separator = StringUtil.getSeparatorRequired(versionString, separatorList, 1);
-
- // Escape separator or throw error if invalid
- switch (separator) {
- case "." -> separator = "\\.";
- case null -> throw new InvalidVersionStringException(this, versionString, "No matching separator could be found. Required are either one dot ('.') or hyphen ('-')");
- default -> {}
- }
-
- // Split the version string at every separator
- String[] versionStringSplit = versionString.split(separator);
-
- // Convert to integers
- try {
- this.number1 = Integer.parseUnsignedInt(versionStringSplit[0]);
- this.number2 = Integer.parseUnsignedInt(versionStringSplit[1]);
- } catch (NumberFormatException exception) {
- throw new InvalidVersionStringException(this, versionString, "Failed converting one of the vectors to an integer", exception);
- }
- }
-
- /** {@inheritDoc} */
- @Range(from = 0, to = 2)
- @Override
- public int compare(@NotNull VersioningSystem versionInterface) throws IncompatibleVersioningSystemException {
- if (versionInterface instanceof TwoNumberVersioningSystem version) {
- if (version.getNumber1() < number1)
- return 0;
- if (version.getNumber1() > number1)
- return 2;
-
- if (version.getNumber2() < number2)
- return 0;
- if (version.getNumber2() > number2)
- return 2;
-
- return 1;
-
- } else
- throw new IncompatibleVersioningSystemException(this, versionInterface);
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String toString() {
- return number1 + "." + number2;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/EventListenerMethod.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/EventListenerMethod.java
deleted file mode 100644
index 0ae711b29..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/EventListenerMethod.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation;
-
-import de.staropensource.engine.base.implementable.EventListenerCode;
-import de.staropensource.engine.base.reflection.Reflect;
-import de.staropensource.engine.base.reflection.ReflectionMethod;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-/**
- * Interface specifically for executing event listener methods.
- *
- * @since v1-alpha5
- */
-public final class EventListenerMethod extends EventListenerCode {
- /**
- * Contains the method to call and get.
- *
- * @since v1-alpha5
- */
- private final @NotNull ReflectionMethod method;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param method method to execute
- * @since v1-alpha5
- */
- public EventListenerMethod(@NotNull Method method) {
- this.method = Reflect.reflectOn(method);
- }
-
- /** {@inheritDoc} */
- @Override
- public void run(@Nullable Object @NotNull [] arguments) throws Exception {
- method.invoke(arguments);
- }
-
- /**
- * Forwards {@link ReflectionMethod#getAnnotation(Class)}
- * to the internal {@link ReflectionMethod} instance.
- *
- * @param annotation
- * @param annotation annotation to get
- * @return annotation or {@code null} on error
- * @see ReflectionMethod#getAnnotation(Class)
- * @since v1-alpha5
- */
- public @Nullable T getAnnotation(@NotNull Class annotation) {
- try {
- return method.getAnnotation(annotation);
- } catch (NullPointerException exception) {
- return null;
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return "method " + method.getMethod().getDeclaringClass().getName() + "#" + method.getName();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/package-info.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/package-info.java
deleted file mode 100644
index 661eef789..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Interfaces and abstract classes which can be used for implementing classes.
- *
- * @since v1-alpha5
- */
-package de.staropensource.engine.base.internal.implementation;
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateDay.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateDay.java
deleted file mode 100644
index f6bc34215..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateDay.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code date_day} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class DateDay implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public DateDay() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%date_day%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateMonth.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateMonth.java
deleted file mode 100644
index 7c1049b5d..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateMonth.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code date_month} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class DateMonth implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public DateMonth() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%date_month%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateYear.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateYear.java
deleted file mode 100644
index 290f18fa8..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/DateYear.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code date_year} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class DateYear implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public DateYear() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%date_year%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyJansi.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyJansi.java
deleted file mode 100644
index 5d2d3ec98..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyJansi.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_dependency_jansi} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineDependencyJansi implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineDependencyJansi() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_dependency_jansi%", EngineInformation.getDependencyJansi());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyLwjgl.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyLwjgl.java
deleted file mode 100644
index fce4cfbcd..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyLwjgl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_dependency_lwjgl} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineDependencyLwjgl implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineDependencyLwjgl() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_dependency_lwjgl%", EngineInformation.getDependencyLwjgl());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyReflections.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyReflections.java
deleted file mode 100644
index 5ad768be9..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencyReflections.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_dependency_reflections} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineDependencyReflections implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineDependencyReflections() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_dependency_reflections%", EngineInformation.getDependencyReflections());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencySlf4j.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencySlf4j.java
deleted file mode 100644
index 76b94c768..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineDependencySlf4j.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_dependency_slf4j} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineDependencySlf4j implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineDependencySlf4j() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_dependency_slf4j%", EngineInformation.getDependencySlf4j());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitBranch.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitBranch.java
deleted file mode 100644
index 30333dc31..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitBranch.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_branch} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitBranch implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitBranch() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_branch%", EngineInformation.getGitBranch());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitHeader.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitHeader.java
deleted file mode 100644
index d7ab4e084..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitHeader.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_header} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitHeader implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitHeader() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_header%", EngineInformation.getGitCommitHeader());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdLong.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdLong.java
deleted file mode 100644
index 84e378b62..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdLong.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_id_long} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitIdLong implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitIdLong() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_id_long%", EngineInformation.getGitCommitIdentifierLong());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdShort.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdShort.java
deleted file mode 100644
index b7afd8303..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitIdShort.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_id_short} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitIdShort implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitIdShort() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_id_short%", EngineInformation.getGitCommitIdentifierShort());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeDay.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeDay.java
deleted file mode 100644
index 084311fbb..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeDay.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_day} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeDay implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeDay() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_day%", String.valueOf(EngineInformation.getGitCommitTime().getDayOfMonth()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeHour.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeHour.java
deleted file mode 100644
index 75e19af9a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeHour.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_hour} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeHour implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeHour() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_hour%", String.valueOf(EngineInformation.getGitCommitTime().getHour()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMinute.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMinute.java
deleted file mode 100644
index f0ec3149c..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMinute.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_minute} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeMinute implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeMinute() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_minute%", String.valueOf(EngineInformation.getGitCommitTime().getMinute()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMonth.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMonth.java
deleted file mode 100644
index 8cb1ad4d6..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeMonth.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_month} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeMonth implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeMonth() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_month%", String.valueOf(EngineInformation.getGitCommitTime().getMonth()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeSecond.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeSecond.java
deleted file mode 100644
index 6c39f0d96..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeSecond.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_second} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeSecond implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeSecond() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_second%", String.valueOf(EngineInformation.getGitCommitTime().getSecond()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeYear.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeYear.java
deleted file mode 100644
index 1ababba40..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitTimeYear.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commit_time_year} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitTimeYear implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitTimeYear() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commit_time_year%", String.valueOf(EngineInformation.getGitCommitTime().getYear()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommits.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommits.java
deleted file mode 100644
index 2ae07cd24..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommits.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_commits} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommits implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommits() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_commits%", String.valueOf(EngineInformation.getGitCommitCount()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterEmail.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterEmail.java
deleted file mode 100644
index 3ccc28044..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterEmail.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_committer_email} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitterEmail implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitterEmail() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_committer_email%", EngineInformation.getGitCommitterEmail());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterName.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterName.java
deleted file mode 100644
index ffa57c3cc..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitCommitterName.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_committer_name} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitCommitterName implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitCommitterName() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_committer_name%", EngineInformation.getGitCommitterName());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitDirty.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitDirty.java
deleted file mode 100644
index 664fd9512..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineGitDirty.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_git_dirty} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineGitDirty implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineGitDirty() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_git_dirty%", String.valueOf(EngineInformation.isGitDirty()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersion.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersion.java
deleted file mode 100644
index 9caf29e8a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersion.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_version} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineVersion implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineVersion() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_version%", "v%engine_version_version%-%engine_version_type%%engine_version_typerelease%%engine_version_fork%");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionCodename.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionCodename.java
deleted file mode 100644
index 933fb435c..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionCodename.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_version_codename} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha8
- */
-@SuppressWarnings({ "unused" })
-public final class EngineVersionCodename implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha8
- */
- public EngineVersionCodename() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_version_codename%", EngineInformation.getVersioningCodename());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionType.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionType.java
deleted file mode 100644
index ae61aa345..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_version_type} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineVersionType implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineVersionType() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_version_type%", EngineInformation.getVersioningType().name().toLowerCase());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionTyperelease.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionTyperelease.java
deleted file mode 100644
index 98e355553..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionTyperelease.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_version_typerelease} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineVersionTyperelease implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineVersionTyperelease() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_version_typerelease%", String.valueOf(EngineInformation.getVersioningTyperelease()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionVersion.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionVersion.java
deleted file mode 100644
index 5b7f91dc5..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/EngineVersionVersion.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code engine_version_version} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class EngineVersionVersion implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public EngineVersionVersion() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%engine_version_version%", String.valueOf(EngineInformation.getVersioningVersion()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmArguments.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmArguments.java
deleted file mode 100644
index 57bc57be1..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmArguments.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code jvm_arguments} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmArguments implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public JvmArguments() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- StringBuilder arguments = new StringBuilder();
-
- for (String argument : JvmInformation.getArguments()) {
- if (!arguments.isEmpty())
- arguments.append(" ");
-
- arguments
- .append("\"")
- .append(
- argument
- .replace("\\", "\\\\")
- .replace("\n", "\\n")
- .replace("\"", "\\\"")
- )
- .append("\"");
- }
-
- return text.replace("%jvm_arguments%", arguments.toString());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationName.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationName.java
deleted file mode 100644
index 1cbf832ea..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationName.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code jvm_implementation_name} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmImplementationName implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public JvmImplementationName() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%jvm_implementation_name%", JvmInformation.getImplementationName());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVendor.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVendor.java
deleted file mode 100644
index 9f9c25316..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVendor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code jvm_implementation_vendor} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmImplementationVendor implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public JvmImplementationVendor() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%jvm_implementation_vendor%", JvmInformation.getImplementationVendor());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVersion.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVersion.java
deleted file mode 100644
index 64efe6a2b..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmImplementationVersion.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code jvm_implementation_version} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmImplementationVersion implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public JvmImplementationVersion() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%jvm_implementation_version%", JvmInformation.getImplementationVersion());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmUptime.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmUptime.java
deleted file mode 100644
index f9b0d3fb0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/JvmUptime.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code jvm_uptime} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmUptime implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public JvmUptime() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%jvm_uptime%", String.valueOf(JvmInformation.getUptime()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeEpoch.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeEpoch.java
deleted file mode 100644
index 4ea10bbb2..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeEpoch.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implements the {@code time_epoch} placeholder.
- *
- * @see Placeholder
- *
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class TimeEpoch implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public TimeEpoch() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%time_epoch%", NumberUtil.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length()));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeHour.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeHour.java
deleted file mode 100644
index e03927482..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeHour.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code time_hour} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class TimeHour implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public TimeHour() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%time_hour%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeMinute.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeMinute.java
deleted file mode 100644
index 859fb0ec3..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeMinute.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code time_minute} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class TimeMinute implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public TimeMinute() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%time_minute%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeSecond.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeSecond.java
deleted file mode 100644
index d1729d152..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeSecond.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Implements the {@code time_second} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class TimeSecond implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public TimeSecond() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%time_second%", NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeZone.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeZone.java
deleted file mode 100644
index 5a7a3d446..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/TimeZone.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.implementation.placeholder;
-
-import de.staropensource.engine.base.implementable.Placeholder;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Locale;
-
-/**
- * Implements the {@code time_zone} placeholder.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class TimeZone implements Placeholder {
- /**
- * Creates and initializes an instance of this event.
- *
- * @since v1-alpha0
- */
- public TimeZone() {}
-
- /** {@inheritDoc} */
- @Override
- public @NotNull String replace(@NotNull String text) {
- return text.replace("%time_zone%", java.util.TimeZone.getDefault().getDisplayName(false, java.util.TimeZone.SHORT, Locale.US));
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/package-info.java b/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/package-info.java
deleted file mode 100644
index b69a0a227..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/implementation/placeholder/package-info.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Built-in placeholders for various things.
- *
- * Placeholder classes in subpackages may only be targeted for
- * specific use cases.
- *
- * @see de.staropensource.engine.base.utility.PlaceholderEngine
- * @see de.staropensource.engine.base.implementable.Placeholder
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.internal.implementation.placeholder;
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/package-info.java b/base/src/main/java/de/staropensource/engine/base/internal/package-info.java
deleted file mode 100644
index ca4569f13..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Engine-internal stuff, not part of the API.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.internal;
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/reflection/ReflectionAccessWidener.java b/base/src/main/java/de/staropensource/engine/base/internal/reflection/ReflectionAccessWidener.java
deleted file mode 100644
index a5fcab473..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/reflection/ReflectionAccessWidener.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.reflection;
-
-import de.staropensource.engine.base.exception.reflection.NoAccessException;
-import de.staropensource.engine.base.reflection.ReflectionField;
-import de.staropensource.engine.base.reflection.ReflectionMethod;
-
-import java.lang.reflect.*;
-
-/**
- * Utility class for widening access permissions on reflection objects.
- *
- * @since v1-alpha2
- */
-public final class ReflectionAccessWidener {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha2
- */
- private ReflectionAccessWidener() {}
-
- /**
- * Allows access to an {@link AccessibleObject}.
- *
- * Stolen from the jOOR library.
- * All credits to them.
- *
- * @param extender of {@link AccessibleObject}
- * @param accessible object to allow access to
- */
- public static void allowAccess(T accessible) {
- if (accessible == null)
- return;
-
- if (accessible instanceof Member member)
- if (Modifier.isPublic(member.getModifiers()) && Modifier.isPublic(member.getDeclaringClass().getModifiers()))
- return;
-
- //noinspection deprecation // no, it's what we want
- if (!accessible.isAccessible())
- accessible.setAccessible(true);
- }
-
- /**
- * Unlocks modifications to some field.
- *
- * @param reflectionField {@link ReflectionField} to unlock
- * @return updated modifiers. pass those to {@link #lockModifications(ReflectionField, int)} to lock the field again
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the field has been denied
- * @see #lockModifications(ReflectionField, int)
- * @since v1-alpha2
- */
- public static int unlockModifications(ReflectionField reflectionField) throws NoSuchFieldException, NoAccessException {
- int updatedModifiers = 0;
- Field field = reflectionField.getField();
-
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- modifiersField.setAccessible(true);
-
- if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL)
- updatedModifiers = ~Modifier.FINAL;
- if ((field.getModifiers() & Modifier.STATIC) == Modifier.STATIC)
- updatedModifiers = updatedModifiers & ~Modifier.STATIC;
-
- try {
- modifiersField.setInt(field, field.getModifiers() & ~updatedModifiers);
- } catch (IllegalAccessException exception) {
- throw new NoAccessException("field", field.getName());
- }
-
- return updatedModifiers;
- }
-
- /**
- * Unlocks modifications to some method.
- *
- * @param reflectionMethod {@link ReflectionMethod} to unlock
- * @return updated modifiers. pass those to {@link #lockModifications(ReflectionMethod, int)} to lock the method again
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the method has been denied
- * @see #lockModifications(ReflectionMethod, int)
- * @since v1-alpha2
- */
- public static int unlockModifications(ReflectionMethod reflectionMethod) throws NoSuchFieldException, NoAccessException {
- Method method = reflectionMethod.getMethod();
- int updatedModifiers = method.getModifiers();
-
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- modifiersField.setAccessible(true);
-
- if (Modifier.isFinal(method.getModifiers()))
- updatedModifiers = ~Modifier.FINAL;
- if (Modifier.isStatic(method.getModifiers()))
- updatedModifiers = updatedModifiers & ~Modifier.STATIC;
- if (!Modifier.isPublic(method.getModifiers())) {
- if (Modifier.isProtected(method.getModifiers()))
- updatedModifiers = updatedModifiers & ~Modifier.PROTECTED;
- if (Modifier.isPrivate(method.getModifiers()))
- updatedModifiers = updatedModifiers & ~Modifier.PRIVATE;
-
- updatedModifiers = updatedModifiers & ~Modifier.PUBLIC;
- }
- try {
- modifiersField.setInt(method, method.getModifiers() & ~updatedModifiers);
- } catch (IllegalAccessException exception) {
- throw new NoAccessException("method", method.getName());
- }
-
- return updatedModifiers;
- }
-
- /**
- * Locks modifications to some field.
- *
- * @param reflectionField {@link ReflectionField} to lock
- * @param updatedModifiers original modifiers
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the field has been denied
- * @see #unlockModifications(ReflectionField)
- * @since v1-alpha2
- */
- public static void lockModifications(ReflectionField reflectionField, int updatedModifiers) throws NoSuchFieldException, NoAccessException {
- Field field = reflectionField.getField();
-
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- modifiersField.setAccessible(true);
-
- try {
- modifiersField.setInt(field, field.getModifiers() & ~updatedModifiers);
- } catch (IllegalAccessException exception) {
- throw new NoAccessException("field", field.getName());
- }
-
- modifiersField.setAccessible(false);
- }
-
- /**
- * Locks modifications to some method.
- *
- * @param reflectionMethod {@link ReflectionMethod} to lock
- * @param updatedModifiers original modifiers
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the method has been denied
- * @see #unlockModifications(ReflectionMethod)
- * @since v1-alpha2
- */
- public static void lockModifications(ReflectionMethod reflectionMethod, int updatedModifiers) throws NoSuchFieldException, NoAccessException {
- Method method = reflectionMethod.getMethod();
-
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- modifiersField.setAccessible(true);
-
- try {
- modifiersField.setInt(method, method.getModifiers() & ~updatedModifiers);
- } catch (IllegalAccessException exception) {
- throw new NoAccessException("method", method.getName());
- }
-
- modifiersField.setAccessible(false);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/reflection/package-info.java b/base/src/main/java/de/staropensource/engine/base/internal/reflection/package-info.java
deleted file mode 100644
index 73bcdbc06..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/reflection/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Utility classes used during reflection.
- *
- * @see de.staropensource.engine.base.reflection.Reflect
- * @since v1-alpha2
- */
-package de.staropensource.engine.base.internal.reflection;
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/type/DependencySubsystemVector.java b/base/src/main/java/de/staropensource/engine/base/internal/type/DependencySubsystemVector.java
deleted file mode 100644
index f69e7870e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/type/DependencySubsystemVector.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.type;
-
-import de.staropensource.engine.base.implementable.SubsystemClass;
-import de.staropensource.engine.base.type.DependencyVector;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a dependency vector with an additional {@code mainClass} field.
- * Used during the subsystem initialization process to easily determine the
- * initialization order without much extra code and performance loss.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class DependencySubsystemVector extends DependencyVector {
- /**
- * Contains the associated {@link SubsystemClass}.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the associated {@link SubsystemClass}.
- *
- * @return associated {@link SubsystemClass}
- * @since v1-alpha1
- */
- private final SubsystemClass subsystemClass;
-
- /**
- * Creates and initializes an instance of this class.
- * Reuses an existing {@link DependencyVector}.
- *
- * @param vector existing dependency vector to reuse
- * @param subsystemClass {@link SubsystemClass} to associate
- * @since v1-alpha1
- */
- public DependencySubsystemVector(@NotNull DependencyVector vector, @NotNull SubsystemClass subsystemClass) {
- super(subsystemClass.getName(), vector.getVersioningSystem(), vector.getVersion(), vector.getDependencies(), vector.getProvides());
- this.subsystemClass = subsystemClass;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/type/QueuedLogCall.java b/base/src/main/java/de/staropensource/engine/base/internal/type/QueuedLogCall.java
deleted file mode 100644
index 1b6697e30..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/type/QueuedLogCall.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.internal.type;
-
-import de.staropensource.engine.base.logging.backend.async.LoggingThread;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a queued log call.
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @see LoggingThread
- * @since v1-alpha8
- */
-@SuppressWarnings({ "unused" })
-public record QueuedLogCall(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message) {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha8
- */
- public QueuedLogCall {}
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/internal/type/package-info.java b/base/src/main/java/de/staropensource/engine/base/internal/type/package-info.java
deleted file mode 100644
index 3004e5e36..000000000
--- a/base/src/main/java/de/staropensource/engine/base/internal/type/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Engine-internal data types, usually for passing
- * data around classes more efficiently.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.internal.type;
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/Logger.java b/base/src/main/java/de/staropensource/engine/base/logging/Logger.java
deleted file mode 100644
index 80a7e7dff..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/Logger.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging;
-
-import de.staropensource.engine.base.implementable.LoggingAdapter;
-import de.staropensource.engine.base.implementation.logging.PlainLoggingAdapter;
-import de.staropensource.engine.base.logging.backend.CrashHandler;
-import de.staropensource.engine.base.logging.backend.Filterer;
-import de.staropensource.engine.base.logging.backend.Processor;
-import de.staropensource.engine.base.logging.backend.async.LoggingQueue;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import lombok.Getter;
-import lombok.Setter;
-import org.intellij.lang.annotations.RegExp;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * The frontend class for sos!engine's logging system.
- *
- * @since v1-alpha8
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Logger {
- /**
- * Refers to the active {@link LoggingAdapter} that is used to process and print log messages.
- *
- * @see LoggingAdapter
- * @since v1-alpha0
- * -- GETTER --
- * Returns the active {@link LoggingAdapter}.
- *
- * @return active {@link LoggingAdapter}
- * @see LoggingAdapter
- * @since v1-alpha0
- * -- SETTER --
- * Sets the active {@link LoggingAdapter}.
- *
- * @param loggingAdapter new active {@link LoggingAdapter}
- * @see LoggingAdapter
- * @since v1-alpha0
- */
- @Getter
- @Setter
- private static @NotNull LoggingAdapter loggingAdapter = new PlainLoggingAdapter();
-
- /**
- * Contains if messages shall be
- * sanitized during processing.
- *
- * Enabling this flag will prevent
- * tag usage and with that formatting.
- *
- * Recommended to leave enabled. Only
- * disable if you are developing a
- * command line application.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns if messages shall be
- * sanitized during processing.
- *
- * Enabling this flag will prevent
- * tag usage and with that formatting.
- *
- * Recommended to leave enabled. Only
- * disable if you are developing a
- * command line application.
- *
- * @return sanitize messages?
- * @since v1-alpha0
- * -- SETTER --
- * Sets if messages shall be
- * sanitized during processing.
- *
- * Enabling this flag will prevent
- * tag usage and with that formatting.
- *
- * Recommended to leave enabled. Only
- * disable if you are developing a
- * command line application.
- *
- * @param sanitizeMessages sanitize messages?
- * @since v1-alpha0
- */
- @Getter
- @Setter
- private static boolean sanitizeMessages = true;
-
- /**
- * Creates and initializes an instance of this class
- *
- * @since v1-alpha8
- */
- private Logger() {}
-
- // -----> Internal management methods
- // These methods forward calls to internal methods so
- // these can be accessed without exporting a whole package.
- /**
- * Handles incoming log calls and either
- * processes them directly or queues them in.
- *
- * **This is an internal method. Use with care.**
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @since v1-alpha8
- */
- public static void handle(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message) {
- Processor.handle(level, issuer, message);
- }
-
- /**
- * Flushes the logging queue.
- *
- * **This is an internal method. Use with care.**
- *
- * @since v1-alpha8
- */
- public static void flush() {
- LoggingQueue.flush();
- }
-
- /**
- * Disallows one or multiple classes.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowClass(@RegExp @NotNull String regex) {
- Filterer.disallowClass(regex);
- }
-
- /**
- * Disallows one or multiple modules.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowModule(@RegExp @NotNull String regex) {
- Filterer.disallowModule(regex);
- }
-
- /**
- * Disallows one or multiple messages.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowMessage(@RegExp @NotNull String regex) {
- Filterer.disallowMessage(regex);
- }
-
-
- // -----> Redirection methods
- /**
- * Redirects regular log messages.
- *
- * @param level level of the log call
- * @param message message
- * @since v1-alpha8
- */
- public static void redirectCall(@NotNull LogLevel level, @NotNull String message) {
- Processor.handle(level, Thread.currentThread().getStackTrace()[3], message);
- }
-
- /**
- * Redirects crash calls.
- *
- * @param message message
- * @param throwable {@link Throwable} which caused the error
- * @param fatal if to terminate the engine
- * @since v1-alpha8
- */
- public static void redirectCall(@NotNull String message, @Nullable Throwable throwable, boolean fatal) {
- CrashHandler.handleCrash(Thread.currentThread().getStackTrace()[3], message, throwable, fatal);
- }
-
-
- // -----> Frontend methods
- /**
- * Logs a diagnostic message.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void diag(@NotNull String message) {
- redirectCall(LogLevel.DIAGNOSTIC, message);
- }
-
- /**
- * Logs a verbose message.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void verb(@NotNull String message) {
- redirectCall(LogLevel.VERBOSE, message);
- }
-
- /**
- * Logs a silent warning.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void sarn(@NotNull String message) {
- redirectCall(LogLevel.SILENT_WARNING, message);
- }
-
- /**
- * Logs an informational message.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void info(@NotNull String message) {
- redirectCall(LogLevel.INFORMATIONAL, message);
- }
-
- /**
- * Logs a warning.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void warn(@NotNull String message) {
- redirectCall(LogLevel.WARNING, message);
- }
-
- /**
- * Logs an error.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void error(@NotNull String message) {
- redirectCall(LogLevel.ERROR, message);
- }
-
- /**
- * Prints a crash report and optionally crashes the engine.
- *
- * @param message message to log
- * @param throwable {@link Throwable} which caused the crash
- * @param fatal terminates the engine if {@code true}
- * @since v1-alpha8
- */
- public static void crash(@NotNull String message, @NotNull Throwable throwable, boolean fatal) {
- redirectCall(message, throwable, fatal);
- }
-
- /**
- * Prints a crash report and optionally crashes the engine.
- *
- * @param message message to log
- * @param throwable {@link Throwable} which caused the crash
- * @since v1-alpha8
- */
- public static void crash(@NotNull String message, @NotNull Throwable throwable) {
- redirectCall(message, throwable, true);
- }
-
- /**
- * Prints a crash report and optionally crashes the engine.
- *
- * @param message message to log
- * @param fatal terminates the engine if {@code true}
- * @since v1-alpha8
- */
- public static void crash(@NotNull String message, boolean fatal) {
- redirectCall(message, null, fatal);
- }
-
- /**
- * Prints a crash report and optionally crashes the engine.
- *
- * @param message message to log
- * @since v1-alpha8
- */
- public static void crash(@NotNull String message) {
- redirectCall(message, null, true);
- }
-
-
- // -----> Legacy frontend methods
- // This improves compatibility with old code
- // still using the old logger frontend.
- /**
- * Prints a diagnostic message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #diag(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void diag(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.DIAGNOSTIC, message);
- }
-
- /**
- * Prints a verbose message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #verb(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void verb(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.VERBOSE, message);
- }
-
- /**
- * Prints a silent warning message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #sarn(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void sarn(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.SILENT_WARNING, message);
- }
-
- /**
- * Prints an informational message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #info(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void info(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.INFORMATIONAL, message);
- }
-
- /**
- * Prints a warning message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #warn(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void warn(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.WARNING, message);
- }
-
- /**
- * Prints an error message.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #error(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void error(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(LogLevel.ERROR, message);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @param throwable the throwable that caused this crash
- * @param handled declares the throwable has handled, not causing the engine to shutdown
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #crash(String, Throwable, boolean)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void crash(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message, @NotNull Throwable throwable, boolean handled) {
- redirectCall(message, throwable, !handled);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @param throwable the throwable that caused this crash
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #crash(String, Throwable)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void crash(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message, @NotNull Throwable throwable) {
- redirectCall(message, throwable, true);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param ignoredIssuerClass class of the issuer
- * @param ignoredIssuerOrigin origin of the issuer
- * @param ignoredIssuerMetadata metadata about the issuer
- * @param message message
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see #crash(String)
- * @since v1-alpha0
- */
- @Deprecated(forRemoval = true)
- public static void crash(@NotNull Class> ignoredIssuerClass, @NotNull String ignoredIssuerOrigin, @Nullable String ignoredIssuerMetadata, @NotNull String message) {
- redirectCall(message, null, true);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/LoggerInstance.java b/base/src/main/java/de/staropensource/engine/base/logging/LoggerInstance.java
deleted file mode 100644
index a3d35c856..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/LoggerInstance.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging;
-
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Legacy frontend.
- *
- * This improves compatibility with old code
- * still using the old logger frontend.
- *
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see Logger
- * @since v1-alpha8
- */
-@Getter
-@Deprecated(forRemoval = true)
-public final class LoggerInstance {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha8
- */
- private LoggerInstance() {}
-
- /**
- * Prints a diagnostic message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void diag(@NotNull String message) {
- Logger.diag(message);
- }
-
- /**
- * Prints a verbose message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void verb(@NotNull String message) {
- Logger.verb(message);
- }
-
- /**
- * Prints a silent warning message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void sarn(@NotNull String message) {
- Logger.sarn(message);
- }
-
- /**
- * Prints an informational message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void info(@NotNull String message) {
- Logger.info(message);
- }
-
- /**
- * Prints a warning message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void warn(@NotNull String message) {
- Logger.warn(message);
- }
-
- /**
- * Prints an error message.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void error(@NotNull String message) {
- Logger.error(message);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param message message
- * @param throwable throwable that caused the crash
- * @param handled declares the throwable has handled
- * @since v1-alpha0
- */
- public void crash(@NotNull String message, @NotNull Throwable throwable, boolean handled) {
- Logger.crash(message, throwable, !handled);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param message message
- * @param throwable throwable that caused the crash
- * @since v1-alpha0
- */
- public void crash(@NotNull String message, @NotNull Throwable throwable) {
- Logger.crash(message, throwable);
- }
-
- /**
- * Crashes the entire engine.
- *
- * @param message message
- * @since v1-alpha0
- */
- public void crash(@NotNull String message) {
- Logger.crash(message);
- }
-
- /**
- * Provides an API for building {@link LoggerInstance}s more easily.
- *
- * @deprecated The old logging system has been deprecated and replaced by a new one
- * @see Logger
- * @since v1-alpha8
- */
- @Deprecated(forRemoval = true)
- @SuppressWarnings({ "unused" })
- public static final class Builder {
- /**
- * Contains the class of the issuer.
- *
- * @since v1-alpha8
- */
- private @Nullable Class> clazz = null;
-
- /**
- * Contains the origin of the issuer.
- *
- * @since v1-alpha8
- */
- private @Nullable String origin = null;
-
- /**
- * Contains metadata about the issuer.
- *
- * @since v1-alpha8
- */
- private @Nullable String metadata = null;
-
- /**
- * Constructs this class.
- *
- * @since v1-alpha2
- */
- public Builder() {}
-
- /**
- * Builds a new {@link LoggerInstance} instance.
- *
- * @return new {@link LoggerInstance} instance
- * @throws IllegalStateException if {@link #clazz} is unset
- * @since v1-alpha2
- */
- public LoggerInstance build() throws IllegalStateException {
- // Check for required fields
- if (clazz == null)
- throw new IllegalStateException("The class is unset");
-
- // Set defaults
- if (origin == null || origin.isBlank())
- origin = "APPLICATION";
- if (metadata == null || metadata.isBlank())
- metadata = null;
-
- return new LoggerInstance();
- }
-
- /**
- * Returns the class of the issuer.
- *
- * @return class of the issuer
- * @since v1-alpha2
- */
- public @Nullable Class> getClazz() {
- return clazz;
- }
-
- /**
- * Returns the origin of the issuer.
- *
- * @return origin of the issuer
- * @since v1-alpha2
- */
- public @Nullable String getOrigin() {
- return origin;
- }
-
- /**
- * Returns metadata about the issuer.
- *
- * @return metadata about the issuer
- * @since v1-alpha2
- */
- public @Nullable String getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the class of the issuer.
- *
- * @param clazz new class of the issuer
- * @return builder instance
- * @since v1-alpha2
- */
- public @NotNull Builder setClazz(@Nullable Class> clazz) {
- this.clazz = clazz;
- return this;
- }
-
- /**
- * Sets the origin of the issuer.
- *
- * @param origin new origin of the issuer
- * @return builder instance
- * @since v1-alpha2
- */
- public @NotNull Builder setOrigin(@Nullable String origin) {
- this.origin = origin;
- return this;
- }
-
- /**
- * Sets the metadata about the issuer.
- *
- * @param metadata new metadata about the issuer
- * @return builder instance
- * @since v1-alpha2
- */
- public @NotNull Builder setMetadata(@Nullable String metadata) {
- this.metadata = metadata;
- return this;
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/PrintStreamService.java b/base/src/main/java/de/staropensource/engine/base/logging/PrintStreamService.java
deleted file mode 100644
index c7ccd5f1a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/PrintStreamService.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.type.EngineState;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.nio.charset.StandardCharsets;
-
-/**
- * Contains {@link PrintStream}s for the standard
- * output and standard error streams, which redirect
- * their input into the engine's logging infrastructure.
- *
- * @since v1-alpha4
- */
-@SuppressWarnings({ "unused", "JavadocDeclaration" })
-public final class PrintStreamService {
- /**
- * Contains the diagnostic stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the diagnostic stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @return diagnostic stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream diag = null;
-
- /**
- * Contains the verbose stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the verbose stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @return verbose stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream verb = null;
-
- /**
- * Contains the silent warning stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the silent warning stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @return silent warning stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream sarn = null;
-
- /**
- * Contains the informational stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the informational stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @return informational stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream info = null;
-
- /**
- * Contains the warning stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the warning stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @return warning stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream warn = null;
-
- /**
- * Contains the error stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the error stream.
- * Anything sent will be redirected to
- * {@link Logger#info(String)}
- *
- * @return error stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream error = null;
-
- /**
- * Contains the crash stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the crash stream.
- * Anything sent will be redirected to
- * {@link Logger#error(String)}
- *
- * @return crash stream
- * @since v1-alpha4
- */
- @Getter
- private static PrintStream crash = null;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha4
- */
- private PrintStreamService() {}
-
- /**
- * Initializes all {@link PrintStream}s offered by this class.
- *
- * Only works during early engine startup.
- *
- * @since v1-alpha8
- */
- public static void initializeStreams() {
- if (Engine.getInstance() == null || Engine.getInstance().getState() != EngineState.EARLY_STARTUP)
- return;
-
- // Create streams
- diag = LogStream.createPrintStream(LogLevel.DIAGNOSTIC);
- verb = LogStream.createPrintStream(LogLevel.VERBOSE);
- sarn = LogStream.createPrintStream(LogLevel.SILENT_WARNING);
- info = LogStream.createPrintStream(LogLevel.INFORMATIONAL);
- warn = LogStream.createPrintStream(LogLevel.WARNING);
- error = LogStream.createPrintStream(LogLevel.ERROR);
- crash = LogStream.createPrintStream(LogLevel.CRASH);
- }
-
- /**
- * Returns the standard output stream.
- *
- * @return standard output stream
- * @since v1-alpha4
- */
- public static @NotNull PrintStream getStdOut() {
- return info;
- }
-
- /**
- * Returns the standard error stream.
- *
- * @return standard error stream
- * @since v1-alpha4
- */
- public static @NotNull PrintStream getStdErr() {
- return error;
- }
-
- /**
- * Extends {@link PrintStream} to allow for redirecting log messages.
- *
- * @since v1-alpha4
- */
- private static final class LogStream extends OutputStream {
- /**
- * Contains the current sequence of characters written.
- *
- * @since v1-alpha4
- */
- private @NotNull StringBuilder sequence = new StringBuilder();
-
- /**
- * Contains the {@link LogLevel} to write log messages in.
- *
- * @since v1-alpha4
- */
- private final @NotNull LogLevel level;
-
- /**
- * Constructs this class.
- *
- * @param level level to write log messages in
- * @since v1-alpha4
- */
- public LogStream(@NotNull LogLevel level) {
- this.level = level;
- }
-
- /**
- * Creates a new {@link LogStream} and returns a {@link PrintStream}
- * using the newly created {@link LogStream} instance.
- *
- * @param level level to write log messages in
- * @return {@link PrintStream} using a newly created {@link LogStream} instance
- * @since v1-alpha4
- */
- public static @NotNull PrintStream createPrintStream(@NotNull LogLevel level) {
- //noinspection resource // obvious why
- return new LogStream(level).toPrintStream();
- }
-
- /**
- * Returns a new {@link PrintStream} using this {@link LogStream} instance.
- *
- * @return {@link PrintStream} using this instance
- * @since v1-alpha4
- */
- public @NotNull PrintStream toPrintStream() {
- return new PrintStream(this, true, StandardCharsets.UTF_8);
- }
-
- /** {@inheritDoc} */
- @Override
- public synchronized void write(int byteChar) {
- // Convert to String and append to 'sequence'
- sequence.append(new String(new byte[]{ (byte) byteChar }, StandardCharsets.UTF_8));
-
- // Check for newline
- if (sequence.indexOf("\n") != -1) {
- switch (level) {
- case DIAGNOSTIC -> Logger.diag(sequence.toString());
- case VERBOSE -> Logger.verb(sequence.toString());
- case SILENT_WARNING -> Logger.sarn(sequence.toString());
- case INFORMATIONAL -> Logger.info(sequence.toString());
- case WARNING -> Logger.warn(sequence.toString());
- case ERROR -> Logger.error(sequence.toString());
- case CRASH -> Logger.crash(sequence.toString());
- }
-
- sequence = new StringBuilder();
- }
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/CrashHandler.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/CrashHandler.java
deleted file mode 100644
index bdb16481e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/CrashHandler.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging.backend;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.EngineInternals;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import de.staropensource.engine.base.utility.misc.Miscellaneous;
-import de.staropensource.engine.base.utility.information.EngineInformation;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-import static de.staropensource.engine.base.logging.backend.Processor.isFeatureEnabled;
-
-/**
- * Handles crashes.
- *
- * @since v1-alpha8
- */
-public final class CrashHandler {
- /**
- * Contains all random witty comments.
- *
- * @since v1-alpha8
- */
- public static final @NotNull String[] WITTYCOMMENTS = new String[]{
- "Who fucked up here?",
- "What is it now?",
- ":neofox_woozy:",
- "Oh no!",
- "my engine brokey brokey",
- "weird",
- "Is this a feature?",
- "$ git blame",
- };
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha8
- */
- private CrashHandler() {}
-
- /**
- * Handles crash reports.
- *
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @param throwable {@link Throwable} which caused the error
- * @param fatal if to terminate the engine
- * @since v1-alpha8
- */
- public static void handleCrash(@NotNull StackTraceElement issuer, @NotNull String message, @Nullable Throwable throwable, boolean fatal) {
- StringBuilder output = new StringBuilder();
- String outputFinal;
-
- // Header
- output
- .append("==== sos!engine crash report ====")
- .append("\nDear user: The application or game you just used seems to have run into a problem.")
- .append("\n Please be so kind and report this crash report to the developers so they can fix the issue.")
- .append("\nDear developer: FIX YOUR SHIT. If the engine is at fault here, please report the crash")
- .append("\n to StarOpenSource here: https://git.staropensource.de/StarOpenSource/Engine/issues")
- .append("\n\n// ")
- .append(WITTYCOMMENTS[new Random().nextInt(WITTYCOMMENTS.length)])
- .append("\n\n");
-
- // Information about the crash
- output
- .append("---- Crash Information ----\n")
- .append("Issuer: ")
- .append(issuer.getClassName())
- .append("@")
- .append(issuer.getModuleName())
- .append("#")
- .append(issuer.getMethodName())
- .append("~")
- .append(issuer.getLineNumber())
-
- .append("\nFatal: ")
- .append(fatal);
-
- if (throwable == null)
- output
- .append("\nCaused by:")
- .append("\nNo throwable has been passed.");
- else {
-
- output
- .append("\n")
- .append(Miscellaneous.stacktraceAsStringRecursive(throwable, true, true))
- .append("\n");
- }
-
- output.append("\nMessage: \n")
- .append(message)
- .append("\n\n");
-
- // Environment information
- output
- .append("---- Environment ----")
- .append("\nTime and date: ")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2))
- .append(".")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2))
- .append(".")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4))
- .append(" ")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2))
- .append(":")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2))
- .append(":")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2))
- .append(" [")
- .append(TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT, Locale.US))
- .append("]")
-
- .append("\nUNIX Epoch: ")
- .append(NumberUtil.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length()))
-
- .append("\nOperating system: ")
- .append(System.getProperty("os.name"))
-
- .append("\nCPU architecture: ")
- .append(System.getProperty("os.arch"))
-
- .append("\nMemory: ")
- .append(JvmInformation.getMemoryUsed() / 1024)
- .append(" MiB")
- .append("/")
- .append(JvmInformation.getMemoryLimit() / 1024)
- .append(" MiB")
- .append(" (stack ")
- .append(JvmInformation.getMemoryStack().getUsed() / 1024)
- .append(" MiB")
- .append("/")
- .append(JvmInformation.getMemoryStack().getMax() == -1 ? "∞" : JvmInformation.getMemoryStack().getMax() / 1024)
- .append(" MiB")
- .append(", heap ")
- .append(JvmInformation.getMemoryHeap().getUsed() / 1024)
- .append(" MiB")
- .append("/")
- .append(JvmInformation.getMemoryHeap().getMax() == -1 ? "∞" : JvmInformation.getMemoryStack().getMax() / 1024)
- .append(" MiB)")
-
- .append("\nJVM: ")
- .append(JvmInformation.getImplementationName())
- .append(" ")
- .append(JvmInformation.getImplementationVersion())
- .append(" @ ")
- .append(JvmInformation.getJavaVersion())
- .append(" by ")
- .append(JvmInformation.getImplementationVendor())
-
- .append("\nJVM arguments: ");
-
- for (String argument : JvmInformation.getArguments())
- output
- .append("\n- '")
- .append(argument)
- .append("'");
-
- output.append("\n\n");
-
- // Engine
- output.append("---- sos!engine ----\n");
-
- if (EngineInformation.getVersioningString() == null)
- output.append("EngineInformation is not yet initialized");
- else
- output
- .append("Version: ")
- .append(EngineInformation.getVersioningString())
-
- .append("\nCommit: ")
- .append(EngineInformation.getGitCommitIdentifierLong())
-
- .append("\nDirty: ")
- .append(EngineInformation.isGitDirty());
-
- output.append("\n\n");
-
- // Engine configuration
- output.append("---- sos!engine configuration ----\n");
-
- if (EngineConfiguration.getInstance() == null)
- output.append("EngineConfiguration is not yet initialized");
- else
- output
- .append("EngineConfiguration#debug='")
- .append(EngineConfiguration.getInstance().isDebug())
- .append("'\n")
-
- .append("EngineConfiguration#debugEvents='")
- .append(EngineConfiguration.getInstance().isDebugEvents())
- .append("'\n")
-
- .append("EngineConfiguration#initialPerformSubsystemInitialization='")
- .append(EngineConfiguration.getInstance().isInitialPerformSubsystemInitialization())
- .append("'\n")
-
- .append("EngineConfiguration#initialIncludeSubsystemClasses='")
- .append(EngineConfiguration.getInstance().getInitialIncludeSubsystemClasses())
- .append("'\n")
-
- .append("EngineConfiguration#errorShortcodeParser='")
- .append(EngineConfiguration.getInstance().isErrorShortcodeParser())
- .append("'\n")
-
- .append("EngineConfiguration#optimizeLogging='")
- .append(EngineConfiguration.getInstance().isOptimizeLogging())
- .append("'\n")
-
- .append("EngineConfiguration#optimizeEvents='")
- .append(EngineConfiguration.getInstance().isOptimizeEvents())
- .append("'\n")
-
- .append("EngineConfiguration#logLevel='")
- .append(EngineConfiguration.getInstance().getLogLevel().name())
- .append("'\n")
-
- .append("EngineConfiguration#logSettings='")
- .append(EngineConfiguration.getInstance().getLogFeatures())
- .append("'\n")
-
- .append("EngineConfiguration#logPollingSpeed='")
- .append(EngineConfiguration.getInstance().getLogPollingSpeed())
- .append("'\n")
-
- .append("EngineConfiguration#logForceStandardOutput='")
- .append(EngineConfiguration.getInstance().isLogForceStandardOutput())
- .append("'\n")
-
- .append("EngineConfiguration#hideFullTypePath='")
- .append(EngineConfiguration.getInstance().isHideFullTypePath());
-
- output.append("'\n\n");
-
- // System properties
- output.append("---- System properties ----");
-
- for (String property : System.getProperties().stringPropertyNames().stream().sorted().toList())
- output
- .append("\n")
- .append(property)
- .append("='")
- .append(System.getProperties().getProperty(property).replace("\n", "\\n"))
- .append("'");
-
- output.append("\n\n");
-
- // Stacktraces of all threads
- output.append("---- Stacktraces of all threads ----");
- {
- Map stacktraces = Thread.getAllStackTraces();
-
- for (Thread thread : stacktraces.keySet())
- output
- .append("\n")
- .append(thread.getName())
- .append(" (id=")
- .append(thread.threadId())
- .append(" priority=")
- .append(thread.getPriority())
- .append(" group=")
- .append(thread.getThreadGroup() == null ? "" : thread.getThreadGroup().getName())
- .append(" state=")
- .append(thread.getState().name())
- .append(" daemon=")
- .append(thread.isDaemon())
- .append("):")
- .append("\n")
- .append(Miscellaneous.stacktraceAsString(stacktraces.get(thread), false))
- .append("\n");
- }
- output.append("\n");
-
- // Footer
- output
- .append("Dear user: The application or game you just used seems to have run into a problem.\n")
- .append(" Please be so kind and report this crash report to the developers so they can fix the issue.\n")
- .append("Dear developer: FIX YOUR SHIT. If the engine is at fault here, please report the crash\n")
- .append(" to StarOpenSource here: https://git.staropensource.de/StarOpenSource/Engine/issues\n")
- .append("==== sos!engine crash report ====");
-
- // Formatting
- if (isFeatureEnabled("formatting")) {
- outputFinal =
- ""
- + output
- .toString()
- .replace("<", "\\<")
- + "";
- } else
- outputFinal = output.toString();
-
- // Print
- Logger.getLoggingAdapter().print(LogLevel.CRASH, issuer, message, outputFinal);
-
- // Terminate engine
- // We do a test on the engine state here
- // to prevent bugs and multiple engine shutdowns.
- if (fatal)
- switch (Engine.getInstance().getState()) {
- case UNKNOWN, EARLY_STARTUP, STARTUP -> {
- if (EngineInternals.getInstance() == null)
- Runtime.getRuntime().exit(69);
- else
- EngineInternals.getInstance().getShutdownHandler().shutdown((short) 69);
- }
- case RUNNING -> Engine.getInstance().shutdown(69);
- case SHUTDOWN, CRASHED -> {}
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/Filterer.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/Filterer.java
deleted file mode 100644
index 97a7f4829..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/Filterer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging.backend;
-
-import org.intellij.lang.annotations.RegExp;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Responsible for filtering log messages out.
- *
- * @since v1-alpha8
- */
-public final class Filterer {
- /**
- * Contains a list of all disallowed classes.
- *
- * @since v1-alpha8
- */
- static @NotNull List<@NotNull String> disallowedClasses = new ArrayList<>();
-
- /**
- * Contains a list of all disallowed modules.
- *
- * @since v1-alpha8
- */
- static @NotNull List<@NotNull String> disallowedModules = new ArrayList<>();
-
- /**
- * Contains a list of all disallowed messages.
- *
- * @since v1-alpha8
- */
- static @NotNull List<@NotNull String> disallowedMessages = new ArrayList<>();
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha8
- */
- private Filterer() {}
-
- /**
- * Disallows one or multiple classes.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowClass(@RegExp @NotNull String regex) {
- disallowedClasses.add(regex);
- }
-
- /**
- * Disallows one or multiple modules.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowModule(@RegExp @NotNull String regex) {
- disallowedModules.add(regex);
- }
-
- /**
- * Disallows one or multiple messages.
- *
- * @param regex regex
- * @since v1-alpha8
- */
- public static void disallowMessage(@RegExp @NotNull String regex) {
- disallowedMessages.add(regex);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java
deleted file mode 100644
index 58cd2cfc0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/Processor.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging.backend;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.implementation.shortcode.EmptyShortcodeParser;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.logging.backend.async.LoggingQueue;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import de.staropensource.engine.base.utility.PlaceholderEngine;
-import de.staropensource.engine.base.utility.information.JvmInformation;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Calendar;
-
-/**
- * Processes log messages.
- *
- * @see #handle(LogLevel, StackTraceElement, String)
- * @since v1-alpha8
- */
-public final class Processor {
- /**
- * Creates and initializes an instance of this class
- *
- * @since v1-alpha8
- */
- private Processor() {}
-
- /**
- * Checks whether the specified feature is enabled.
- *
- * @param feature feature to check
- * @return enabled?
- * @since v1-alpha8
- */
- public static boolean isFeatureEnabled(@NotNull String feature) {
- return EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().getLogFeatures().contains(feature);
- }
-
- /**
- * Handles incoming log calls and either
- * processes them directly or queues them in.
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @since v1-alpha8
- */
- public static void handle(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message) {
- if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isOptimizeLogging())
- LoggingQueue.add(level, issuer, message);
- else
- process(level, issuer, message);
- }
-
- /**
- * Processes a log call.
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @since v1-alpha8
- */
- public static void process(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message) {
- StringBuilder output = new StringBuilder();
-
- // Filter out
- if (EngineConfiguration.getInstance() == null) {
- LogLevel maxLevel = LogLevel.INFORMATIONAL;
-
- try {
- maxLevel = LogLevel.valueOf(System.getProperties().getProperty("sosengine.base.logLevel", "informational").toUpperCase());
- } catch (IllegalArgumentException ignored) {
- Logger.error("The log level '" + System.getProperties().getProperty("sosengine.base.logLevel", "informational") + "' is not valid");
- }
-
- if (level.compareTo(maxLevel) < 0)
- return;
- } else if (level.compareTo(EngineConfiguration.getInstance().getLogLevel()) < 0)
- return;
-
- for (String classNameDisallowed : Filterer.disallowedClasses)
- if (issuer.getClassName().matches(classNameDisallowed))
- return;
- for (String moduleNameDisallowed : Filterer.disallowedModules)
- if (issuer.getModuleName().matches(moduleNameDisallowed))
- return;
- for (String messageDisallowed : Filterer.disallowedModules)
- if (message.matches(messageDisallowed))
- return;
-
- format(output, level);
- runtime(output);
- if (isFeatureEnabled("date") || isFeatureEnabled("time")) {
- output.append("[");
- date(output);
- if (isFeatureEnabled("date") && isFeatureEnabled("time"))
- output.append(" ");
- time(output);
- output.append("] ");
- }
-
- if (isFeatureEnabled("level") || isFeatureEnabled("origin")) {
- output.append("[");
- level(output, level);
- if (isFeatureEnabled("level") && isFeatureEnabled("origin"))
- output.append(" ");
- if (isFeatureEnabled("origin")) {
- issuerClass(output, issuer);
- issuerModule(output, level, issuer);
- methodName(output, level, issuer);
- lineNumber(output, level, issuer);
- }
- output.append("] ");
- }
- message(output, level, message);
- format(output, "reset");
-
- // Print
- Logger.getLoggingAdapter().print(level, issuer, message, output.toString());
- }
-
- // -----> Formatting
- /**
- * Adds the {@code formatting} feature.
- *
- * This method will reset and then color the following
- * substring in the log level-specific color.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @see #format(StringBuilder, String)
- * @since v1-alpha8
- */
- private static void format(@NotNull StringBuilder builder, @NotNull LogLevel level) {
- format(builder, "reset");
- format(builder, switch (level) {
- case DIAGNOSTIC, VERBOSE -> "fg:blue";
- case SILENT_WARNING, WARNING -> "fg:yellow";
- case INFORMATIONAL -> "fg:white";
- case ERROR -> "fg:red";
- case CRASH -> "you should not see this";
- });
- }
-
- /**
- * Adds the {@code formatting} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param component formatting component
- * @see #format(StringBuilder, LogLevel)
- * @since v1-alpha8
- */
- private static void format(@NotNull StringBuilder builder, @NotNull String component) {
- if (isFeatureEnabled("formatting"))
- builder
- .append("<")
- .append(component)
- .append(">");
- }
-
- /**
- * Adds the {@code formatting} feature.
- *
- * @param string string to sanitize
- * @return sanitized string
- * @see #format(StringBuilder, LogLevel)
- * @since v1-alpha8
- */
- private static @NotNull String sanitizeFormat(@NotNull String string) {
- if (isFeatureEnabled("formatting"))
- return string.replace("<", "\\<");
- else
- return string;
- }
-
- // -----> Features and components
- /**
- * Adds the {@code runtime} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @since v1-alpha8
- */
- private static void runtime(@NotNull StringBuilder builder) {
- if (isFeatureEnabled("runtime"))
- builder
- .append("[")
- .append(JvmInformation.getUptime())
- .append("ms")
- .append("] ");
- }
-
- /**
- * Adds the {@code time} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @since v1-alpha8
- */
- private static void time(@NotNull StringBuilder builder) {
- if (isFeatureEnabled("time"))
- builder
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2))
- .append(":")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2))
- .append(":")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2));
- }
-
- /**
- * Adds the {@code date} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @since v1-alpha8
- */
- private static void date(@NotNull StringBuilder builder) {
- if (isFeatureEnabled("date"))
- builder
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2))
- .append(".")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2))
- .append(".")
- .append(NumberUtil.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4));
- }
-
- /**
- * Adds the {@code level} component.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @since v1-alpha8
- */
- private static void level(@NotNull StringBuilder builder, @NotNull LogLevel level) {
- if (isFeatureEnabled("level")) {
- format(builder, "bold");
-
- builder.append(switch (level) {
- case DIAGNOSTIC -> "DIAG";
- case VERBOSE -> "VERB";
- case SILENT_WARNING -> "SARN";
- case INFORMATIONAL -> "INFO";
- case WARNING -> "WARN";
- case ERROR -> "ERR!";
- case CRASH -> "CRSH";
- });
-
- format(builder, level);
- }
- }
-
- /**
- * Adds the {@code issuer class} component.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param issuer {@link StackTraceElement} of the issuer
- * @since v1-alpha8
- */
- private static void issuerClass(@NotNull StringBuilder builder, @NotNull StackTraceElement issuer) {
- format(builder, "bold");
-
- if (isFeatureEnabled("shortIssuerClass")) {
- String[] classNameSplit = issuer.getClassName().split("\\.");
- builder.append(classNameSplit[classNameSplit.length - 1]);
- } else
- builder.append(issuer.getClassName());
- }
-
- /**
- * Adds the {@code moduleName} and {@code moduleVersion} features.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @since v1-alpha8
- */
- private static void issuerModule(@NotNull StringBuilder builder, @NotNull LogLevel level, @NotNull StackTraceElement issuer) {
- if (isFeatureEnabled("moduleName") && issuer.getModuleName() != null) {
- format(builder, "bold");
-
- builder
- .append("@")
- .append(issuer.getModuleName());
-
- if (isFeatureEnabled("moduleVersion") && issuer.getModuleVersion() != null)
- builder
- .append("v")
- .append(issuer.getModuleVersion());
-
- format(builder, level);
- }
- }
-
- /**
- * Adds the {@code methodName} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @since v1-alpha8
- */
- private static void methodName(@NotNull StringBuilder builder, @NotNull LogLevel level, @NotNull StackTraceElement issuer) {
- if (isFeatureEnabled("methodName")) {
- builder.append("#");
- format(builder, "bold");
- builder.append(sanitizeFormat(issuer.getMethodName()));
- format(builder, level);
- }
- }
-
- /**
- * Adds the {@code lineNumber} feature.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @since v1-alpha8
- */
- private static void lineNumber(@NotNull StringBuilder builder, @NotNull LogLevel level, @NotNull StackTraceElement issuer) {
- if (isFeatureEnabled("lineNumber")) {
- builder.append("~");
- format(builder, "bold");
- builder.append(issuer.getLineNumber());
- format(builder, level);
- }
- }
-
- /**
- * Adds the {@code message} component.
- *
- * @param builder {@link StringBuilder} instance to append to
- * @param level level of the log call
- * @param message message
- * @since v1-alpha8
- */
- private static void message(@NotNull StringBuilder builder, @NotNull LogLevel level, @NotNull String message) {
- String finalizedMessage = handlePlaceholders(
- message
- .replace(
- "\n",
- "\n" + " ".repeat(
- new EmptyShortcodeParser(builder.toString(), true)
- .getClean()
- .length()
- )
- )
- );
-
- if (Logger.isSanitizeMessages())
- finalizedMessage = sanitizeFormat(finalizedMessage);
- else {
- StringBuilder reset_correct = new StringBuilder();
- format(reset_correct, level);
-
- finalizedMessage = finalizedMessage
- .replace("", reset_correct);
- }
-
- builder.append(finalizedMessage);
- }
-
- // -----> Utility methods
- /**
- * Uses the {@link PlaceholderEngine} to replace
- * all placeholders within a specified string and
- * returns it's result. The original string will
- * be returned if the {@link PlaceholderEngine}
- * is not yet initialized.
- *
- * @param string string to use
- * @return updated string
- * @since v1-alpha8
- */
- private static @NotNull String handlePlaceholders(@NotNull String string) {
- if (PlaceholderEngine.getInstance() == null)
- return string;
- else
- return PlaceholderEngine.getInstance().process(string);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingQueue.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingQueue.java
deleted file mode 100644
index dbf9a6129..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingQueue.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging.backend.async;
-
-import de.staropensource.engine.base.internal.type.QueuedLogCall;
-import de.staropensource.engine.base.logging.backend.Processor;
-import de.staropensource.engine.base.type.logging.LogLevel;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Handles everything related to the logging queue.
- *
- * @since v1-alpha8
- */
-public final class LoggingQueue {
- /**
- * Contains the logging queue.
- *
- * @since v1-alpha8
- */
- private static final @NotNull List<@NotNull QueuedLogCall> queue = Collections.synchronizedList(new ArrayList<>());
-
- /**
- * Creates and initializes an instance of this class
- *
- * @since v1-alpha8
- */
- private LoggingQueue() {}
-
- /**
- * Adds a new entry to the logging queue.
- *
- * @param level level of the log call
- * @param issuer {@link StackTraceElement} of the issuer
- * @param message message
- * @since v1-alpha8
- */
- public static void add(@NotNull LogLevel level, @NotNull StackTraceElement issuer, @NotNull String message) {
- queue.add(new QueuedLogCall(level, issuer, message));
- }
-
- /**
- * Flushes the logging queue.
- *
- * @since v1-alpha8
- */
- public static void flush() {
- // Get copy of and clear the queue
- List<@NotNull QueuedLogCall> queue = new ArrayList<>(LoggingQueue.queue);
- LoggingQueue.queue.clear();
-
- for (QueuedLogCall queuedCall : queue)
- Processor.process(queuedCall.level(), queuedCall.issuer(), queuedCall.message());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingThread.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingThread.java
deleted file mode 100644
index a170e0a46..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/LoggingThread.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.logging.backend.async;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.EngineState;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Handles the logging thread.
- *
- * @since v1-alpha8
- */
-public final class LoggingThread {
- /**
- * Contains the logging thread.
- *
- * @since v1-alpha8
- */
- private static Thread thread;
-
- /**
- * Contains the code of the logging thread.
- *
- * @since v1-alpha8
- */
- private static final @NotNull Runnable threadCode = () -> {
- int pollingSpeed;
-
- while (!(
- Thread.currentThread().isInterrupted()
- || !(EngineConfiguration.getInstance() == null || EngineConfiguration.getInstance().isOptimizeLogging())
- || Engine.getInstance().getState() == EngineState.SHUTDOWN
- || Engine.getInstance().getState() == EngineState.CRASHED
- )) {
- if (EngineConfiguration.getInstance() == null)
- pollingSpeed = 5;
- else
- pollingSpeed = EngineConfiguration.getInstance().getLogPollingSpeed();
-
- // Flush all log messages
- LoggingQueue.flush();
-
- // Sleep for whatever has been configured
- if (pollingSpeed > 0) {
- long sleepDuration = System.currentTimeMillis() + pollingSpeed;
- while (System.currentTimeMillis() < sleepDuration)
- Thread.onSpinWait();
- }
- }
- };
-
- static {
- constructThread();
- }
-
- /**
- * Creates and initializes an instance of this class
- *
- * @since v1-alpha8
- */
- private LoggingThread() {}
-
- /**
- * Constructs the logging thread.
- *
- * @see #thread
- * @since v1-alpha8
- */
- private static void constructThread() {
- thread = Thread
- .ofPlatform()
- .daemon()
- .name("Logging thread")
- .group(Engine.getThreadGroup())
- .priority(Thread.MAX_PRIORITY)
- .stackSize(10)
- .unstarted(threadCode);
- }
-
- /**
- * (Re-)Starts the logging thread.
- *
- * @param allowRestart if the logging thread should be restarted if it's stopped
- * @since v1-alpha8
- */
- public static void startThread(boolean allowRestart) {
- if (allowRestart && thread.isAlive()) {
- // Executing the restart logic in another thread prevents
- // this thread from being fully blocked while still ensuring
- // that the logging thread is properly restarted
- Thread
- .ofVirtual()
- .name("Logging thread restart thread")
- .start(() -> {
- Logger.diag("Restarting the logging thread");
-
- // Interrupt thread
- // This let's our thread code know that it should terminate
- thread.interrupt();
-
- // Make sure that the logging thread is dead before reconstructing and starting it
- while (thread.isAlive())
- Thread.onSpinWait();
-
- constructThread();
- thread.start();
- });
- } else
- thread.start();
- }
-
- /**
- * Returns the {@link Thread.State} of the logging thread.
- *
- * @return logging thread state
- * @see Thread.State
- * @since v1-alpha8
- */
- public static @NotNull Thread.State getState() {
- return thread.getState();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/package-info.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/async/package-info.java
deleted file mode 100644
index 61b3f42a4..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/async/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Everything related to making the logging
- * infrastructure asynchronous.
- *
- * @since v1-alpha8
- */
-package de.staropensource.engine.base.logging.backend.async;
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/backend/package-info.java b/base/src/main/java/de/staropensource/engine/base/logging/backend/package-info.java
deleted file mode 100644
index 809535312..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/backend/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * The backend of sos!engine's logging infrastructure.
- *
- * @since v1-alpha8
- */
-package de.staropensource.engine.base.logging.backend;
diff --git a/base/src/main/java/de/staropensource/engine/base/logging/package-info.java b/base/src/main/java/de/staropensource/engine/base/logging/package-info.java
deleted file mode 100644
index b426e8adb..000000000
--- a/base/src/main/java/de/staropensource/engine/base/logging/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * The engine's logging infrastructure.
- *
- * @see de.staropensource.engine.base.logging.Logger
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.logging;
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/ClasspathAccess.java b/base/src/main/java/de/staropensource/engine/base/reflection/ClasspathAccess.java
deleted file mode 100644
index 50d17e3e3..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/ClasspathAccess.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.reflection;
-
-import de.staropensource.engine.base.logging.Logger;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Allows getting the classpath as {@link URL}s.
- *
- * This entire class has been stolen from
- * the Reflections library.
- * All credits to them.
- *
- * @since v1-alpha2
- */
-public final class ClasspathAccess {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha2
- */
- private ClasspathAccess() {}
-
- /**
- * Returns the classpath as a collection of {@link URL}s.
- *
- * @return collection of classpath urls
- * @since v1-alpha2
- */
- public static @NotNull Collection getClasspathURLs() {
- Collection urls = new ArrayList<>();
- String javaClassPath = System.getProperty("java.class.path");
-
- if (javaClassPath != null)
- for (String path : javaClassPath.split(File.pathSeparator))
- try {
- urls.add(new File(path).toURI().toURL());
- } catch (Exception exception) {
- Logger.crash("Failed converting classpath to URL", exception);
- }
-
- return fixURLs(urls);
- }
-
- /**
- * Fixes slowdowns which {@link URL}s may cause.
- *
- * Visit this blog post for more information.
- *
- * @param urls unfixed urls
- * @return fixed urls
- * @since v1-alpha2
- */
- private static @NotNull Collection fixURLs(@NotNull Collection urls) {
- Map distinct = new LinkedHashMap<>(urls.size());
- for (URL url : urls) {
- distinct.put(url.toExternalForm(), url);
- }
- return distinct.values();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/Reflect.java b/base/src/main/java/de/staropensource/engine/base/reflection/Reflect.java
deleted file mode 100644
index 0fb1aede6..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/Reflect.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.reflection;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- * The class you'd likely want to use for reflection.
- *
- * @since v1-alpha2
- */
-public final class Reflect {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha2
- */
- private Reflect() {}
-
- /**
- * Reflect on a {@link Class}.
- *
- * @param clazz class to reflect on
- * @return new {@link ReflectionClass}
- * @since v1-alpha2
- */
- public static @NotNull ReflectionClass reflectOn(@NotNull Class> clazz) {
- return new ReflectionClass(clazz);
- }
-
- /**
- * Reflect on a {@link Method}.
- *
- * @param method method to reflect on
- * @return new {@link ReflectionMethod}
- * @since v1-alpha2
- */
- public static ReflectionMethod reflectOn(@NotNull Method method) {
- return new ReflectionMethod(method);
- }
-
- /**
- * Reflect on a {@link Field}.
- *
- * @param field field to reflect on
- * @return new {@link ReflectionField}
- * @since v1-alpha2
- */
- public static @NotNull ReflectionField reflectOn(@NotNull Field field) {
- return new ReflectionField(field);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionClass.java b/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionClass.java
deleted file mode 100644
index 9c3e806f2..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionClass.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.reflection;
-
-import de.staropensource.engine.base.exception.UnexpectedCheckEndException;
-import de.staropensource.engine.base.exception.reflection.IncompatibleTypeException;
-import de.staropensource.engine.base.exception.reflection.InvalidFieldException;
-import de.staropensource.engine.base.exception.reflection.InvalidMethodException;
-import de.staropensource.engine.base.type.reflection.ClassType;
-import de.staropensource.engine.base.type.reflection.VisibilityModifier;
-import org.jetbrains.annotations.NotNull;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Modifier;
-
-/**
- * Reflection helper for {@link Class}es.
- *
- * @param clazz class to reflect on
- * @since v1-alpha2
- */
-@SuppressWarnings({ "unused" })
-public record ReflectionClass(Class> clazz) {
- /**
- * Creates and initializes an instance of this class.
- *
- * @param clazz class to reflect on
- * @since v1-alpha2
- */
- public ReflectionClass(@NotNull Class> clazz) {
- this.clazz = clazz;
- }
-
- /**
- * Returns the class name.
- *
- * @return class name
- * @since v1-alpha2
- */
- public String getName() {
- return clazz.getName().replace(getPackage() + ".", "");
- }
-
- /**
- * Returns the package path.
- *
- * @return package path
- * @since v1-alpha2
- */
- public String getPackage() {
- return clazz.getPackage().getName();
- }
-
- /**
- * Returns the full path, including the package and class name.
- *
- * @return full path
- * @since v1-alpha2
- */
- public String getPath() {
- return clazz.getName();
- }
-
- /**
- * Returns the type of this class.
- *
- * @return class type
- * @since v1-alpha2
- */
- public ClassType getType() {
- if (clazz.isLocalClass() || clazz.isMemberClass() || clazz.isAnonymousClass())
- return ClassType.CLASS;
- else if (clazz.isInterface())
- return ClassType.INTERFACE;
- else if (clazz.isEnum())
- return ClassType.ENUM;
- else if (clazz.isRecord())
- return ClassType.RECORD;
- else {
- // Class#isUnnamedClass is in preview, use reflection to invoke method
- try {
- if ((boolean) clazz.getMethod("isUnnamedClass").invoke(clazz))
- return ClassType.CLASS;
- } catch (Exception ignored) {
- }
- }
- return ClassType.UNKNOWN;
- }
-
- /**
- * Returns the class' visibility.
- *
- * @return class visibility
- * @throws UnexpectedCheckEndException if the class is neither public, protected or private (should be impossible)
- * @since v1-alpha2
- */
- public VisibilityModifier getVisibility() throws UnexpectedCheckEndException {
- if (Modifier.isPublic(clazz.getModifiers()))
- return VisibilityModifier.PUBLIC;
- else if (Modifier.isProtected(clazz.getModifiers()))
- return VisibilityModifier.PROTECTED;
- else if (Modifier.isPrivate(clazz.getModifiers()))
- return VisibilityModifier.PRIVATE;
- else
- throw new UnexpectedCheckEndException("checking the visibility of a class with modifiers " + clazz.getModifiers());
- }
-
- /**
- * Checks if the {@code final} modifier is present.
- *
- * @return presence of the {@code final} modifier
- * @since v1-alpha2
- */
- public boolean isFinal() throws IncompatibleTypeException {
- if (getType() != ClassType.CLASS)
- throw new IncompatibleTypeException("isFinal", getType(), new ClassType[]{ ClassType.CLASS });
- return Modifier.isFinal(clazz.getModifiers());
- }
-
- /**
- * Checks if the {@code abstract} modifier is present.
- *
- * @return presence of the {@code abstract} modifier
- * @since v1-alpha2
- */
- public boolean isAbstract() throws IncompatibleTypeException {
- if (getType() != ClassType.CLASS)
- throw new IncompatibleTypeException("isAbstract", getType(), new ClassType[]{ ClassType.CLASS });
- return Modifier.isAbstract(clazz.getModifiers());
- }
-
- /**
- * Returns all annotations this class has.
- *
- * @return array of all annotations
- * @since v1-alpha2
- */
- public Annotation @NotNull [] getAnnotations() {
- return clazz.getAnnotations();
- }
-
- /**
- * Returns the specified annotation or {@code null} if not found.
- *
- * @param annotation class
- * @return annotation or {@code null}
- * @since v1-alpha2
- */
- public Annotation getAnnotation(@NotNull Class annotation) {
- return clazz.getAnnotation(annotation);
- }
-
- /**
- * Returns the specified method.
- *
- * @param methodName name of the method
- * @param methodArguments arguments of the method
- * @return new {@link ReflectionMethod} instance
- * @throws InvalidMethodException if the method does not exist
- * @since v1-alpha2
- */
- public ReflectionMethod getMethod(@NotNull String methodName, Class>... methodArguments) throws InvalidMethodException {
- try {
- return new ReflectionMethod(clazz.getDeclaredMethod(methodName, methodArguments));
- } catch (NoSuchMethodException exception) {
- throw new InvalidMethodException(this, methodName);
- }
- }
-
- /**
- * Returns the specified field.
- *
- * @param fieldName name of the field
- * @return new {@link ReflectionField} instance
- * @throws InvalidFieldException if the field does not exist
- * @since v1-alpha2
- */
- public ReflectionField getField(@NotNull String fieldName) throws InvalidFieldException {
- try {
- return new ReflectionField(clazz.getField(fieldName));
- } catch (NoSuchFieldException exception) {
- throw new InvalidFieldException(this, fieldName);
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionField.java b/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionField.java
deleted file mode 100644
index bd3eb5db7..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionField.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.reflection;
-
-import de.staropensource.engine.base.exception.UnexpectedCheckEndException;
-import de.staropensource.engine.base.exception.reflection.NoAccessException;
-import de.staropensource.engine.base.internal.reflection.ReflectionAccessWidener;
-import de.staropensource.engine.base.type.reflection.VisibilityModifier;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-
-/**
- * Reflection helper for {@link Field}s.
- *
- * @since v1-alpha2
- */
-@Getter
-@SuppressWarnings({ "unused", "JavadocDeclaration" })
-public final class ReflectionField {
- /**
- * Contains a reference to the parent class.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns a reference to the parent class.
- *
- * @return parent class reference
- * @since v1-alpha2
- */
- private final @Nullable Class> parentClass;
-
- /**
- * Contains a reference to the field to reflect on.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns a reference to the field to reflect on.
- *
- * @return field reference
- * @since v1-alpha2
- */
- private final @NotNull Field field;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param field field to reflect on
- */
- public ReflectionField(@NotNull Field field) {
- parentClass = null;
- this.field = field;
- }
-
- /**
- * Constructs this class.
- *
- * @param parentClass parent class of field
- * @param field field to reflect on
- */
- public ReflectionField(@NotNull Class> parentClass, @NotNull Field field) {
- this.parentClass = parentClass;
- this.field = field;
- }
-
- /**
- * Returns the name of the field.
- *
- * @return field name
- * @since v1-alpha2
- */
- public String getName() {
- return field.getName();
- }
-
- /**
- * Returns the field's visibility.
- *
- * @return field visibility
- * @throws UnexpectedCheckEndException if the field is neither public, protected or private (should be impossible)
- * @since v1-alpha2
- */
- public VisibilityModifier getVisibility() throws UnexpectedCheckEndException {
- if (Modifier.isPublic(field.getModifiers()))
- return VisibilityModifier.PUBLIC;
- else if (Modifier.isProtected(field.getModifiers()))
- return VisibilityModifier.PROTECTED;
- else if (Modifier.isPrivate(field.getModifiers()))
- return VisibilityModifier.PRIVATE;
- else
- throw new UnexpectedCheckEndException("checking the visibility of a field with modifiers " + field.getModifiers());
- }
-
- /**
- * Checks if the {@code final} modifier is present.
- *
- * @return presence of the {@code final} modifier
- * @since v1-alpha2
- */
- public boolean isFinal() {
- return Modifier.isFinal(field.getModifiers());
- }
-
- /**
- * Checks if the {@code static} modifier is present.
- *
- * @return presence of the {@code static} modifier
- * @since v1-alpha2
- */
- public boolean isStatic() {
- return Modifier.isStatic(field.getModifiers());
- }
-
- /**
- * Checks if the {@code transient} modifier is present.
- *
- * @return presence of the {@code transient} modifier
- * @since v1-alpha2
- */
- public boolean isTransient() {
- return Modifier.isTransient(field.getModifiers());
- }
-
- /**
- * Checks if the {@code volatile} modifier is present.
- *
- * @return presence of the {@code volatile} modifier
- * @since v1-alpha2
- */
- public boolean isVolatile() {
- return Modifier.isVolatile(field.getModifiers());
- }
-
- /**
- * Updates the presence of the {@code final} modifier.
- *
- * @param newValue new presence of the {@code final} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setFinal(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isFinal() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(field, modifiersField.getInt(field) & ~Modifier.FINAL);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code static} modifier.
- *
- * @param newValue new presence of the {@code static} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setStatic(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isStatic() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(field, modifiersField.getInt(field) & ~Modifier.STATIC);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code transient} modifier.
- *
- * @param newValue new presence of the {@code transient} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setTransient(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isTransient() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(field, modifiersField.getInt(field) & ~Modifier.TRANSIENT);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code volatile} modifier.
- *
- * @param newValue new presence of the {@code volatile} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setVolatile(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isVolatile() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = field.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside field " + field.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(field, modifiersField.getInt(field) & ~Modifier.VOLATILE);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Returns all annotations this field has.
- *
- * @return array of all annotations
- * @since v1-alpha2
- */
- public Annotation @NotNull [] getAnnotations() {
- return field.getAnnotations();
- }
-
- /**
- * Returns the specified annotation or {@code null} if not found.
- *
- * @param annotation class
- * @return annotation or {@code null}
- * @since v1-alpha2
- */
- public Annotation getAnnotation(@NotNull Class annotation) {
- return field.getAnnotation(annotation);
- }
-
- /**
- * Returns the type this field has.
- *
- * @return field type
- * @since v1-alpha2
- */
- public Object getType() {
- return field.getType();
- }
-
- /**
- * Returns the generic type this field has.
- *
- * You can read the between {@code getType} and {@code getGenericType} here.
- *
- * @return field type
- * @since v1-alpha2
- */
- public Object getGenericType() {
- return field.getGenericType();
- }
-
- /**
- * Updates the field with a new value.
- *
- * @param newValue new value
- * @throws NoAccessException if access to the field has been denied
- * @since v1-alpha2
- */
- public void setValue(Object newValue) throws NoAccessException {
- try {
- field.set(parentClass, newValue);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", getName());
- }
- }
-
- /**
- * Updates the field with a new value.
- *
- * @return field's value
- * @throws NoAccessException if access to the field has been denied
- * @since v1-alpha2
- */
- public Object getValue() throws NoAccessException {
- try {
- return field.get(parentClass);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", getName());
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionMethod.java b/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionMethod.java
deleted file mode 100644
index 7b61a269d..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/ReflectionMethod.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.reflection;
-
-import de.staropensource.engine.base.exception.UnexpectedCheckEndException;
-import de.staropensource.engine.base.exception.reflection.InstanceMethodFromStaticContextException;
-import de.staropensource.engine.base.exception.reflection.InvalidMethodSignatureException;
-import de.staropensource.engine.base.exception.reflection.NoAccessException;
-import de.staropensource.engine.base.exception.reflection.StaticInitializerException;
-import de.staropensource.engine.base.internal.reflection.ReflectionAccessWidener;
-import de.staropensource.engine.base.type.reflection.VisibilityModifier;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-/**
- * Reflection helper for {@link Method}s.
- *
- * @since v1-alpha2
- */
-@Getter
-@SuppressWarnings({ "unused", "JavadocDeclaration" })
-public final class ReflectionMethod {
- /**
- * Contains a reference to the parent class.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns a reference to the parent class.
- *
- * @return parent class reference
- * @since v1-alpha2
- */
- private final Class> parentClass;
-
- /**
- * Contains a reference to the method to reflect on.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns a reference to the method to reflect on.
- *
- * @return method reference
- * @since v1-alpha2
- */
- private final Method method;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param method method to reflect on
- */
- public ReflectionMethod(@NotNull Method method) {
- parentClass = null;
- this.method = method;
- }
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param parentClass parent class of method
- * @param method method to reflect on
- */
- public ReflectionMethod(@NotNull Class> parentClass, @NotNull Method method) {
- this.parentClass = parentClass;
- this.method = method;
- }
-
- /**
- * Returns the name of the method.
- *
- * @return method name
- * @since v1-alpha2
- */
- public String getName() {
- return method.getName();
- }
-
- /**
- * Returns the method's visibility.
- *
- * @return method visibility
- * @throws UnexpectedCheckEndException if the method is neither public, protected or private (should be impossible)
- * @since v1-alpha2
- */
- public VisibilityModifier getVisibility() throws UnexpectedCheckEndException {
- if (Modifier.isPublic(method.getModifiers()))
- return VisibilityModifier.PUBLIC;
- else if (Modifier.isProtected(method.getModifiers()))
- return VisibilityModifier.PROTECTED;
- else if (Modifier.isPrivate(method.getModifiers()))
- return VisibilityModifier.PRIVATE;
- else
- throw new UnexpectedCheckEndException("checking the visibility of a method with modifiers " + method.getModifiers());
- }
-
- /**
- * Checks if the {@code final} modifier is present.
- *
- * @return presence of the {@code final} modifier
- * @since v1-alpha2
- */
- public boolean isFinal() {
- return Modifier.isFinal(method.getModifiers());
- }
-
- /**
- * Checks if the {@code static} modifier is present.
- *
- * @return presence of the {@code static} modifier
- * @since v1-alpha2
- */
- public boolean isStatic() {
- return Modifier.isStatic(method.getModifiers());
- }
-
- /**
- * Checks if the {@code abstract} modifier is present.
- *
- * @return presence of the {@code abstract} modifier
- * @since v1-alpha2
- */
- public boolean isAbstract() {
- return Modifier.isAbstract(method.getModifiers());
- }
-
- /**
- * Checks if the {@code synchronized} modifier is present.
- *
- * @return presence of the {@code synchronized} modifier
- * @since v1-alpha2
- */
- public boolean isSynchronized() {
- return Modifier.isSynchronized(method.getModifiers());
- }
-
- /**
- * Updates the presence of the {@code final} modifier.
- *
- * @param newValue new presence of the {@code final} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setFinal(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isFinal() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(method, modifiersField.getInt(method) & ~Modifier.FINAL);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code static} modifier.
- *
- * @param newValue new presence of the {@code static} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setStatic(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isStatic() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(method, modifiersField.getInt(method) & ~Modifier.STATIC);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code abstract} modifier.
- *
- * @param newValue new presence of the {@code abstract} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setAbstract(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isAbstract() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(method, modifiersField.getInt(method) & ~Modifier.ABSTRACT);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Updates the presence of the {@code synchronized} modifier.
- *
- * @param newValue new presence of the {@code synchronized} modifier
- * @throws NoSuchFieldException if the {@code modifiers} field is missing
- * @throws NoAccessException if access to the {@code modifiers} field has been denied
- * @since v1-alpha2
- */
- public void setSynchronized(boolean newValue) throws NoSuchFieldException, NoAccessException {
- // Don't do anything if the new value already matches the current value
- if (isSynchronized() == newValue)
- return;
-
- // Unlock modifications
- int modifiedModifiers = ReflectionAccessWidener.unlockModifications(this);
-
- // Get 'modifiers' field
- Field modifiersField;
- try {
- modifiersField = method.getClass().getDeclaredField("modifiers");
- } catch (NoSuchFieldException exception) {
- throw new NoSuchFieldException("Field \"modifiers\" not present inside method " + method.getName());
- }
-
- // Update 'modifiers' field
- try {
- modifiersField.setInt(method, modifiersField.getInt(method) & ~Modifier.SYNCHRONIZED);
- } catch (IllegalAccessException e) {
- throw new NoAccessException("field", "modifiers");
- }
-
- // Lock modifications
- ReflectionAccessWidener.lockModifications(this, modifiedModifiers);
- }
-
- /**
- * Returns all annotations this method has.
- *
- * @return array of all annotations
- * @since v1-alpha2
- */
- public Annotation @NotNull [] getAnnotations() {
- return method.getAnnotations();
- }
-
- /**
- * Returns the specified annotation or {@code null} if not found.
- *
- * @param annotation class
- * @param annotation annotation class
- * @return annotation or {@code null}
- * @since v1-alpha2
- */
- public T getAnnotation(@NotNull Class annotation) {
- return method.getAnnotation(annotation);
- }
-
- /**
- * Returns the method's return type.
- *
- * @return method return type
- * @since v1-alpha2
- */
- public @NotNull Class> getReturnType() {
- return method.getReturnType();
- }
-
- /**
- * Returns the method's generic return type.
- *
- * You can read the between {@code getReturnType} and {@code getGenericReturnType} here.
- *
- * @return field type
- * @since v1-alpha2
- */
- public Object getGenericReturnType() {
- return method.getGenericReturnType();
- }
-
- /**
- * Invokes the method.
- *
- * @param args arguments to pass
- * @return method return value
- * @throws NoAccessException if access to the method has been denied
- * @throws InvalidMethodSignatureException if the method signature is incorrect
- * @throws InvocationTargetException covers exceptions thrown by the method
- * @throws InstanceMethodFromStaticContextException when the target method is non-static and called from a static context
- * @throws StaticInitializerException when an the static initializer fails
- * @since v1-alpha5
- */
- public @Nullable Object invoke(Object... args) throws NoAccessException, InvalidMethodSignatureException, InvocationTargetException, InstanceMethodFromStaticContextException, StaticInitializerException {
- Object returnValue;
-
- // Allow access to method
- ReflectionAccessWidener.allowAccess(method);
-
- // Invoke method
- try {
- returnValue = method.invoke(parentClass, args);
- } catch (IllegalAccessException exception) {
- throw new NoAccessException("method", getName());
- } catch (IllegalArgumentException exception) {
- throw new InvalidMethodSignatureException(getName());
- } catch (NullPointerException exception) {
- throw new InstanceMethodFromStaticContextException(getName());
- } catch (ExceptionInInitializerError exception) {
- throw new StaticInitializerException(exception.getCause());
- }
-
- // Return return value from method
- return returnValue;
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/reflection/package-info.java b/base/src/main/java/de/staropensource/engine/base/reflection/package-info.java
deleted file mode 100644
index 1b2cc8dda..000000000
--- a/base/src/main/java/de/staropensource/engine/base/reflection/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Reflection classes, which make reflection
- * on classes, methods and fields easy.
- *
- * @see de.staropensource.engine.base.reflection.Reflect
- * @since v1-alpha2
- */
-package de.staropensource.engine.base.reflection;
diff --git a/base/src/main/java/de/staropensource/engine/base/type/Color.java b/base/src/main/java/de/staropensource/engine/base/type/Color.java
deleted file mode 100644
index 147d2c4c0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/Color.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import de.staropensource.engine.base.utility.misc.NumberUtil;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Range;
-
-import java.nio.ByteBuffer;
-import java.util.HexFormat;
-import java.util.Locale;
-
-/**
- * A class dedicated to colors.
- * Uses the RGBA format, with conversion methods
- * supporting RGB and RGBA & RGB encoded in
- * bytes or hex.
- *
- * @since v1-alpha6
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public class Color {
- /**
- * Contains the red color value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the red color value.
- *
- * @return red color value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the red color value.
- *
- * @param red new red color value
- * @since v1-alpha6
- */
- private @Range(from = 0, to = 255) int red;
- /**
- * Contains the green color value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the green color value.
- *
- * @return green color value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the green color value.
- *
- * @param green new green color value
- * @since v1-alpha6
- */
- private @Range(from = 0, to = 255) int green;
- /**
- * Contains the blue color value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the blue color value.
- *
- * @return blue color value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the blue color value.
- *
- * @param blue new blue color value
- * @since v1-alpha6
- */
- private @Range(from = 0, to = 255) int blue;
- /**
- * Contains the alpha channel value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the alpha channel value.
- *
- * @return alpha channel value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the alpha channel value.
- *
- * @param alpha new alpha channel value
- * @since v1-alpha6
- */
- private @Range(from = 0, to = 255) int alpha;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param red red color value
- * @param green green color value
- * @param blue blue color value
- * @param alpha alpha channel value
- * @since v1-alpha6
- */
- private Color(int red, int green, int blue, int alpha) {
- this.red = NumberUtil.limitNumber(0, 255, red);
- this.green = NumberUtil.limitNumber(0, 255, green);
- this.blue = NumberUtil.limitNumber(0, 255, blue);
- this.alpha = NumberUtil.limitNumber(0, 255, alpha);
- }
-
- /**
- * Converts the a set of numbers in
- * the RGBA format into a new instance.
- *
- * @param red red color value
- * @param blue blue color value
- * @param green green color value
- * @param alpha alpha color value
- * @return new {@link Color} instance
- * @since v1-alpha6
- */
- public static @NotNull Color fromRGBA(@Range(from = 0, to = 255) int red, @Range(from = 0, to = 255) int green,
- @Range(from = 0, to = 255) int blue, @Range(from = 0, to = 255) int alpha) {
- return new Color(red, green, blue, alpha);
- }
-
- /**
- * Converts the an array of numbers in
- * the RGBA format into a new instance.
- *
- * @param intArray integer array
- * @return new {@link Color} instance
- * @throws IndexOutOfBoundsException if the array contains more or less than four integers
- * @since v1-alpha6
- */
- public static @NotNull Color fromRGBA(int @NotNull [] intArray) {
- if (intArray.length != 4)
- throw new StringIndexOutOfBoundsException("Can't contains more or less than four integers");
-
- return new Color(intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-
- /**
- * Converts the a set of numbers in
- * the RGB format into a new instance.
- *
- * @param red red color value
- * @param blue blue color value
- * @param green green color value
- * @return new {@link Color} instance
- * @since v1-alpha6
- */
- public static @NotNull Color fromRGB(@Range(from = 0, to = 255) int red, @Range(from = 0, to = 255) int green,
- @Range(from = 0, to = 255) int blue) {
- return new Color(red, green, blue, 255);
- }
-
- /**
- * Converts the an array of numbers in
- * the RGBA format into a new instance.
- *
- * @param intArray integer array
- * @return new {@link Color} instance
- * @throws IndexOutOfBoundsException if the array contains more or less than four integers
- * @since v1-alpha6
- */
- public static @NotNull Color fromRGB(int @NotNull [] intArray) {
- if (intArray.length != 3)
- throw new StringIndexOutOfBoundsException("Can't contains more or less than four integers");
-
- return new Color(intArray[0], intArray[1], intArray[2], 255);
- }
-
- /**
- * Converts an array of bytes into a new instance.
- *
- * @param bytes byte array
- * @return new {@link Color} instance
- * @throws IndexOutOfBoundsException if the array contains less than three or more than four bytes
- * @since v1-alpha6
- */
- public static @NotNull Color fromBytes(byte @NotNull [] bytes) throws IndexOutOfBoundsException {
- if (bytes.length == 3)
- return new Color(bytes[0] & 0xFF, bytes[1] & 0xFF, bytes[2] & 0xFF, 255);
- else if (bytes.length == 4)
- return new Color(bytes[0] & 0xFF, bytes[1] & 0xFF, bytes[2] & 0xFF, bytes[3] & 0xFF);
- else
- throw new StringIndexOutOfBoundsException("Can't contain less than three or more than four bytes");
- }
-
- /**
- * Converts a hex string into a new instance.
- *
- * @param hexString hex string
- * @return new {@link Color} instance
- * @throws IndexOutOfBoundsException if the string contains less than three or more than four bytes
- * @since v1-alpha6
- */
- public static @NotNull Color fromHex(@NotNull String hexString) throws IndexOutOfBoundsException {
- return fromBytes(HexFormat.of().parseHex(hexString));
- }
-
- /**
- * Creates an identical copy of this instance.
- *
- * @return identical copy
- * @since v1-alpha6
- */
- @SneakyThrows
- public @NotNull Color clone() {
- return (Color) super.clone();
- }
-
- /**
- * Returns a string representation of this instance.
- *
- * @return string representation
- * @since v1-alpha6
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(r=" + red + " g=" + green + " b=" + blue + " a=" + alpha + ")";
- }
-
- /**
- * Converts the colors represented by
- * this instance into an integer array
- * in the RGBA format.
- *
- * @return {@code int} array with RGBA values
- * @since v1-alpha6
- */
- public int @NotNull [] toRGBA() {
- return new int[]{ red, green, blue, alpha };
- }
-
- /**
- * Converts the colors represented by
- * this instance into an integer array
- * in the RGB format.
- *
- * @return {@code int} array with RGB values
- * @since v1-alpha6
- */
- public int @NotNull [] toRGB() {
- return new int[]{ red, green, blue };
- }
-
- /**
- * Converts the colors represented by
- * this instance into a byte array.
- *
- * @param includeAlpha whether to include alpha or not
- * @return RGBA or RGB format as a byte array
- * @since v1-alpha6
- */
- public byte @NotNull [] toBytes(boolean includeAlpha) {
- ByteBuffer buffer = ByteBuffer.allocate(includeAlpha ? 4 : 3);
-
- buffer
- .put((byte) red)
- .put((byte) green)
- .put((byte) blue);
-
- if (includeAlpha)
- buffer.put((byte) alpha);
-
- return buffer.array();
- }
-
- /**
- * Converts the colors represented by
- * this instance into the hex format.
- *
- * @param includeAlpha whether to include alpha or not
- * @return RGBA or RGB format as a hex string
- * @since v1-alpha6
- */
- public @NotNull String toHex(boolean includeAlpha) {
- return HexFormat.of().formatHex(toBytes(includeAlpha)).toUpperCase(Locale.ROOT);
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/DependencyVector.java b/base/src/main/java/de/staropensource/engine/base/type/DependencyVector.java
deleted file mode 100644
index 26c882748..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/DependencyVector.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.exception.versioning.InvalidVersionStringException;
-import de.staropensource.engine.base.utility.DependencyResolver;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Represents a dependency vector, used by {@link DependencyResolver}.
- *
- * @since v1-alpha1
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration" })
-public class DependencyVector {
- /**
- * Contains the identifier of this vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the vector identifier.
- *
- * @return vector identifier
- * @since v1-alpha1
- */
- protected @NotNull String identifier;
-
- /**
- * Contains which versioning system this vector uses.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the versioning system this vector uses.
- *
- * @return versioning system in use
- * @since v1-alpha1
- */
- protected @NotNull Class extends VersioningSystem> versioningSystem;
-
- /**
- * Contains the version of this vector.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the vector version.
- *
- * @return vector version
- * @since v1-alpha1
- */
- protected @NotNull String version;
-
- /**
- * Contains a set of all identifiers and their versions this vector depends on.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Contains a set of all identifiers and their versions this vector depends on.
- *
- * @return dependencies
- * @since v1-alpha1
- */
- protected @NotNull Set<@NotNull String> dependencies;
-
- /**
- * Contains a set of all identifiers and their versions this vector provides.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Contains a set of all identifiers and their versions this vector provides.
- *
- * @return provided vectors
- * @since v1-alpha4
- */
- protected @NotNull Set<@NotNull String> provides;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param identifier identifier (name for example)
- * @param versioningSystem versioning system to use
- * @param version version
- * @param dependencies dependencies in the usual format ({@code dependencyA}, {@code dependencyB=5.1}, {@code dependencyC>3.1}, {@code dependencyD<6.1}, {@code dependencyE>5.3<5.4})
- * @param provides vectors this vector provides, in the usual format ({@code identifier=version})
- * @since v1-alpha4
- */
- protected DependencyVector(@NotNull String identifier, @NotNull Class extends VersioningSystem> versioningSystem, @NotNull String version, @NotNull Set<@NotNull String> dependencies, @NotNull Set<@NotNull String> provides) {
- this.identifier = identifier;
- this.versioningSystem = versioningSystem;
- this.version = version;
- this.dependencies = dependencies;
- this.provides = provides;
- }
-
- /**
- * Provides an API for building {@link DependencyVector}s more easily.
- *
- * @since v1-alpha4
- */
- @SuppressWarnings({ "unused" })
- public static class Builder {
- /**
- * Contains the identifier of the new vector.
- *
- * @see DependencyVector#identifier
- * @since v1-alpha4
- */
- private @Nullable String identifier;
-
- /**
- * Contains which versioning system the new vector should use.
- *
- * @see DependencyVector#versioningSystem
- * @since v1-alpha4
- */
- private @Nullable Class extends VersioningSystem> versioningSystem;
-
- /**
- * Contains the version of the new vector.
- *
- * @see DependencyVector#version
- * @since v1-alpha4
- */
- private @Nullable String version;
-
- /**
- * Contains a set of all identifiers and their versions the new vector should depend on.
- *
- * @see DependencyVector#dependencies
- * @since v1-alpha4
- */
- private @Nullable Set<@NotNull String> dependencies;
-
- /**
- * Contains a set of all identifiers and their versions the new vector should provide.
- *
- * @see DependencyVector#provides
- * @since v1-alpha4
- */
- private @Nullable Set<@NotNull String> provides;
-
- /**
- * Constructs this class.
- *
- * @since v1-alpha4
- */
- public Builder() {}
-
- /**
- * Builds a new {@link DependencyVector} instance.
- *
- * @return new {@link DependencyVector} instance
- * @throws IllegalStateException if {@link #identifier}, {@link #versioningSystem} or {@link #version} is unset or the version string is invalid
- * @since v1-alpha4
- */
- public @NotNull DependencyVector build() throws IllegalStateException {
- // Check for required fields
- checkRequiredFields();
-
- // Set defaults
- setDefaults();
-
- //noinspection DataFlowIssue // IDE is dumb
- return new DependencyVector(identifier, versioningSystem, version, dependencies, provides);
- }
-
- /**
- * Checks for required fields.
- *
- * @since v1-alpha4
- */
- protected void checkRequiredFields() throws IllegalStateException {
- if (identifier == null || identifier.isBlank())
- throw new IllegalStateException("The identifier is unset");
- if (versioningSystem == null)
- throw new IllegalStateException("The versioning system is unset");
- if (version == null || version.isBlank())
- throw new IllegalStateException("The version is unset");
-
- // Check if version string is valid
- try {
- versioningSystem.getDeclaredConstructor(String.class).newInstance(version);
- } catch (InvocationTargetException exception) {
- if (exception.getTargetException().getClass() == InvalidVersionStringException.class)
- throw new IllegalStateException("The version string is invalid: " + exception.getTargetException().getMessage());
- else
- throw new IllegalStateException("Version string validation failed: Constructor threw " + exception.getTargetException().getClass().getName() + ": " + exception.getTargetException().getMessage());
- } catch (Exception exception) {
- throw new IllegalStateException("Version string validation failed: Threw " + exception.getClass().getName() + ": " + exception.getMessage());
- }
- }
-
- /**
- * Allows extenders to set defaults.
- *
- * @since v1-alpha4
- */
- protected void setDefaults() {
- if (dependencies == null)
- dependencies = new HashSet<>();
- if (provides == null)
- provides = new HashSet<>();
- }
-
- /**
- * Returns the identifier of the new vector.
- *
- * @return identifier
- * @see DependencyVector#identifier
- * @since v1-alpha4
- */
- public final @Nullable String getIdentifier() {
- return identifier;
- }
-
- /**
- * Returns the versioning system the new vector should use.
- *
- * @return versioning system to use
- * @see DependencyVector#versioningSystem
- * @since v1-alpha4
- */
- public final @Nullable Class extends VersioningSystem> getVersioningSystem() {
- return versioningSystem;
- }
-
- /**
- * Returns the version of the new vector.
- *
- * @return vector version
- * @see DependencyVector#version
- * @since v1-alpha4
- */
- public final @Nullable String getVersion() {
- return version;
- }
-
- /**
- * Contains a set of all identifiers and their versions the new vector should depend on.
- *
- * @return dependencies
- * @see DependencyVector#dependencies
- * @since v1-alpha4
- */
- public final @Nullable Set<@NotNull String> getDependencies() {
- return dependencies;
- }
-
- /**
- * Contains a set of all identifiers and their versions the new vector should provide.
- *
- * @return provided vectors
- * @see DependencyVector#provides
- * @since v1-alpha4
- */
- public final @Nullable Set<@NotNull String> getProvides() {
- return provides;
- }
-
- /**
- * Sets the identifier of the new vector.
- *
- * @param identifier new identifier
- * @return builder instance
- * @see DependencyVector#identifier
- * @since v1-alpha4
- */
- public final @NotNull DependencyVector.Builder setIdentifier(@Nullable String identifier) {
- this.identifier = identifier;
- return this;
- }
-
- /**
- * Sets the versioning system the new vector should use.
- *
- * @param versioningSystem versioning system to use
- * @return builder instance
- * @see DependencyVector#versioningSystem
- * @since v1-alpha4
- */
- public final @NotNull DependencyVector.Builder setVersioningSystem(@Nullable Class extends VersioningSystem> versioningSystem) {
- this.versioningSystem = versioningSystem;
- return this;
- }
-
- /**
- * Sets the version of the new vector.
- *
- * @param version vector version
- * @return builder instance
- * @see DependencyVector#version
- * @since v1-alpha4
- */
- public final @NotNull DependencyVector.Builder setVersion(@Nullable String version) {
- this.version = version;
- return this;
- }
-
- /**
- * Sets a set of all identifiers and their versions the new vector should depend on.
- *
- * @param dependencies dependencies
- * @return builder instance
- * @see DependencyVector#dependencies
- * @since v1-alpha4
- */
- public final @NotNull DependencyVector.Builder setDependencies(@Nullable Set<@NotNull String> dependencies) {
- this.dependencies = dependencies;
- return this;
- }
-
- /**
- * Sets a set of all identifiers and their versions the new vector should provide.
- *
- * @param provides provided vectors
- * @return builder instance
- * @see DependencyVector#provides
- * @since v1-alpha4
- */
- public final @NotNull DependencyVector.Builder setProvides(@Nullable Set<@NotNull String> provides) {
- this.provides = provides;
- return this;
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/EngineState.java b/base/src/main/java/de/staropensource/engine/base/type/EngineState.java
deleted file mode 100644
index a83d3bf33..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/EngineState.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-/**
- * Determines in which state the engine is currently in.
- *
- * @since v1-alpha2
- */
-public enum EngineState {
- /**
- * Indicates that the state of the engine is
- * currently unknown. The engine is most likely
- * not initialized yet.
- *
- * @since v1-alpha2
- */
- UNKNOWN,
-
- /**
- * Indicates that the engine is largely
- * uninitialized and unsafe to use.
- *
- * @since v1-alpha8
- */
- EARLY_STARTUP,
-
- /**
- * Indicates that the core engine has fully
- * initialized, except for all subsystems.
- *
- * @since v1-alpha8
- */
- STARTUP,
-
- /**
- * Indicates that the engine is running
- * and operating normally.
- *
- * @since v1-alpha2
- */
- RUNNING,
-
- /**
- * Indicates that the engine or the
- * application has crashed.
- *
- * @since v1-alpha2
- */
- CRASHED,
-
- /**
- * Indicates that the engine is shutting
- * down. The engine is unusable in this
- * state and should not be used.
- *
- * @since v1-alpha8
- */
- SHUTDOWN,
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/InternalAccessArea.java b/base/src/main/java/de/staropensource/engine/base/type/InternalAccessArea.java
deleted file mode 100644
index 2f9ae3ac9..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/InternalAccessArea.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-import de.staropensource.engine.base.EngineInternals;
-import de.staropensource.engine.base.implementable.Event;
-import de.staropensource.engine.base.implementable.ShutdownHandler;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Specifies multiple areas of internal engine access.
- * Used for restricting access of internals.
- *
- * @see EngineInternals#restrictAccess(InternalAccessArea)
- * @since v1-alpha4
- */
-public enum InternalAccessArea {
- /**
- * Refers to all areas.
- *
- * @since v1-alpha4
- */
- ALL,
-
- /**
- * Refers to all write-only areas.
- *
- * @since v1-alpha4
- */
- ALL_WRITE,
-
- /**
- * Refers to all read-only areas.
- *
- * @since v1-alpha4
- */
- ALL_READ,
-
- /**
- * Refers to all essential read-only areas.
- *
- * Essential read-only areas are IIAs which are
- * very important and should not be restricted.
- *
- * @since v1-alpha5
- */
- ALL_READ_ESSENTIAL,
-
- /**
- * Refers to the toggling of the JVM shutdown hook, which
- * prevents JVM shutdowns without the engine first shutting down.
- *
- * @since v1-alpha4
- */
- SAFETY_SHUTDOWN_HOOK_UPDATE,
-
- /**
- * Refers to the getting of the engine's shutdown handler.
- * The {@link ShutdownHandler} handles the shutdown sequence
- * after the engine has been shut down.
- *
- * @since v1-alpha4
- */
- SHUTDOWN_HANDLER_GET,
-
- /**
- * Refers to the updating of the engine's shutdown handler.
- * The {@link ShutdownHandler} handles the shutdown sequence
- * after the engine has been shut down.
- *
- * @since v1-alpha4
- */
- SHUTDOWN_HANDLER_UPDATE,
-
- /**
- * Refers to the getting of the flag controlling whether
- * automatic {@link Event} classpath searching should be performed.
- *
- * @since v1-alpha5
- */
- REFLECTIVE_CLASSPATH_SCANNING_GET,
-
- /**
- * Refers to the overriding of the flag controlling whether
- * automatic {@link Event} classpath searching should be performed.
- *
- * @since v1-alpha5
- */
- REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE;
-
- /**
- * Returns all read-only areas.
- *
- * @return array containing all read-only areas
- * @since v1-alpha4
- */
- public static @NotNull InternalAccessArea @NotNull [] valuesReadOnly() {
- return new InternalAccessArea[]{
- SHUTDOWN_HANDLER_GET,
- };
- }
-
- /**
- * Returns all essential read-only areas.
- *
- * @return array containing all essential read-only areas
- * @since v1-alpha5
- */
- public static @NotNull InternalAccessArea @NotNull [] valuesEssentialReadOnly() {
- return new InternalAccessArea[]{
- REFLECTIVE_CLASSPATH_SCANNING_GET,
- };
- }
-
- /**
- * Returns all write-only areas.
- *
- * @return array containing all write-only areas
- * @since v1-alpha4
- */
- public static @NotNull InternalAccessArea @NotNull [] valuesWriteOnly() {
- return new InternalAccessArea[]{
- SAFETY_SHUTDOWN_HOOK_UPDATE,
- SHUTDOWN_HANDLER_UPDATE,
- REFLECTIVE_CLASSPATH_SCANNING_OVERRIDE,
- };
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/Tristate.java b/base/src/main/java/de/staropensource/engine/base/type/Tristate.java
deleted file mode 100644
index 4464ef1df..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/Tristate.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-import de.staropensource.engine.base.exception.TristateConversionException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Just a {@link Boolean}, but it can be {@link #UNSET}.
- *
- * @since v1-alpha1
- */
-public enum Tristate {
- /**
- * Defines an unset state.
- *
- * @since v1-alpha1
- */
- UNSET,
-
- /**
- * Defines a true state.
- *
- * @since v1-alpha1
- */
- TRUE,
-
- /**
- * Defines a false state.
- *
- * @since v1-alpha1
- */
- FALSE;
-
- /**
- * Converts the specified {@link Boolean} into a {@link Tristate}.
- *
- * @param bool boolean to convert
- * @return {@link Tristate} representation of the specified boolean
- * @since v1-alpha9
- */
- public static @NotNull Tristate toTristate(boolean bool) {
- if (bool) return Tristate.TRUE;
- else return Tristate.FALSE;
- }
-
- /**
- * Converts the specified {@link Integer} into a {@link Tristate}.
- *
- * @param integer integer to convert
- * @return {@link Tristate} representation of the specified integer
- * @since v1-alpha9
- */
- public static @NotNull Tristate toTristate(int integer) {
- return switch (integer) {
- case 0 -> Tristate.FALSE;
- case 1 -> Tristate.TRUE;
- case 2 -> Tristate.UNSET;
- default -> throw new IndexOutOfBoundsException("Supplied integer '" + integer + "' is not in range 0-2");
- };
- }
-
- /**
- * Converts this {@link Tristate} into a {@link Boolean}.
- * Make sure to check for {@link #UNSET} first.
- *
- * @return trimmed boolean representation of this {@link Tristate}
- * @throws TristateConversionException on encountering {@link #UNSET}
- * @since v1-alpha9
- */
- public boolean toBoolean() {
- return switch (this) {
- case UNSET -> throw new TristateConversionException();
- case TRUE -> true;
- case FALSE -> false;
- };
- }
-
- /**
- * Converts this {@link Tristate} into an {@link Integer}.
- *
- * @return integer representation of this {@link Tristate}
- * @throws TristateConversionException when encountering {@link #UNSET}
- * @since v1-alpha9
- */
- public int toInteger() {
- return switch (this) {
- case FALSE -> 0;
- case TRUE -> 1;
- case UNSET -> 2;
- };
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/VersionType.java b/base/src/main/java/de/staropensource/engine/base/type/VersionType.java
deleted file mode 100644
index cbbd206fa..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/VersionType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type;
-
-import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem;
-
-/**
- * Provides all available version types as specified
- * by the StarOpenSource Versioning System v2.
- *
- * @see StarOpenSourceVersioningSystem
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public enum VersionType {
- /**
- * Indicates that the next version is in the early stages of development and is highly experimental. Behaviour may break at and time and may contain bugs and issues.
- *
- * @since v1-alpha0
- */
- ALPHA,
-
- /**
- * Indicates that the next version is in development and is experimental. It may contain several bugs and issues.
- *
- * @since v1-alpha0
- */
- BETA,
-
- /**
- * Indicates that the application is nearing the next release. The application may be stable enough for regular usage but may need some testing to squash all remaining bugs.
- *
- * @since v1-alpha0
- */
- RELEASE_CANDIDATE,
-
- /**
- * Indicates that the application is fully tested, working and stable.
- *
- * @since v1-alpha0
- */
- RELEASE
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/logging/package-info.java b/base/src/main/java/de/staropensource/engine/base/type/logging/package-info.java
deleted file mode 100644
index af923eb9d..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/logging/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Data types related to logging.
- *
- * @see de.staropensource.engine.base.logging
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.type.logging;
diff --git a/base/src/main/java/de/staropensource/engine/base/type/package-info.java b/base/src/main/java/de/staropensource/engine/base/type/package-info.java
deleted file mode 100644
index 8918462f1..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Data types in form of enums and classes.
- *
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.type;
diff --git a/base/src/main/java/de/staropensource/engine/base/type/reflection/ClassType.java b/base/src/main/java/de/staropensource/engine/base/type/reflection/ClassType.java
deleted file mode 100644
index 7852fe999..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/reflection/ClassType.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.reflection;
-
-/**
- * Identifies a class' type.
- *
- * @since v1-alpha2
- */
-public enum ClassType {
- /**
- * Identifies the class as a {@code class} class.
- *
- * @since v1-alpha2
- */
- CLASS,
-
- /**
- * Identifies the class as an {@code interface} class.
- *
- * @since v1-alpha2
- */
- INTERFACE,
-
- /**
- * Identifies the class as an {@code enum} class.
- *
- * @since v1-alpha2
- */
- ENUM,
-
- /**
- * Identifies the class as a {@code record} class.
- *
- * @since v1-alpha2
- */
- RECORD,
-
- /**
- * Identifies the class as an unknown type the engine does not yet know of.
- *
- * @since v1-alpha2
- */
- UNKNOWN,
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/reflection/VisibilityModifier.java b/base/src/main/java/de/staropensource/engine/base/type/reflection/VisibilityModifier.java
deleted file mode 100644
index 38c0aba58..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/reflection/VisibilityModifier.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.reflection;
-
-import de.staropensource.engine.base.exception.UnexpectedCheckEndException;
-
-import java.lang.reflect.Modifier;
-
-/**
- * Contains which visibility a class, method or field has.
- *
- * @since v1-alpha2
- */
-public enum VisibilityModifier {
- /**
- * Marks the class, method or field as public.
- *
- * @since v1-alpha2
- */
- PUBLIC,
-
- /**
- * Marks the class, method or field as protected.
- *
- * @since v1-alpha2
- */
- PROTECTED,
-
- /**
- * Marks the class, method or field as private.
- *
- * @since v1-alpha2
- */
- PRIVATE;
-
- /**
- * Converts the visibility into a usable modifier bit.
- *
- * @return int
- * @since v1-alpha2
- */
- public int getModifier() {
- switch (this) {
- case PUBLIC -> {
- return Modifier.PUBLIC;
- }
- case PROTECTED -> {
- return Modifier.PROTECTED;
- }
- case PRIVATE -> {
- return Modifier.PRIVATE;
- }
- case null, default -> throw new UnexpectedCheckEndException("converting the visibility into a modifier");
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/reflection/package-info.java b/base/src/main/java/de/staropensource/engine/base/type/reflection/package-info.java
deleted file mode 100644
index 6b787503a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/reflection/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Data types related to reflection.
- *
- * @see de.staropensource.engine.base.reflection
- * @since v1-alpha2
- */
-package de.staropensource.engine.base.type.reflection;
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2d.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2d.java
deleted file mode 100644
index d5c70ee80..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2d.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 2D double Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec2d {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private double x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private double y;
-
- /**
- * Creates and initializes a new 2D double vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @since v1-alpha0
- */
- public Vec2d(double x, double y) {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec2d clone() {
- return (Vec2d) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2f.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2f.java
deleted file mode 100644
index 63e5c4d5f..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2f.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 2D float Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec2f {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private float x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private float y;
-
- /**
- * Creates and initializes a new 2D float vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @since v1-alpha0
- */
- public Vec2f(float x, float y) {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec2f clone() {
- return (Vec2f) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2i.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2i.java
deleted file mode 100644
index e7a6f0d64..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec2i.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 2D integer Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec2i implements Cloneable {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return the X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private int x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private int y;
-
- /**
- * Creates and initializes a new 2D integer vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @since v1-alpha0
- */
- public Vec2i(int x, int y) {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec2i clone() {
- return (Vec2i) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3d.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3d.java
deleted file mode 100644
index c679d87bd..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3d.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 3D double Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec3d {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private double x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private double y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha0
- */
- private double z;
-
- /**
- * Creates and initializes a new 3D double vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @since v1-alpha0
- */
- public Vec3d(double x, double y, double z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec3d clone() {
- return (Vec3d) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3f.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3f.java
deleted file mode 100644
index 89040c28e..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3f.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 3D float Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec3f {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private float x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private float y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha0
- */
- private float z;
-
- /**
- * Creates and initializes a new 3D float vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @since v1-alpha0
- */
- public Vec3f(float x, float y, float z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec3f clone() {
- return (Vec3f) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3i.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3i.java
deleted file mode 100644
index 598a7963a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec3i.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 3D integer Vector.
- *
- * @since v1-alpha0
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec3i {
- /**
- * The X axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha0
- */
- private int x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha0
- */
- private int y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha0
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha0
- */
- private int z;
-
- /**
- * Creates and initializes a new 3D integer vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @since v1-alpha0
- */
- public Vec3i(int x, int y, int z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha2
- */
- @SneakyThrows
- public @NotNull Vec3i clone() {
- return (Vec3i) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha2
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4d.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4d.java
deleted file mode 100644
index 65863b0cb..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4d.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 4D double Vector.
- *
- * @since v1-alpha6
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec4d {
- /**
- * The X axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha6
- */
- private double x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha6
- */
- private double y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha6
- */
- private double z;
-
- /**
- * The W axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the W axis value.
- *
- * @return W axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the W axis value.
- *
- * @param w W axis value
- * @since v1-alpha6
- */
- private double w;
-
- /**
- * Creates and initializes a new 4D double vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @param w W axis value
- * @since v1-alpha6
- */
- public Vec4d(double x, double y, double z, double w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha6
- */
- @SneakyThrows
- public @NotNull Vec4d clone() {
- return (Vec4d) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha6
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + " w=" + w + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4f.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4f.java
deleted file mode 100644
index ed5b33773..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4f.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 4D float Vector.
- *
- * @since v1-alpha6
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec4f {
- /**
- * The X axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha6
- */
- private float x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha6
- */
- private float y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha6
- */
- private float z;
-
- /**
- * The W axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the W axis value.
- *
- * @return W axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the W axis value.
- *
- * @param w W axis value
- * @since v1-alpha6
- */
- private float w;
-
- /**
- * Creates and initializes a new 4D float vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @param w W axis value
- * @since v1-alpha6
- */
- public Vec4f(float x, float y, float z, float w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha6
- */
- @SneakyThrows
- public @NotNull Vec4f clone() {
- return (Vec4f) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha6
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + " w=" + w + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4i.java b/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4i.java
deleted file mode 100644
index a25c846eb..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/Vec4i.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.type.vector;
-
-import de.staropensource.engine.base.EngineConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.SneakyThrows;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a 4D integer Vector.
- *
- * @since v1-alpha6
- */
-@Getter
-@Setter
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class Vec4i {
- /**
- * The X axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the X axis value.
- *
- * @return X axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the X axis value.
- *
- * @param x X axis value
- * @since v1-alpha6
- */
- private int x;
-
- /**
- * The Y axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Y axis value.
- *
- * @return Y axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Y axis value.
- *
- * @param y Y axis value
- * @since v1-alpha6
- */
- private int y;
-
- /**
- * The Z axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the Z axis value.
- *
- * @return Z axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the Z axis value.
- *
- * @param z Z axis value
- * @since v1-alpha6
- */
- private int z;
-
- /**
- * The W axis value.
- *
- * @since v1-alpha6
- * -- GETTER --
- * Returns the W axis value.
- *
- * @return W axis value
- * @since v1-alpha6
- * -- SETTER --
- * Sets the W axis value.
- *
- * @param w W axis value
- * @since v1-alpha6
- */
- private int w;
-
- /**
- * Creates and initializes a new 4D integer vector.
- *
- * @param x X axis value
- * @param y Y axis value
- * @param z Z axis value
- * @param w W axis value
- * @since v1-alpha6
- */
- public Vec4i(int x, int y, int z, int w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
- }
-
- /**
- * Creates an identical copy of this vector.
- *
- * @return identical copy
- * @since v1-alpha6
- */
- @SneakyThrows
- public @NotNull Vec4i clone() {
- return (Vec4i) super.clone();
- }
-
- /**
- * Returns a string representation of this vector.
- *
- * @return string representation
- * @since v1-alpha6
- */
- @Override
- public @NotNull String toString() {
- return (EngineConfiguration.getInstance().isHideFullTypePath()
- ? getClass().getName().replace(getClass().getPackage() + ".", "")
- : getClass().getName())
- + "(x=" + x + " y=" + y + " z=" + z + " w=" + w + ")";
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/type/vector/package-info.java b/base/src/main/java/de/staropensource/engine/base/type/vector/package-info.java
deleted file mode 100644
index 9df746685..000000000
--- a/base/src/main/java/de/staropensource/engine/base/type/vector/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Data types operating with sets of numbers.
- *
- * @since v1-alpha1
- */
-package de.staropensource.engine.base.type.vector;
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/DependencyResolver.java b/base/src/main/java/de/staropensource/engine/base/utility/DependencyResolver.java
deleted file mode 100644
index 63f101325..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/DependencyResolver.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility;
-
-import de.staropensource.engine.base.exception.dependency.DependencyCycleException;
-import de.staropensource.engine.base.exception.dependency.UnmetDependenciesException;
-import de.staropensource.engine.base.implementable.VersioningSystem;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.DependencyVector;
-import lombok.Getter;
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Resolves dependency vectors.
- *
- * @since v1-alpha1
- */
-@SuppressWarnings({ "unused", "UnusedReturnValue", "JavadocDeclaration" })
-public final class DependencyResolver {
- /**
- * List of {@link DependencyVector}s to resolve.
- *
- * @since v1-alpha1
- */
- @NotNull Set vectors = new HashSet<>();
-
- /**
- * Contains whether the current {@link DependencyVector} list has been resolved successfully.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns whether the current {@link DependencyVector} list has been resolved successfully.
- *
- * @return resolved status
- * @since v1-alpha1
- */
- @Getter
- private boolean resolved = false;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha1
- */
- public DependencyResolver() {}
-
- /**
- * Adds a {@link DependencyVector}.
- *
- * @param vector {@link DependencyVector} to add
- * @return itself
- * @throws IllegalArgumentException if the specified vector has been added already
- * @since v1-alpha1
- */
- public synchronized @NotNull DependencyResolver addVector(@NotNull DependencyVector vector) throws IllegalArgumentException {
- if (vectors.contains(vector))
- throw new IllegalArgumentException("The specified vector has been added already");
-
- try {
- vectors.add(vector);
- } catch (IllegalArgumentException ignored) {}
- resolved = false;
- return this;
- }
-
- /**
- * Adds multiple dependency vectors.
- *
- * @param vectors {@link DependencyVector}s to add
- * @return itself
- * @since v1-alpha1
- */
- public @NotNull DependencyResolver addVectors(@NotNull DependencyVector @NotNull [] vectors) {
- return addVectors(Arrays.stream(vectors).toList());
- }
-
- /**
- * Adds multiple dependency vectors.
- *
- * @param vectors {@link DependencyVector}s to add
- * @return itself
- * @since v1-alpha1
- */
- public @NotNull DependencyResolver addVectors(@NotNull Collection extends @NotNull DependencyVector> vectors) {
- for (DependencyVector vector : vectors) // thread-safety
- addVector(vector);
- return this;
- }
-
- /**
- * Resolves all dependency vectors.
- * Throws an exception when detecting an unmet dependency or a dependency cycle.
- *
- * @return itself
- * @throws IllegalStateException when encountering an invalid vector
- * @throws UnmetDependenciesException when dependencies are unmet
- * @throws DependencyCycleException when a circular dependency is found
- * @since v1-alpha4
- */
- public synchronized @NotNull DependencyResolver resolve() throws IllegalStateException, UnmetDependenciesException {
- List<@NotNull String> unmetDependencies = new ArrayList<>();
- List<@NotNull String> output;
-
- for (DependencyVector vector : vectors)
- unmetDependencies.addAll(resolveVector(vector, new LinkedHashSet<>()));
-
- if (!unmetDependencies.isEmpty())
- throw new UnmetDependenciesException(unmetDependencies);
-
- resolved = true;
- return this;
- }
-
- /**
- * Resolves a vector.
- * Throws an exception when detecting an unmet dependency or a dependency cycle.
- *
- * @return list of unmet dependencies
- * @throws IllegalStateException when encountering an invalid dependency or provider
- * @throws DependencyCycleException when a circular dependency is found
- * @throws Exception when some unknown error occurs
- * @since v1-alpha4
- */
- private @NotNull List<@NotNull String> resolveVector(@NotNull DependencyVector vector, @NotNull LinkedHashSet<@NotNull String> vectorsDependencyStack) throws IllegalStateException, DependencyCycleException {
- List<@NotNull String> unmetDependencies = new ArrayList<>();
-
- vectorsDependencyStack.add(vector.getIdentifier());
-
- // 0 = identifier
- // 1 = version equal
- // 2 = version smaller
- // 3 = version bigger
- int mode;
- boolean[] duplicateCheck;
- StringBuilder identifier;
- StringBuilder versionEqual;
- StringBuilder versionSmaller;
- StringBuilder versionBigger;
- for (String dependency : vector.getDependencies()) {
- mode = 0;
- duplicateCheck = new boolean[3];
- identifier = new StringBuilder();
- versionEqual = new StringBuilder();
- versionSmaller = new StringBuilder();
- versionBigger = new StringBuilder();
-
- // Get variables
- for (char character : dependency.toCharArray()) {
- switch (character) {
- case '=' -> {
- // Check for duplicate
- if (duplicateCheck[0])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '=' characters");
-
- // Update mode
- mode = 1;
-
- continue;
- }
- case '<' -> {
- // Check for duplicate
- if (duplicateCheck[1])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '<' characters");
-
- // Update mode
- mode = 2;
- continue;
- }
- case '>' -> {
- // Check for duplicate
- if (duplicateCheck[2])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '>' characters");
-
- // Update mode
- mode = 3;
- continue;
- }
- }
-
- switch (mode) {
- // Identifier
- case 0 -> identifier.append(character);
- // Version equal
- case 1 -> {
- duplicateCheck[0] = true;
-
- // Check for smaller and bigger than
- if (duplicateCheck[1] || duplicateCheck[2])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot require a specific version and have minimum and maximum version specifiers");
-
- versionEqual.append(character);
- }
- // Version smaller
- case 2 -> {
- duplicateCheck[1] = true;
-
- // Check for equal
- if (duplicateCheck[0])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot require a specific version and have minimum and maximum version specifiers");
-
- versionSmaller.append(character);
- }
- // Version bigger
- case 3 -> {
- duplicateCheck[2] = true;
-
- // Check for equal
- if (duplicateCheck[0])
- throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot require a specific version and have minimum and maximum version specifiers");
-
- versionBigger.append(character);
- }
- }
- }
-
- // Get vector with same identifier
- DependencyVector vectorDependency = getMatchingVector(identifier.toString());
- if (vectorDependency == null) {
- unmetDependencies.add("Dependency \"" + dependency + "\" is not met: Not found");
- continue;
- }
-
- // Resolve vector
- if (vectorsDependencyStack.contains(vectorDependency.getIdentifier())) {
- StringBuilder cycle = new StringBuilder();
-
- for (String component : vectorsDependencyStack) {
- if (!cycle.isEmpty())
- cycle.append(" -> ");
-
- cycle.append(component);
- }
-
- cycle
- .append(" -> ")
- .append(identifier);
-
- throw new DependencyCycleException("Dependency cycle detected: " + cycle);
- } else
- resolveVector(vectorDependency, vectorsDependencyStack);
-
- VersioningSystem versioningSystemResolved;
-
- // Get resolved versioning system
- try {
- versioningSystemResolved = vectorDependency.getVersioningSystem().getDeclaredConstructor(String.class).newInstance(vectorDependency.getVersion());
- } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
- Logger.crash("Unable to check version of dependency \"" + dependency + "\": Unable to initialize versioning system " + vectorDependency.getVersioningSystem().getName(), exception);
- break;
- }
-
- // Compare
- if (!versionEqual.isEmpty()) { // Version equals
- VersioningSystem versioningSystemEquals;
-
- // Get expected VersioningSystem
- try {
- versioningSystemEquals = vectorDependency.getVersioningSystem().getDeclaredConstructor(String.class).newInstance(versionEqual.toString());
- } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
- Logger.crash("Unable to check version of dependency \"" + dependency + "\": Unable to initialize versioning system " + vectorDependency.getVersioningSystem().getName(), exception);
- break;
- }
-
- // Compare versions
- if (versioningSystemResolved.compare(versioningSystemEquals) != 1)
- unmetDependencies.add("Dependency \"" + dependency + "\" is not met: Expected version " + versionEqual + " does not match found version " + vector.getVersion());
- } else if (!versionBigger.isEmpty() || !versionSmaller.isEmpty()) {
- VersioningSystem versioningSystemSmaller = null;
- VersioningSystem versioningSystemBigger = null;
-
- if (!versionSmaller.isEmpty())
- // Get expected VersioningSystem
- try {
- versioningSystemSmaller = vectorDependency.getVersioningSystem().getDeclaredConstructor(String.class).newInstance(versionSmaller.toString());
- } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
- Logger.crash("Unable to check version of dependency \"" + dependency + "\": Unable to initialize versioning system " + vectorDependency.getVersioningSystem().getName(), exception);
- break;
- }
- if (!versionBigger.isEmpty())
- // Get expected VersioningSystem
- try {
- versioningSystemBigger = vectorDependency.getVersioningSystem().getDeclaredConstructor(String.class).newInstance(versionBigger.toString());
- } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
- Logger.crash("Unable to check version of dependency \"" + dependency + "\": Unable to initialize versioning system " + vectorDependency.getVersioningSystem().getName(), exception);
- break;
- }
-
- // Compare versions
- if (versioningSystemSmaller != null && versioningSystemBigger != null) {
- if (versioningSystemResolved.compare(versioningSystemSmaller) != 2 || versioningSystemResolved.compare(versioningSystemBigger) != 0)
- unmetDependencies.add("Dependency \"" + dependency + "\" is not met: Version " + vector.getVersion() + " is not in range " + versionSmaller + " to " + versionBigger);
- } else {
- if (versioningSystemSmaller != null)
- if (versioningSystemResolved.compare(versioningSystemSmaller) != 2)
- unmetDependencies.add("Dependency \"" + dependency + "\" is not met: Version " + vector.getVersion() + " is bigger than " + versionSmaller);
- if (versioningSystemBigger != null)
- if (versioningSystemResolved.compare(versioningSystemBigger) != 0)
- unmetDependencies.add("Dependency \"" + dependency + "\" is not met: Version " + vector.getVersion() + " is smaller than " + versionBigger);
- }
- }
- }
-
- vectorsDependencyStack.remove(vector.getIdentifier());
- return unmetDependencies;
- }
-
- /**
- * Searches all registered {@link DependencyVector}s for the specified identifier
- * and returns the first matching one.
- *
- * @return matching vector or {@code null} if not found
- * @since v1-alpha4
- */
- private @Nullable DependencyVector getMatchingVector(@NotNull String identifier) {
- for (DependencyVector vector : vectors) {
- if (vector.getIdentifier().equals(identifier)) {
- return vector;
- } else {
- // Search 'provides' for matches
- for (String provider : vector.getProvides())
- if (provider.substring(0, provider.indexOf("=")).equals(identifier))
- return vector;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the correct order which stuff needs to be loaded/done in.
- *
- * @return {@link LinkedList} with dependencies first and dependents last
- * @throws IllegalStateException when the current dependency vector list has not been resolved yet. in this case, just invoke {@code resolve()}
- * @since v1-alpha1
- */
- @ApiStatus.Experimental() // TODO
- public LinkedList getOrder() throws IllegalStateException {
- if (!resolved)
- throw new IllegalStateException("The current dependency vector list has not been resolved yet");
-
- return new LinkedList<>();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/FileAccess.java b/base/src/main/java/de/staropensource/engine/base/utility/FileAccess.java
deleted file mode 100644
index 5cece01d0..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/FileAccess.java
+++ /dev/null
@@ -1,1170 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.EngineState;
-import de.staropensource.engine.base.utility.misc.Miscellaneous;
-import lombok.Getter;
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.*;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.nio.file.attribute.PosixFilePermissions;
-import java.util.*;
-import java.util.stream.Stream;
-
-/**
- * Provides a simplified way of
- * accessing files and directories.
- *
- * @since v1-alpha8
- */
-@Getter
-@SuppressWarnings({ "JavadocDeclaration", "unused" })
-public final class FileAccess {
- // -----> Static variables
- /**
- * Contains a list of all files and directories
- * which should be deleted at shutdown.
- *
- * While this feature is built into Java, in
- * our testing it did not seem to work correctly.
- * That's why we're implementing it here.
- *
- * @since v1-alpha8
- */
- private static @NotNull Path[] scheduledDeletion = new Path[0];
-
- /**
- * Contains a {@link FileAccess} instance to
- * a temporary cache directory provided by the engine.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns a {@link FileAccess} instance to
- * a temporary cache directory provided by the engine.
- *
- * @return temporary cache directory
- * @since v1-alpha9
- */
- @Getter
- private static FileAccess temporaryCacheDirectory;
-
- /**
- * Contains a {@link FileAccess} instance to
- * the persistent cache directory of the system.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns a {@link FileAccess} instance to
- * the persistent cache directory of the system.
- *
- * @return persistent cache directory
- * @since v1-alpha9
- */
- @Getter
- private static FileAccess persistentCacheDirectory;
-
- /**
- * Contains a {@link FileAccess} instance
- * to the user's home directory.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns a {@link FileAccess} instance
- * to the user's home directory.
- *
- * @return home directory
- * @since v1-alpha9
- */
- @Getter
- private static FileAccess homeDirectory;
-
- /**
- * Contains a {@link FileAccess} instance
- * to the user's configuration directory.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns a {@link FileAccess} instance
- * to the user's configuration directory.
- *
- * @return configuration directory
- * @since v1-alpha9
- */
- @Getter
- private static FileAccess configDirectory;
-
- /**
- * Contains a {@link FileAccess} instance
- * to the user's data directory.
- *
- * @since v1-alpha9
- * -- GETTER --
- * Returns a {@link FileAccess} instance
- * to the user's data directory.
- *
- * @return data directory
- * @since v1-alpha9
- */
- @Getter
- private static FileAccess dataDirectory;
-
- // -----> Instance variables
- /**
- * Contains the {@link Path} to this file or directory.
- *
- * @since v1-alpha8
- * -- GETTER --
- * Returns the {@link Path} to this file or directory.
- *
- * Please only use this method when you have to.
- * Use the methods in this class instead, if you can.
- *
- * @return associated {@link Path} instance
- * @since v1-alpha8
- */
- private final @NotNull Path path;
-
- /**
- * Contains the {@link File} to this file or directory.
- *
- * @since v1-alpha8
- * -- GETTER --
- * Returns the {@link File} to this file or directory.
- *
- * Please only use this method when you have to.
- * Use the methods in this class instead, if you can.
- *
- * @return associated {@link File} instance
- * @since v1-alpha8
- */
- private final @NotNull File file;
-
- // -----> Constructors
- /**
- * Creates and initializes an instance of this class.
- *
- * @param path path you wish to access
- * @throws InvalidPathException if a {@link Path} cannot be created (see {@link FileSystem#getPath(String, String...)})
- * @since v1-alpha8
- */
- public FileAccess(@NotNull String path) throws InvalidPathException {
- this.path = formatPath(path).toAbsolutePath();
- this.file = new File(path);
- }
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param path path you wish to access
- * @since v1-alpha8
- */
- public FileAccess(@NotNull Path path) {
- this.path = path.toAbsolutePath();
- this.file = this.path.toFile();
- }
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param file {@link File} to the path you wish to access
- * @throws InvalidPathException if a {@link Path} cannot be created (see {@link FileSystem#getPath(String, String...)})
- * @since v1-alpha8
- */
- public FileAccess(@NotNull File file) throws InvalidPathException {
- this.path = file.toPath().toAbsolutePath();
- this.file = file;
- }
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param uri {@link URI} to the path you wish to access
- * @throws FileSystemNotFoundException if the filesystem is not supported by Java
- * @throws IllegalArgumentException if the URI is improperly formatted
- * @since v1-alpha8
- */
- public FileAccess(@NotNull URI uri) throws FileSystemNotFoundException, IllegalArgumentException {
- this.path = Path.of(uri);
- this.file = new File(uri);
- }
-
-
- // -----> Static instance initialization
- /**
- * Initializes all uninitialized static
- * {@link FileAccess} instances.
- *
- * Only works during early engine startup.
- *
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public static void initializeInstances() throws IOException {
- // TODO add support for non-default and/or non-unix directories here
-
- if (Engine.getInstance().getState() == EngineState.EARLY_STARTUP) {
- temporaryCacheDirectory = new FileAccess(System.getProperties().getProperty("java.io.tmpdir") + "/sosengine-cache-" + ProcessHandle.current().pid()).createDirectory().deleteOnShutdown();
- homeDirectory = new FileAccess(System.getProperties().getProperty("user.home")).createDirectory();
- persistentCacheDirectory = homeDirectory.traverse( ".cache").createDirectory();
- configDirectory = homeDirectory.traverse(".config").createDirectory();
- dataDirectory = homeDirectory.traverse(".local/share").createDirectory();
- }
- }
- /**
- * Deletes all files scheduled for deletion.
- *
- * Only works during engine shutdown.
- *
- * @since v1-alpha8
- */
- public static void deleteScheduled() {
- if (Engine.getInstance().getState() == EngineState.SHUTDOWN || Engine.getInstance().getState() == EngineState.CRASHED) {
- Logger.verb("Deleting files scheduled for deletion on shutdown");
-
- for (Path path : scheduledDeletion)
- try (Stream stream = Files.walk(path)) {
- Logger.diag("Deleting file or directory '" + path + "'");
- //noinspection ResultOfMethodCallIgnored
- stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
-
- if (Files.exists(path))
- Logger.error("Deleting file or directory '" + path + "' failed");
- } catch (Exception exception) {
- Logger.error("File or directory '" + path + "' could not be deleted\n" + Miscellaneous.throwableHeader(exception) + "\n" + Miscellaneous.stacktraceAsString(exception, true));
- }
- }
- }
-
-
- // -----> Path formatting
- /**
- * Formats the path into a {@link Path} instance.
- *
- * @param path path to format
- * @return formatted {@link Path}
- * @since v1-alpha8
- */
- public static @NotNull Path formatPath(@NotNull String path) {
- return Path.of(
- path
- .replace("\\", "/")
- .replace("/./", "/")
- .replace("/", File.separator)
- );
- }
-
- /**
- * Unformats the a {@link Path} instance into a string.
- *
- * @param path {@link Path} to unformat
- * @return unformatted path
- * @since v1-alpha8
- */
- public static @NotNull String unformatPath(@NotNull Path path) {
- return path
- .toString()
- .replace(File.separator, "/");
- }
-
-
- // -----> File getters & setters
- /**
- * Returns the absolute path of this file.
- *
- * This method returns the path with
- * {@code /} (slash) separators.
- *
- * @return absolute path
- * @see #getPath()
- * @since v1-alpha8
- */
- public @NotNull String getPath() {
- return unformatPath(path);
- }
-
- /**
- * Returns the absolute path of this file.
- *
- * This method returns the path with
- * {@code /} (slash) separators.
- *
- * @return absolute path
- * @see #getPath()
- * @since v1-alpha8
- */
- @Override
- public @NotNull String toString() {
- return getPath();
- }
-
- /**
- * Returns the absolute path of this file.
- *
- * This method returns the path as seen
- * by the operating system and JVM (i.e.
- * with {@link File#separator} separators)
- *
- * @return absolute path
- * @see #getPath()
- * @since v1-alpha9
- */
- public @NotNull String getRawPath() {
- return path.toString();
- }
-
- /**
- * Returns the file name.
- *
- * @param excludeExtension if to remove the extension (e.g. {@code .txt}, {@code .java})
- * @return file name
- * @since v1-alpha8
- */
- public @NotNull String getFileName(boolean excludeExtension) {
- if (excludeExtension)
- return file.getName().replaceFirst("[.][^.]+$", "");
- else
- return file.getName();
- }
-
- /**
- * Returns whether or not this file exists.
- *
- * @return exists?
- * @since v1-alpha8
- */
- public boolean exists() {
- return Files.exists(path);
- }
-
- /**
- * Returns the type of this file.
- *
- * @return file type
- * @since v1-alpha8
- */
- public @NotNull FileAccess.Type getType() {
- if (!exists())
- return Type.VOID;
- else if (Files.isRegularFile(path))
- return Type.FILE;
- else if (Files.isDirectory(path))
- return Type.DIRECTORY;
- else
- return Type.UNKNOWN;
- }
-
- /**
- * Returns whether or not this file is a symbolic link.
- *
- * @return symbolic link?
- * @since v1-alpha8
- */
- public boolean isSymbolicLink() {
- return Files.isSymbolicLink(path);
- }
-
- /**
- * Returns whether or not the file is hidden.
- *
- * @return is hidden?
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public boolean isHidden() throws IOException {
- return Files.isHidden(path);
- }
-
- /**
- * Returns the names of all files and
- * directories in this directory.
- *
- * @return array of file and directory names
- * @throws UnsupportedOperationException if this file isn't a directory
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull String @NotNull [] list() throws UnsupportedOperationException, IOException {
- if (getType() != Type.DIRECTORY)
- throw new UnsupportedOperationException("The file '" + path + "' is not a directory");
-
- String[] list = file.list();
-
- if (list == null)
- throw new IOException("list is null (isn't a directory although it should be one)");
- else
- return list;
- }
-
- /**
- * Returns the names of all files
- * in this directory.
- *
- * @return array of file names
- * @throws UnsupportedOperationException if this file isn't a directory
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull String @NotNull [] listFiles() throws UnsupportedOperationException, IOException {
- if (getType() != Type.DIRECTORY)
- throw new UnsupportedOperationException("The file '" + path + "' is not a directory");
-
- String[] listArray = file.list();
- List<@NotNull String> list = new ArrayList<>();
-
- if (listArray == null)
- throw new IOException("list is null (isn't a directory although it should be one)");
-
- for (String item : listArray)
- if (path.resolve(item).toFile().isFile())
- list.add(item);
-
- return list.toArray(new String[0]);
- }
-
- /**
- * Returns the names of all
- * directories in this directory.
- *
- * @return array of directory names
- * @throws UnsupportedOperationException if this file isn't a directory
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull String @NotNull [] listDirectories() throws UnsupportedOperationException, IOException {
- if (getType() != Type.DIRECTORY)
- throw new UnsupportedOperationException("The file '" + path + "' is not a directory");
-
- String[] listArray = file.list();
- List<@NotNull String> list = new ArrayList<>();
-
- if (listArray == null)
- throw new IOException("list is null (isn't a directory although it should be one)");
-
- for (String item : listArray)
- if (path.resolve(item).toFile().isDirectory())
- list.add(item);
-
- return list.toArray(new String[0]);
- }
-
- /**
- * Returns the destination of the symbolic link.
- *
- * @return file type
- * @throws UnsupportedOperationException if the file is not a symbolic link
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull String getLinkDestination() throws IOException {
- if (!isSymbolicLink())
- throw new UnsupportedOperationException("The file '" + path + "' is not a symbolic link");
- return unformatPath(Files.readSymbolicLink(path));
- }
-
- // -----> Permissions
- /**
- * Returns whether or not the file can be read from.
- *
- * @return can be read?
- * @since v1-alpha8
- */
- public boolean isReadable() {
- return Files.isReadable(path);
- }
-
- /**
- * Returns whether or not the file can be written to.
- *
- * @return can be written?
- * @since v1-alpha8
- */
- public boolean isWritable() {
- return Files.isWritable(path);
- }
-
- /**
- * Returns whether or not the file can be executed.
- *
- * @return can be executed?
- * @since v1-alpha8
- */
- public boolean isExecutable() {
- return Files.isExecutable(path);
- }
-
- /**
- * Returns the file's permissions the
- * POSIX {@code rwxrwxrwx} format.
- *
- * @return POSIX permissions format
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull String getPosixPermissions() throws IOException {
- try {
- return PosixFilePermissions.toString(Files.getPosixFilePermissions(path));
- } catch (UnsupportedOperationException exception) {
- // POSIX permissions are not supported
- // For the Macrohard Windoze users under us
- StringBuilder output = new StringBuilder();
-
- if (isReadable())
- output.append("r");
- if (isWritable())
- output.append("w");
- if (isExecutable())
- output.append("x");
-
- // Repeat the same thing two times
- output.repeat(output, 2);
-
- return output.toString();
- }
- }
-
- /**
- * Returns the file's permissions the
- * POSIX {@code rwxrwxrwx} format.
- *
- * @param permissions POSIX {@code rwxrwxrwx} permission format
- * @return this instance
- * @throws IllegalArgumentException if the format of the {@code permissions} argument is invalid
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- @SuppressWarnings({ "RegExpSingleCharAlternation", "ResultOfMethodCallIgnored" })
- public @NotNull FileAccess setPosixPermissions(@NotNull String permissions) throws IllegalArgumentException, IOException {
- if (
- permissions.length() != 9
- || !permissions.matches("^(r|-)(w|-)(x|-)(r|-)(w|-)(x|-)(r|-)(w|-)(x|-)$")
- )
- throw new IllegalArgumentException("Invalid permission format: " + permissions);
-
- try {
- Logger.diag("Setting POSIX file permissions for '" + path + "' to '" + permissions + "'");
- Files.setPosixFilePermissions(path, PosixFilePermissions.fromString(permissions));
- } catch (UnsupportedOperationException exception) {
- Logger.diag("Setting POSIX file permissions for '" + path + "' to '" + permissions.substring(0, 2) + "'");
- char @NotNull [] chars = permissions.toCharArray();
-
- for (int permission = 0; permission < 3; permission++) {
- boolean enabled = chars[permission] != '-';
-
- switch (permission) {
- case 0 -> file.setReadable(enabled);
- case 1 -> file.setWritable(enabled);
- case 2 -> file.setExecutable(enabled);
- }
- }
- }
-
- return this;
- }
-
-
- // -----> Filesystem information
- /**
- * Returns the filesystem of this file.
- *
- * @return filesystem
- * @since v1-alpha8
- */
- public @NotNull FileSystem getFilesystem() {
- return path.getFileSystem();
- }
- /**
- * Returns whether or not the filesystem is POSIX-compliant.
- *
- * @return POSIX compliant?
- * @since v1-alpha8
- */
- public boolean isFilesystemPosixCompliant() {
- return path.getFileSystem().supportedFileAttributeViews().contains("posix");
- }
-
- /**
- * Returns all forbidden file names.
- *
- * The required functionality is not yet
- * implemented. As such, this method
- * will just return an empty array.
- *
- * @return forbidden file names
- * @since v1-alpha8
- */
- @ApiStatus.Experimental
- public @NotNull String @NotNull [] getRestrictedFileNames() {
- return new String[0];
- }
-
- /**
- * Returns all forbidden characters in file names.
- *
- * The required functionality is not yet
- * implemented. As such, this method
- * will just return an empty array.
- *
- * @return forbidden characters
- * @since v1-alpha8
- */
- @ApiStatus.Experimental
- public char @NotNull [] getRestrictedCharacters() {
- return new char[0];
- }
-
-
- // -----> Directory traversal
- /**
- * Returns the parent directory.
- *
- * @return new {@link FileAccess} instance to the parent directory
- * @since v1-alpha8
- */
- public @NotNull FileAccess parent() {
- return new FileAccess(path.getParent());
- }
-
- /**
- * Traverses through directories and files.
- *
- * @param path path to traverse
- * @return new {@link FileAccess} instance
- * @since v1-alpha8
- */
- public @NotNull FileAccess traverse(@NotNull String path) {
- return new FileAccess(this.path.resolve(formatPath(path)));
- }
-
- /**
- * Traverses through directories and files.
- *
- * @param path path to traverse
- * @return new {@link FileAccess} instance
- * @throws FileNotFoundException if the specified path does not exist
- * @since v1-alpha8
- */
- public @NotNull FileAccess traverseIfExists(@NotNull String path) throws FileNotFoundException {
- Path pathResolved = this.path.resolve(formatPath(path));
-
- if (!Files.exists(pathResolved))
- throw new FileNotFoundException("Traversal failed as relative path '" + path + "' does not exist from absolute path '" + path + "'");
-
- return new FileAccess(pathResolved);
- }
-
-
- // -----> File/Directory creation, moving, copying and deletion
- /**
- * Creates the file.
- * If it already exists, nothing will be done.
- *
- * @return this instance
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- @SuppressWarnings({"UnusedReturnValue", "ResultOfMethodCallIgnored"})
- public @NotNull FileAccess createFile() throws IOException {
- if (!exists()) {
- Logger.diag("Creating a file at '" + path + "'");
- file.getParentFile().mkdirs();
- file.createNewFile();
- }
-
- return this;
- }
-
- /**
- * Creates the directory recursively.
- * If it already exists, nothing will be done.
- *
- * @return this instance
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull FileAccess createDirectory() throws IOException {
- if (!exists()) {
- Logger.diag("Creating a directory at '" + path + "'");
- if (!file.mkdirs())
- throw new IOException("Creating directory '" + path + "' recursively failed");
- }
-
- return this;
- }
-
- /**
- * Creates a symbolic link at this location.
- * If it already exists, nothing will be done.
- *
- * @param hard creates a hard link if {@code true} or a symbolic link if {@code false}
- * @param destination destination of the new link
- * @return this instance
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- @SuppressWarnings("UnusedReturnValue")
- public @NotNull FileAccess createLink(boolean hard, @NotNull String destination) throws IOException {
- if (!exists()) {
- Logger.diag("Creating a " + (hard ? "hard" : "symbolic") + " link at '" + path + "'");
-
- if (hard)
- Files.createLink(path, formatPath(destination));
- else
- Files.createSymbolicLink(path, formatPath(destination));
- }
-
- return this;
- }
-
- /**
- * Moves this file.
- *
- * @param destination destination to move this file to
- * @return supplied destination
- * @throws IOException on an IO error
- * @since v1-alpha9
- */
- public @NotNull FileAccess move(@NotNull FileAccess destination) throws IOException {
- Logger.diag("Moving '" + path + "' to '" + destination.path + "'");
- Files.move(path, destination.path, StandardCopyOption.REPLACE_EXISTING);
- return destination;
- }
-
- /**
- * Copies this file.
- *
- * @param destination destination to copy this file to
- * @return this instance
- * @throws IOException on an IO error
- * @since v1-alpha9
- */
- public @NotNull FileAccess copy(@NotNull FileAccess destination) throws IOException {
- Logger.diag("Copying '" + path + "' to '" + destination.path + "'");
- if (file.isDirectory())
- Files.walkFileTree(path, new CopyDirectoryVisitor(path, destination.path));
- else
- Files.copy(path, destination.path, StandardCopyOption.REPLACE_EXISTING);
- return this;
- }
-
- /**
- * Deletes this file.
- * If it doesn't exist, nothing will be done.
- *
- * @return this instance
- * @throws IOException on an IO error
- * @since v1-alpha8
- */
- public @NotNull FileAccess delete() throws IOException {
- if (exists()) {
- Logger.diag("Deleting '" + path + "'");
-
- // Recursively delete if directory
- if (getFile().isDirectory())
- Files.walkFileTree(path, new DeleteDirectoryVisitor(path));
-
- //noinspection ResultOfMethodCallIgnored
- file.delete();
- }
- return this;
- }
-
- /**
- * Marks this file for deletion at engine shutdown.
- *
- * @return this instance
- * @see Engine#shutdown()
- * @see Engine#shutdown(int)
- * @since v1-alpha8
- */
- public @NotNull FileAccess deleteOnShutdown() {
- Logger.diag("Marking '" + path + "' for deletion at engine shutdown");
-
- // Append path to scheduledDeletion array
- List<@NotNull Path> scheduledDeletionList = new ArrayList<>(Arrays.stream(scheduledDeletion).toList());
- scheduledDeletionList.add(path);
- scheduledDeletion = scheduledDeletionList.toArray(new Path[0]);
-
- return this;
- }
-
-
- // -----> File locking
- /**
- * Returns whether or not this file is locked.
- *
- * @return is locked?
- * @since v1-alpha8
- */
- public boolean isLocked() {
- return false;
- }
-
- /**
- * Locks this file.
- *
- * @return this instance
- * @since v1-alpha8
- */
- public @NotNull FileAccess lock() {
- return this;
- }
-
- /**
- * Unlocks this file.
- *
- * @return this instance
- * @since v1-alpha8
- */
- public @NotNull FileAccess unlock() {
- return this;
- }
-
-
- // -----> Content reading
- /**
- * Returns the contents of this file.
- *
- * Returns an empty array if this file
- * is not of type {@link Type#FILE}.
- *
- * @return file contents in bytes
- * @throws IOException on an IO error
- * @throws OutOfMemoryError if the file is larger than the allocated amount of memory
- * @since v1-alpha8
- */
- public byte @NotNull [] readBytes() throws IOException, OutOfMemoryError {
- if (getType() != Type.FILE)
- return new byte[0];
-
- Logger.diag("Reading file '" + path + "' (bytes)");
- return Files.readAllBytes(path);
- }
-
- /**
- * Returns the contents of this file.
- *
- * Returns an empty list if this file
- * is not of type {@link Type#FILE}.
- *
- * @return file contents in bytes
- * @throws IOException on an IO error
- * @throws OutOfMemoryError if the file is larger than the allocated amount of memory
- * @since v1-alpha8
- */
- public @NotNull List<@NotNull String> readLines() throws IOException, OutOfMemoryError {
- if (getType() != Type.FILE)
- return new ArrayList<>();
-
- Logger.diag("Reading file '" + path + "' (lines)");
- return Files.readAllLines(path);
- }
-
- /**
- * Returns the contents of this file.
- * This method will decode the bytes using the
- * {@link StandardCharsets#UTF_8} character set.
- *
- * Returns an empty string if this file
- * is not of type {@link Type#FILE}.
- *
- * @return file contents as a string
- * @throws IOException on an IO error
- * @throws OutOfMemoryError if the file is larger than the allocated amount of memory
- * @since v1-alpha8
- */
- public @NotNull String readContent() throws IOException, OutOfMemoryError {
- return readContent(StandardCharsets.UTF_8);
- }
-
- /**
- * Returns the contents of this file.
- *
- * Returns an empty string if this file
- * is not of type {@link Type#FILE}.
- *
- * @param charset charset to decode the bytes with
- * @return file contents as a string
- * @throws IOException on an IO error
- * @throws OutOfMemoryError if the file is larger than the allocated amount of memory
- * @since v1-alpha8
- */
- public @NotNull String readContent(@NotNull Charset charset) throws IOException, OutOfMemoryError {
- if (getType() != Type.FILE)
- return "";
-
- Logger.diag("Reading file '" + path + "' (string)");
- return Files.readString(path, charset);
- }
-
-
- // -----> Content writing
- /**
- * Writes the specified bytes into this file.
- *
- * @param bytes bytes to write
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess writeBytes(byte @NotNull [] bytes, boolean async) throws UnsupportedOperationException, IOException {
- if (getType() == Type.VOID)
- createFile();
- else if (getType() != Type.FILE)
- throw new UnsupportedOperationException("File '" + path + "' is not of type Type.VOID or Type.FILE");
-
- createFile();
- Logger.diag("Writing file '" + path + "' (bytes, " + (async ? "async" : "dsync") + ")");
- Files.write(path, bytes, StandardOpenOption.WRITE, async ? StandardOpenOption.DSYNC : StandardOpenOption.SYNC);
- return this;
- }
-
- /**
- * Writes the specified bytes into this file.
- * This method will encode the string using the
- * {@link StandardCharsets#UTF_8} character set.
- *
- * @param string string to write
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess writeString(@NotNull String string, boolean async) throws UnsupportedOperationException, IOException {
- return writeString(string, StandardCharsets.UTF_8, async);
- }
-
- /**
- * Writes the specified bytes into this file.
- *
- * @param string string to write
- * @param charset charset to encode the string in
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess writeString(@NotNull String string, @NotNull Charset charset, boolean async) throws UnsupportedOperationException, IOException {
- if (getType() == Type.VOID)
- createFile();
- else if (getType() != Type.FILE)
- throw new UnsupportedOperationException("File '" + path + "' is not of type Type.VOID or Type.FILE");
-
- Logger.diag("Writing file '" + path + "' (string, " + (async ? "async" : "dsync") + ")");
- Files.writeString(path, string, charset, StandardOpenOption.WRITE, async ? StandardOpenOption.DSYNC : StandardOpenOption.SYNC);
- return this;
- }
-
-
- // -----> Content appending
- /**
- * Appends the specified bytes to this file.
- *
- * @param bytes bytes to append
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess appendBytes(byte @NotNull [] bytes, boolean async) throws UnsupportedOperationException, IOException {
- if (getType() == Type.VOID)
- createFile();
- else if (getType() != Type.FILE)
- throw new UnsupportedOperationException("File '" + path + "' is not of type Type.VOID or Type.FILE");
-
- Logger.diag("Appending file '" + path + "' (bytes, " + (async ? "async" : "dsync") + ")");
- Files.write(path, bytes, StandardOpenOption.APPEND, async ? StandardOpenOption.DSYNC : StandardOpenOption.SYNC);
- return this;
- }
-
- /**
- * Appends the specified string to this file.
- * This method will encode the string using the
- * {@link StandardCharsets#UTF_8} character set.
- *
- * @param string string to append
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess appendString(@NotNull String string, boolean async) throws UnsupportedOperationException, IOException {
- return appendString(string, StandardCharsets.UTF_8, async);
- }
-
- /**
- * Appends the specified string to this file.
- *
- * @param string string to append
- * @param charset charset to encode the string in
- * @param async allows the operating system to decide when to flush the file to disk if {@code true}, flushes the data to disk immediately if {@code false}
- * @throws UnsupportedOperationException if the type of this file is neither {@link Type#VOID} or {@link Type#FILE}
- * @throws IOException on an IO error
- * @return this instance
- */
- public @NotNull FileAccess appendString(@NotNull String string, @NotNull Charset charset, boolean async) throws UnsupportedOperationException, IOException {
- if (getType() == Type.VOID)
- createFile();
- else if (getType() != Type.FILE)
- throw new UnsupportedOperationException("File '" + path + "' is not of type Type.VOID or Type.FILE");
-
- Logger.diag("Appending file '" + path + "' (string, " + (async ? "async" : "dsync") + ")");
- Files.writeString(path, string, charset, StandardOpenOption.APPEND, async ? StandardOpenOption.DSYNC : StandardOpenOption.SYNC);
- return this;
- }
-
-
- // -----> Inner classes
- /**
- * Represents various file types.
- *
- * @since v1-alpha8
- */
- public enum Type {
- /**
- * The path does not exist.
- *
- * @since v1-alpha8
- */
- VOID,
-
- /**
- * It's a regular file.
- *
- * @since v1-alpha8
- */
- FILE,
-
- /**
- * It's a directory containing files.
- *
- * @since v1-alpha8
- */
- DIRECTORY,
-
- /**
- * The file type is unknown to the sos!engine.
- *
- * @since v1-alpha8
- */
- UNKNOWN
- }
-
- /**
- * {@link FileVisitor} instance for
- * copying directories recursively.
- *
- * @param source source to copy from
- * @param destination destination to copy to
- * @since v1-alpha9
- */
- private record CopyDirectoryVisitor(@NotNull Path source, @NotNull Path destination) implements FileVisitor<@NotNull Path> {
- /**
- * Creates and initializes an
- * instance of this class.
- *
- * @since v1-alpha9
- */
- private CopyDirectoryVisitor {}
- @Override
- public @NotNull FileVisitResult preVisitDirectory(Path path, @NotNull BasicFileAttributes attributes) throws IOException {
- Files.createDirectories(destination.resolve(source.relativize(path)));
- return FileVisitResult.CONTINUE;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult visitFile(Path path, @NotNull BasicFileAttributes attributes) throws IOException {
- Files.copy(path, destination.resolve(source.relativize(path)));
- return FileVisitResult.CONTINUE;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult visitFileFailed(Path path, @NotNull IOException exception) throws IOException {
- throw exception;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult postVisitDirectory(Path path, @Nullable IOException exception) throws IOException {
- if (exception != null)
- throw exception;
-
- return FileVisitResult.CONTINUE;
- }
- }
-
- /**
- * {@link FileVisitor} instance for
- * delete directories recursively.
- *
- * @param directory directory to delete
- * @since v1-alpha9
- */
- private record DeleteDirectoryVisitor(@NotNull Path directory) implements FileVisitor<@NotNull Path> {
- /**
- * Creates and initializes an
- * instance of this class.
- *
- * @since v1-alpha9
- */
- private DeleteDirectoryVisitor {}
- @Override
- public @NotNull FileVisitResult preVisitDirectory(Path path, @NotNull BasicFileAttributes attributes) {
- return FileVisitResult.CONTINUE;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult visitFile(Path path, @NotNull BasicFileAttributes attributes) throws IOException {
- Files.delete(path);
- return FileVisitResult.CONTINUE;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult visitFileFailed(Path path, @NotNull IOException exception) throws IOException {
- throw exception;
- }
-
- /** {@inheritDoc} */
- @Override
- public @NotNull FileVisitResult postVisitDirectory(Path path, @Nullable IOException exception) throws IOException {
- if (exception != null)
- throw exception;
-
- Files.delete(path);
- return FileVisitResult.CONTINUE;
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/PlaceholderEngine.java b/base/src/main/java/de/staropensource/engine/base/utility/PlaceholderEngine.java
deleted file mode 100644
index c6f34cd37..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/PlaceholderEngine.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility;
-
-import de.staropensource.engine.base.Engine;
-import de.staropensource.engine.base.implementable.Placeholder;
-import de.staropensource.engine.base.internal.implementation.placeholder.*;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A modular and extensible placeholder engine.
- *
- * @see Placeholder
- * @since v1-alpha0
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class PlaceholderEngine {
- /**
- * Contains the class instance.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the class instance.
- *
- * @return class instance unless {@link Engine} is uninitialized
- * @since v1-alpha0
- */
- @Getter
- private static PlaceholderEngine instance;
-
- /**
- * Contains all global placeholders.
- *
- * @see Placeholder
- * @since v1-alpha0
- * -- GETTER --
- * Returns the list containing all global placeholders.
- *
- * @return list of all global placeholders
- * @since v1-alpha0
- */
- @Getter
- @SuppressWarnings("FieldMayBeFinal")
- private @NotNull List<@NotNull Placeholder> placeholders = new ArrayList<>();
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha6
- */
- private PlaceholderEngine() {
- // Add default placeholders.
- // date_*
- placeholders.add(new DateDay());
- placeholders.add(new DateMonth());
- placeholders.add(new DateYear());
- // engine_dependency_*
- placeholders.add(new EngineDependencyJansi());
- placeholders.add(new EngineDependencyLwjgl());
- placeholders.add(new EngineDependencyReflections());
- placeholders.add(new EngineDependencySlf4j());
- // engine_git_*
- placeholders.add(new EngineGitBranch());
- placeholders.add(new EngineGitCommitHeader());
- placeholders.add(new EngineGitCommitIdLong());
- placeholders.add(new EngineGitCommitIdShort());
- placeholders.add(new EngineGitCommits());
- placeholders.add(new EngineGitCommitterEmail());
- placeholders.add(new EngineGitCommitterName());
- placeholders.add(new EngineGitCommitTimeDay());
- placeholders.add(new EngineGitCommitTimeHour());
- placeholders.add(new EngineGitCommitTimeMinute());
- placeholders.add(new EngineGitCommitTimeMonth());
- placeholders.add(new EngineGitCommitTimeSecond());
- placeholders.add(new EngineGitCommitTimeYear());
- placeholders.add(new EngineGitDirty());
- // engine_version*
- placeholders.add(new EngineVersion());
- placeholders.add(new EngineVersionCodename());
- placeholders.add(new EngineVersionVersion());
- placeholders.add(new EngineVersionType());
- placeholders.add(new EngineVersionTyperelease());
- placeholders.add(new EngineVersionFork());
- // jvm_*
- placeholders.add(new JvmArguments());
- placeholders.add(new JvmJava());
- placeholders.add(new JvmUptime());
- // jvm_implementation_*
- placeholders.add(new JvmImplementationName());
- placeholders.add(new JvmImplementationVendor());
- placeholders.add(new JvmImplementationVersion());
- // time_*
- placeholders.add(new TimeEpoch());
- placeholders.add(new TimeHour());
- placeholders.add(new TimeMinute());
- placeholders.add(new TimeSecond());
- placeholders.add(new TimeZone());
- }
-
- /**
- * Creates and initializes a new instance
- * of this class if none already exists.
- *
- * @since v1-alpha6
- */
- public static void initialize() {
- if (instance == null)
- instance = new PlaceholderEngine();
- }
-
- /**
- * Process all placeholders for a given {@code text}.
- *
- * @param text text to process
- * @param temporaryPlaceholders placeholders to process only for this run
- * @return the processed text
- * @since v1-alpha0
- */
- public @NotNull String process(@NotNull String text, @NotNull List<@NotNull Placeholder> temporaryPlaceholders) {
- // Process temporary placeholders
- for (Placeholder temporaryPlaceholder : temporaryPlaceholders)
- text = temporaryPlaceholder.replace(text);
-
- // Process normal placeholders
- for (Placeholder placeholder : placeholders)
- text = placeholder.replace(text);
-
- return text;
- }
-
- /**
- * Process all placeholders for a given {@code text}.
- *
- * @param text text to process
- * @return the processed text
- * @since v1-alpha0
- */
- public @NotNull String process(@NotNull String text) {
- return process(text, new ArrayList<>());
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/PropertiesReader.java b/base/src/main/java/de/staropensource/engine/base/utility/PropertiesReader.java
deleted file mode 100644
index 0a82d3bba..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/PropertiesReader.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility;
-
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.Tristate;
-import lombok.Getter;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Properties;
-
-/**
- * Allows reading and converting properties into various other data types.
- *
- * @see Properties
- * @since v1-alpha0
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class PropertiesReader {
- /**
- * Contains an instance providing access to the system properties.
- *
- * @see System#getProperties()
- * @since v1-alpha0
- * -- GETTER --
- * Returns an instance providing access to the system properties.
- *
- * @return instance using the JVM-wide properties
- * @see System#getProperties()
- * @since v1-alpha0
- */
- @Getter
- private static final @NotNull PropertiesReader instance = new PropertiesReader(System.getProperties());
-
- /**
- * Contains the {@link Properties} used by this parser instance to read properties.
- *
- * @see Properties
- * @since v1-alpha0
- * -- GETTER --
- * Returns the {@link Properties} used by this parser instance to read properties.
- *
- * @return {@link Properties} associated with this reader instance
- * @see Properties
- * @since v1-alpha0
- */
- @Getter
- private final @NotNull Properties properties;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @param properties {@link Properties} to use
- * @since v1-alpha0
- */
- public PropertiesReader(@NotNull Properties properties) {
- this.properties = properties;
- }
-
- /**
- * Just returns the property value.
- *
- * @param name property name
- * @return a {@link String}
- * @throws NullPointerException if the specified property could not be found
- * @see String
- * @since v1-alpha0
- */
- public @NotNull String getString(@NotNull String name) throws NullPointerException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get String from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get String from property '" + name + "': Property does not exist");
- }
- return properties.getProperty(name);
- }
-
- /**
- * Parses a property as a {@link Boolean}.
- *
- * @param name property name
- * @return a {@link Boolean}
- * @throws NullPointerException if the specified property could not be found
- * @see Boolean
- * @since v1-alpha0
- */
- public boolean getBoolean(@NotNull String name) throws NullPointerException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Boolean from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Boolean from property '" + name + "': Property does not exist");
- }
-
- switch (properties.getProperty(name)) {
- case "1", "true", "yes", "y" -> {
- return Boolean.TRUE;
- }
- case null, default -> {
- return Boolean.FALSE;
- }
- }
- }
-
- /**
- * Parses a property as a {@link Tristate}.
- *
- * @param name property name
- * @return a {@link Tristate}
- * @throws NullPointerException if the specified property could not be found
- * @see Tristate
- * @since v1-alpha1
- */
- public @NotNull Tristate getTristate(@NotNull String name) throws NullPointerException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Tristate from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Tristate from property '" + name + "': Property does not exist");
- }
-
- switch (properties.getProperty(name)) {
- case "1", "true", "yes", "y" -> {
- return Tristate.TRUE;
- }
- case "0", "false", "no", "n" -> {
- return Tristate.FALSE;
- }
- case null, default -> {
- return Tristate.UNSET;
- }
- }
- }
-
- /**
- * Parses a property as a {@link Byte}.
- *
- * @param name property name
- * @return a {@link Byte}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as a {@link Byte}
- * @see Byte
- * @since v1-alpha0
- */
- public byte getByte(@NotNull String name) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Byte from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Byte from property '" + name + "': Property does not exist");
- }
-
- try {
- return Byte.parseByte(properties.getProperty(name));
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Byte from property '" + name + "': String cannot be parsed as a Byte.");
- throw exception;
- }
- }
-
- /**
- * Parses a property as a {@link Short}.
- *
- * @param name property name
- * @return a {@link Short}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as a {@link Short}
- * @see Short
- * @since v1-alpha0
- */
- public short getShort(@NotNull String name) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Short from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Short from property '" + name + "': Property does not exist");
- }
-
- try {
- return Short.parseShort(properties.getProperty(name));
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Short from property '" + name + "': String cannot be parsed as a Short.");
- throw exception;
- }
- }
-
- /**
- * Parses a property as an {@link Integer}.
- *
- * @param name property name
- * @param unsigned determines if the {@link Integer} is unsigned
- * @return an {@link Integer}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as an {@link Integer}
- * @see Integer
- * @since v1-alpha0
- */
- public int getInteger(@NotNull String name, boolean unsigned) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Integer from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Integer from property '" + name + "': Property does not exist");
- }
-
- try {
- if (unsigned)
- return Integer.parseUnsignedInt(properties.getProperty(name));
- else
- return Integer.parseInt(properties.getProperty(name));
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Integer from property '" + name + "': String cannot be parsed as an Integer.");
- throw exception;
- }
- }
-
- /**
- * Parses a property as a {@link Long}.
- *
- * @param name property name
- * @param unsigned determines if the {@link Long} is unsigned
- * @return a {@link Long}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as an {@link Long}
- * @see Long
- * @since v1-alpha0
- */
- public long getLong(@NotNull String name, boolean unsigned) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Long from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Long from property '" + name + "': Property does not exist");
- }
-
- try {
- if (unsigned)
- return Long.parseUnsignedLong(properties.getProperty(name));
- else
- return Long.parseLong(properties.getProperty(name));
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Long from property '" + name + "': String cannot be parsed as a Long.");
- throw exception;
- }
- }
-
- /**
- * Parses a property as a {@link Float}.
- *
- * @param name property name
- * @return a {@link Float}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as an {@link Float}
- * @see Float
- * @since v1-alpha0
- */
- public float getFloat(@NotNull String name) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Float from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Float from property '" + name + "': Property does not exist");
- }
-
- try {
- return Float.parseFloat(properties.getProperty(name));
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Float from property '" + name + "': String cannot be parsed as a Float.");
- throw exception;
- }
- }
-
- /**
- * Parses a property as a {@link Double}.
- *
- * @param name property name
- * @return a {@link Double}
- * @throws NullPointerException if the specified property could not be found
- * @throws NumberFormatException if the specified property cannot be parsed as an {@link Double}
- * @see Double
- * @since v1-alpha0
- */
- public double getDouble(@NotNull String name) throws NullPointerException, NumberFormatException {
- if (properties.getProperty(name) == null) {
- Logger.sarn("Unable to get Double from property '" + name + "': Property does not exist");
- throw new NullPointerException("Unable to get Double from property '" + name + "': Property does not exist");
- }
-
- try {
- return Double.parseDouble(properties.getProperty(name));
- } catch (NullPointerException exception) {
- Logger.sarn("Unable to get Double from property '" + name + "': String is null.");
- throw exception;
- } catch (NumberFormatException exception) {
- Logger.sarn("Unable to get Double from property '" + name + "': String cannot be parsed as a Double.");
- throw exception;
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/information/EngineInformation.java b/base/src/main/java/de/staropensource/engine/base/utility/information/EngineInformation.java
deleted file mode 100644
index 50c1f6fca..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/information/EngineInformation.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility.information;
-
-import de.staropensource.engine.base.logging.Logger;
-import de.staropensource.engine.base.type.VersionType;
-import de.staropensource.engine.base.utility.PropertiesReader;
-import lombok.Getter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.ZonedDateTime;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Locale;
-import java.util.Properties;
-
-/**
- * Provides build information about the engine.
- *
- * @since v1-alpha0
- */
-@SuppressWarnings({ "JavadocDeclaration" })
-public final class EngineInformation {
- /**
- * Contains the engine's version codename.
- *
- * @since v1-alpha2
- * -- GETTER --
- * Returns the engine's version codename.
- *
- * @return engine version codename
- * @since v1-alpha2
- */
- @Getter
- private static String versioningCodename;
-
- /**
- * Contains the engine's version.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the engine's version.
- *
- * @return engine version
- * @since v1-alpha0
- */
- @Getter
- private static int versioningVersion;
-
- /**
- * Contains the engine's version type.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the engine's version type.
- *
- * @return engine version type
- * @since v1-alpha0
- */
- @Getter
- private static VersionType versioningType;
-
- /**
- * Contains the engine's typerelease.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the engine's typerelease.
- *
- * @return engine typerelease
- * @since v1-alpha0
- */
- @Getter
- private static int versioningTyperelease;
-
- /**
- * Contains the engine's fork identifier.
- *
- * Likely empty. If not, prefixed with a dash.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the engine's fork identifier.
- *
- * Likely empty. If not, prefixed with a dash.
- *
- * @return engine fork identifier
- * @since v1-alpha0
- */
- @Getter
- private static String versioningFork;
-
- /**
- * Contains the engine's full version string.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the engine's full version string.
- *
- * @return engine version string
- * @since v1-alpha1
- */
- @Getter
- private static String versioningString;
-
-
- /**
- * Contains the Java version of the engine source.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the Java version of the engine source.
- *
- * @return java version of engine source
- * @since v1-alpha4
- */
- @Getter
- private static short javaSource;
-
- /**
- * Contains the Java version the engine was compiled against.
- *
- * @since v1-alpha4
- * -- GETTER --
- * Returns the Java version the engine was compiled against.
- *
- * @return java version compiled against
- * @since v1-alpha4
- */
- @Getter
- private static short javaTarget;
-
-
- /**
- * Contains the {@code dirty} value (i.e. if the source tree has been modified).
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the {@code dirty} value (i.e. if the source tree has been modified).
- *
- * @return git dirty value
- * @since v1-alpha1
- */
- @Getter
- private static boolean gitDirty;
-
- /**
- * Contains the branch the engine was built on.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the branch the engine was built on.
- *
- * @return git branch
- * @since v1-alpha1
- */
- @Getter
- private static String gitBranch;
-
- /**
- * Contains the commit count.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commit count.
- *
- * @return git commit count
- * @since v1-alpha1
- */
- @Getter
- private static int gitCommitCount;
-
- /**
- * Contains the commit identifier (short form).
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commit identifier (short form).
- *
- * @return git long commit id
- * @since v1-alpha1
- */
- @Getter
- private static String gitCommitIdentifierShort;
-
- /**
- * Contains the commit identifier (long form).
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commit identifier (long form).
- *
- * @return git long commit id
- * @since v1-alpha1
- */
- @Getter
- private static String gitCommitIdentifierLong;
-
- /**
- * Contains the commit header.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commit header.
- *
- * @return git commit header
- * @since v1-alpha1
- */
- @Getter
- private static String gitCommitHeader;
-
- /**
- * Contains the commit time.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commit time.
- *
- * @return git commit time
- * @since v1-alpha1
- */
- @Getter
- private static ZonedDateTime gitCommitTime;
-
- /**
- * Contains the commiter's name.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commiter's name.
- *
- * @return git committer name
- * @since v1-alpha1
- */
- @Getter
- private static String gitCommitterName;
-
- /**
- * Contains the commiter's email.
- *
- * @since v1-alpha1
- * -- GETTER --
- * Returns the commiter's email.
- *
- * @return git committer email
- * @since v1-alpha1
- */
- @Getter
- private static String gitCommitterEmail;
-
-
- /**
- * Contains the version of the dependency {@code Jansi}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the version of the dependency {@code Jansi}.
- *
- * @return Jansi dependency version
- * @since v1-alpha0
- */
- @Getter
- private static String dependencyJansi;
-
- /**
- * Contains the version of the dependency {@code Reflections}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the version of the dependency {@code Reflections}.
- *
- * @return Reflections dependency version
- * @since v1-alpha0
- */
- @Getter
- private static String dependencyReflections;
-
- /**
- * Contains the version of the dependency {@code SLF4J}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the version of the dependency {@code SLF4J}.
- *
- * @return SLF4J dependency version
- * @since v1-alpha0
- */
- @Getter
- private static String dependencySlf4j;
-
- /**
- * Contains the version of the dependency {@code LWJGL}.
- *
- * @since v1-alpha0
- * -- GETTER --
- * Returns the version of the dependency {@code LWJGL}.
- *
- * @return LWJGL dependency version
- * @since v1-alpha0
- */
- @Getter
- private static String dependencyLwjgl;
-
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha6
- */
- private EngineInformation() {}
-
- /**
- * Updates all variables.
- *
- * This method does not need to be invoked manually, as the information provided by
- * this class is static (does not change) and is already populated at engine startup.
- *
- * @since v1-alpha1
- */
- public static synchronized void update() {
- Logger.diag("Updating engine information");
-
- // Load properties from bundled gradle.properties
- Properties gradleProperties = new Properties();
- InputStream gradleStream = EngineInformation.class.getClassLoader().getResourceAsStream("sosengine-gradle.properties");
-
- if (gradleStream == null) {
- Logger.crash("Unable to load build information: The bundled gradle.properties file could not be found.");
- return;
- }
-
- try {
- gradleProperties.load(gradleStream);
- gradleStream.close();
- } catch (IOException exception) {
- Logger.crash("Unable to load build information: InputStream 'gradleStream' failed", exception);
- return;
- }
-
- // Load properties from bundled git.properties
- // or fill in blank information if file missing
- Properties gitProperties = new Properties();
- InputStream gitStream = EngineInformation.class.getClassLoader().getResourceAsStream("sosengine-git.properties");
- if (gitStream == null) {
- Logger.error("Unable to load build information: The bundled git.properties file could not be found. Did you download a tarball?");
-
- // Fake information
- gitProperties.setProperty("git.total.commit.count", "0");
- gitProperties.setProperty("git.dirty", "true");
- gitProperties.setProperty("git.branch", "/git.properties is missing/");
- gitProperties.setProperty("git.commit.id", "########################################");
- gitProperties.setProperty("git.commit.id.abbrev", "#######");
- gitProperties.setProperty("git.commit.message.short", "git.properties file is missing :/");
- gitProperties.setProperty("git.commit.time", "1970-01-01T00:00+0000");
- gitProperties.setProperty("git.commit.user.name", "git.properties file is missing :/");
- gitProperties.setProperty("git.commit.user.email", "git.properties-is-missing@example.com");
- } else {
- // Load real information from git.properties file
- try {
- gitProperties.load(gitStream);
- gitStream.close();
- } catch (IOException exception) {
- Logger.crash("Unable to load build information: InputStream 'gitStream' failed", exception);
- return;
- }
- }
-
- // Create new PropertyParsers
- PropertiesReader gradleParser = new PropertiesReader(gradleProperties);
- PropertiesReader gitParser = new PropertiesReader(gitProperties);
-
- // Apply properties to fields
- versioningCodename = gradleParser.getString("versioningCodename");
- versioningVersion = gradleParser.getInteger("versioningVersion", true);
- versioningType = VersionType.valueOf(gradleParser.getString("versioningType").toUpperCase());
- versioningTyperelease = gradleParser.getInteger("versioningTyperelease", true);
- versioningFork = gradleParser.getString("versioningFork");
- versioningString = "v" + versioningVersion + "-" + (versioningType == VersionType.RELEASE_CANDIDATE ? "releasecandidate" : versioningType.name().toLowerCase(Locale.ROOT)) + versioningTyperelease + versioningFork;
-
- javaSource = gradleParser.getShort("javaSource");
- javaTarget = gradleParser.getShort("javaTarget");
-
- dependencyJansi = gradleParser.getString("dependencyJansi");
- dependencyReflections = gradleParser.getString("dependencyReflections");
- dependencySlf4j = gradleParser.getString("dependencySlf4j");
- dependencyLwjgl = gradleParser.getString("dependencyLwjgl");
-
- gitDirty = gitParser.getBoolean("git.dirty");
- gitBranch = gitParser.getString("git.branch");
- gitCommitCount = gitParser.getInteger("git.total.commit.count", true);
- gitCommitIdentifierShort = gitParser.getString("git.commit.id.abbrev");
- gitCommitIdentifierLong = gitParser.getString("git.commit.id");
- gitCommitHeader = gitParser.getString("git.commit.message.short");
- try {
- Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ").parse(gitParser.getString("git.commit.time"));
- GregorianCalendar calendar = new GregorianCalendar();
- calendar.setTime(date);
- gitCommitTime = calendar.toZonedDateTime();
- } catch (ParseException exception) {
- Logger.crash("Unable to load build information: Can't parse \"" + gitParser.getString("git.commit.time") + "\" using format \"yyyy-MM-dd'T'HH:mmZ\"", exception);
- return;
- }
- gitCommitterName = gitParser.getString("git.commit.user.name");
- gitCommitterEmail = gitParser.getString("git.commit.user.email");
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/information/JvmInformation.java b/base/src/main/java/de/staropensource/engine/base/utility/information/JvmInformation.java
deleted file mode 100644
index 76d0b470b..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/information/JvmInformation.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility.information;
-
-import de.staropensource.engine.base.logging.Logger;
-import org.jetbrains.annotations.NotNull;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryUsage;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Provides information about the running Java Virtual Machine.
- *
- * @since v1-alpha0
- */
-@SuppressWarnings({ "unused" })
-public final class JvmInformation {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha6
- */
- private JvmInformation() {}
-
- /**
- * Returns the Java version this JVM implements.
- *
- * @return Java version
- * @throws NumberFormatException on integer conversion failure
- * @since v1-alpha0
- */
- public static int getJavaVersion() throws NumberFormatException {
- String version = System.getProperty("java.version");
-
- if (version.startsWith("1.")) // Omit "1." (if present)
- version = version.substring(2, 3);
- else {
- if (version.contains(".")) // Only get MAJOR version
- version = version.substring(0, version.indexOf("."));
- }
-
- try {
- return Integer.parseInt(version);
- } catch (NumberFormatException exception) {
- Logger.crash("Could not parse Java version: Integer conversion failed for string \"" + version + "\"", exception, true);
- throw exception;
- }
- }
-
- /**
- * Returns the JVM implementation name.
- *
- * @return implementation name
- * @since v1-alpha0
- */
- public static @NotNull String getImplementationName() {
- return ManagementFactory.getRuntimeMXBean().getVmName();
- }
-
- /**
- * Returns the JVM implementation version.
- *
- * @return implementation version
- * @since v1-alpha0
- */
- public static @NotNull String getImplementationVersion() {
- return ManagementFactory.getRuntimeMXBean().getVmVersion();
- }
-
- /**
- * Returns the JVM implementation vendor.
- *
- * @return implementation vendor
- * @since v1-alpha0
- */
- public static @NotNull String getImplementationVendor() {
- return ManagementFactory.getRuntimeMXBean().getVmVendor();
- }
-
- /**
- * Returns the uptime of the JVM.
- *
- * @return uptime in milliseconds
- * @since v1-alpha0
- */
- public static long getUptime() {
- return ManagementFactory.getRuntimeMXBean().getUptime();
- }
-
- /**
- * Returns all arguments passed to the JVM.
- * This excludes all arguments passed to the application.
- *
- * @return immutable list with all JVM arguments
- * @since v1-alpha0
- */
- public static @NotNull List<@NotNull String> getArguments() {
- return Collections.unmodifiableList(ManagementFactory.getRuntimeMXBean().getInputArguments());
- }
-
- /**
- * Returns the estimated total amount of memory used the running application and JVM.
- *
- * @return estimated total amount of used memory
- * @since v1-alpha1
- */
- public static long getMemoryTotal() {
- return Runtime.getRuntime().totalMemory();
- }
-
- /**
- * Returns the maximum amount of memory which can be used by the running application.
- *
- * @return maximum amount of memory usable in bytes
- * @since v1-alpha1
- */
- public static long getMemoryLimit() {
- return Runtime.getRuntime().maxMemory();
- }
-
- /**
- * Returns the amount of free memory available to the running application.
- *
- * @return amount of free memory in bytes
- * @since v1-alpha1
- */
- public static long getMemoryFree() {
- return Runtime.getRuntime().freeMemory();
- }
-
- /**
- * Returns the amount of memory used by the running application.
- *
- * @return amount of used memory in bytes
- * @since v1-alpha1
- */
- public static long getMemoryUsed() {
- return getMemoryLimit() - getMemoryFree();
- }
-
- /**
- * Returns the size of heap memory.
- *
- * @return heap memory size
- * @since v1-alpha1
- */
- public static @NotNull MemoryUsage getMemoryHeap() {
- return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
- }
-
- /**
- * Returns size of stack memory.
- *
- * @return stack memory size
- * @since v1-alpha1
- */
- public static @NotNull MemoryUsage getMemoryStack() {
- return ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
- }
-
- /**
- * Returns the amount of processors available to the JVM.
- *
- * Note: The amount of available processors may change rapidly.
- * If your application scales resources based on the output of
- * this method, consider checking it's output often and scaling
- * resources accordingly.
- *
- * @return amount of available processors
- * @since v1-alpha1
- */
- public static int getAvailableProcessors() {
- return Runtime.getRuntime().availableProcessors();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/information/package-info.java b/base/src/main/java/de/staropensource/engine/base/utility/information/package-info.java
deleted file mode 100644
index 9d6808750..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/information/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-/**
- * Classes which can be used to retrieve information about the execution environment.
- *
- * @since v1-alpha0
- */
-package de.staropensource.engine.base.utility.information;
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/misc/ArrayUtil.java b/base/src/main/java/de/staropensource/engine/base/utility/misc/ArrayUtil.java
deleted file mode 100644
index c732fc71a..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/misc/ArrayUtil.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility.misc;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-/**
- * Manipulates arrays.
- *
- * @since v1-alpha9
- */
-public final class ArrayUtil {
- /**
- * Creates and initializes an
- * instance of this class.
- *
- * @since v1-alpha9
- */
- private ArrayUtil() {}
-
- /**
- * Removes the first {@code n} elements
- * from the specified array.
- *
- * If {@code n} is bigger than the
- * amount of elements in the
- * specified array, an empty array
- * will be returned.
- *
- * @param type
- * @param array array to operate on
- * @param n amount to remove
- * @return array with the first elements removed
- * @since v1-alpha9
- */
- public static @Nullable T @NotNull [] removeFirst(@Nullable T @NotNull [] array, int n) {
- try {
- return Arrays.copyOfRange(array, n, array.length);
- } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException exception) {
- return Collections.emptyList().toArray(array);
- }
- }
-
- /**
- * Removes the last {@code n} elements
- * from the specified array.
- *
- * If {@code n} is bigger than the
- * amount of elements in the
- * specified array, an empty array
- * will be returned.
- *
- * @param type
- * @param array array to operate on
- * @param n amount to remove
- * @return array with the last elements removed
- * @since v1-alpha9
- */
- public static @Nullable T @NotNull [] removeLast(@Nullable T @NotNull [] array, int n) {
- try {
- return Arrays.copyOfRange(array, 0, array.length-n);
- } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException exception) {
- return Collections.emptyList().toArray(array);
- }
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/misc/ListFormatter.java b/base/src/main/java/de/staropensource/engine/base/utility/misc/ListFormatter.java
deleted file mode 100644
index f7bf98be3..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/misc/ListFormatter.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility.misc;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Converts arrays, arrays and maps to look like
- * nicely formatted lists (as {@link String}s).
- *
- * @since v1-alpha9
- */
-public final class ListFormatter {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha9
- */
- private ListFormatter() {}
-
- /**
- * Converts the specified array to a {@link String}.
- *
- * For {@code formatArray(array, ", ", " & ")} the
- * something like following string will be returned:
- * {@code element 1, element 2, element 3 & element 4}
- *
- * @param array array to convert
- * @param itemSeparator string used to separate two items
- * @param finalSeparator string used to separate the final two items
- * @return formatted string
- * @since v1-alpha9
- */
- public static @NotNull String formatArray(@NotNull Object @NotNull [] array, @NotNull String itemSeparator, @NotNull String finalSeparator) {
- StringBuilder output = new StringBuilder();
-
- for (int index = 0; index < array.length; index++) {
- if (!output.isEmpty())
- if (index == array.length - 1)
- output.append(finalSeparator);
- else
- output.append(itemSeparator);
-
- output.append(array[index]);
- }
-
- return output.toString();
- }
-
- /**
- * Converts the specified array to a {@link String}.
- *
- * This will produce something like this:
- * {@code element 1, element 2, element 3 & element 4}
- *
- * @param array array to convert
- * @return formatted string
- * @since v1-alpha9
- */
- public static @NotNull String formatArray(@NotNull Object @NotNull [] array) {
- return formatArray(array, ", ", " & ");
- }
-
- /**
-
- /**
- * Converts the specified array to a {@link String}.
- *
- * For {@code formatArray(array, ", ", " & ")} the
- * something like following string will be returned:
- * {@code element 1, element 2, element 3 & element 4}
- *
- * @param collection collection to convert
- * @param itemSeparator string used to separate two items
- * @param finalSeparator string used to separate the final two items
- * @return formatted string
- * @since v1-alpha9
- */
- public static @NotNull String formatCollection(@NotNull Collection> collection, @NotNull String itemSeparator, @NotNull String finalSeparator) {
- return formatArray(collection.toArray(), itemSeparator, finalSeparator);
- }
-
- /**
- * Converts the specified {@link Collection} to a {@link String}.
- *
- * This will produce something like this:
- * {@code element 1, element 2, element 3 & element 4}
- *
- * @param collection collection to convert
- * @return formatted string
- * @since v1-alpha9
- */
- public static @NotNull String formatCollection(@NotNull Collection> collection) {
- return formatArray(collection.toArray());
- }
-
- /**
- * Converts a {@link Map} to a {@link String}.
- *
- * @param map map to convert
- * @return formatted string
- * @since v1-alpha9
- */
- public static @NotNull String formatMap(@NotNull Map, ?> map) {
- StringBuilder output = new StringBuilder();
-
- int index = 0;
- for (Object key : map.keySet()) {
- if (!output.isEmpty())
- if (index == map.size() - 1)
- output.append(" & ");
- else
- output.append(", ");
-
- output
- .append(key)
- .append("=")
- .append(map.get(key));
- }
-
- return output.toString();
- }
-}
diff --git a/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java b/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java
deleted file mode 100644
index 5fe8394ef..000000000
--- a/base/src/main/java/de/staropensource/engine/base/utility/misc/Miscellaneous.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * STAROPENSOURCE ENGINE SOURCE FILE
- * Copyright (c) 2024 The StarOpenSource Engine Authors
- * Licensed under the GNU Affero General Public License v3
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.staropensource.engine.base.utility.misc;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * Contains the most miscellaneous of all miscellaneous methods.
- *
- * @since v1-alpha9
- */
-@SuppressWarnings({ "unused" })
-public final class Miscellaneous {
- /**
- * Creates and initializes an instance of this class.
- *
- * @since v1-alpha9
- */
- private Miscellaneous() {}
-
- /**
- * Searches for a value in a {@link Map}.
- *
- * @param map map to use
- * @param value value to search for
- * @return all keys matching the specified value
- * @since v1-alpha9
- */
- public static Set> searchForValueInMap(@NotNull Map, ?> map, @Nullable Object value) {
- return map
- .entrySet().stream()
- .filter(entry -> Objects.equals(entry.getValue(), value))
- .map(Map.Entry::getKey)
- .collect(Collectors.toSet());
- }
-
- /**
- * Measures the execution time of
- * the specified {@link Runnable}.
- *
- * @param runnable {@link Runnable} to execute
- * @return execution time in milliseconds
- * @see Runnable
- * @since v1-alpha9
- */
- public static long measureExecutionTime(@NotNull Runnable runnable) {
- long initTime = System.currentTimeMillis();
- runnable.run();
- return System.currentTimeMillis() - initTime;
- }
-
- /**
- * Forcefully invokes the garbage collector
- * and blocks execution until finished.
- * If you want to run it in parallel to your
- * program, consider running it in a thread.
- *
- * This method does not guarantee full garbage collection,
- * as the JVM only hints the garbage collector to do it's
- * job. All garbage collectors are non-deterministic and
- * cannot be invoked by force. And even if this method
- * manages to invoke the garbage collector, a full garbage
- * collection likely will never be archived. This is because
- * the garbage collector will never throw everything into
- * the trash. In addition, this method will only return if
- * it's {@link WeakReference} becomes null. The garbage
- * collector may or may not do more afterwards. This method
- * just exists if someone wants to at least try to
- * forcefully invoke the garbage collector. If you want
- * a somewhat more reliable method, use Java Agents.
- *
- * @since v1-alpha9
- */
- @SuppressWarnings("UnusedAssignment")
- public static void invokeGarbageCollector() {
- Object object = new Object();
- WeakReference