diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index cc87bc5..473f106 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -2,6 +2,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 2ad5a65..d934ebd 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -16,17 +16,12 @@ pipeline {
steps {
withCredentials([
usernamePassword(credentialsId: 'jf-repo',
- usernameVariable: 'REPO_USER',
- passwordVariable: 'REPO_PASS')
+ usernameVariable: 'ORG_GRADLE_PROJECT_repoUsername',
+ passwordVariable: 'ORG_GRADLE_PROJECT_repoPassword')
]) {
sh '''
- echo "repoUser=$REPO_USER" > gradle.properties
- echo "repoPassword=$REPO_PASS" >> gradle.properties
-
chmod +x ./gradlew
./gradlew clean shadowJar webDistribution
-
- rm -f gradle.properties
'''
}
}
diff --git a/build-extensions/build.gradle.kts b/build-extensions/build.gradle.kts
index 81b6075..288d2cb 100644
--- a/build-extensions/build.gradle.kts
+++ b/build-extensions/build.gradle.kts
@@ -7,6 +7,6 @@ repositories {
}
dependencies {
- implementation("net.kyori", "indra-common", "3.2.0")
- implementation("com.google.code.gson", "gson", "2.15.0")
+ implementation("net.kyori:indra-common:3.2.0")
+ implementation("com.google.code.gson:gson:2.15.0")
}
diff --git a/build-extensions/src/main/kotlin/extensions.kt b/build-extensions/src/main/kotlin/extensions.kt
index 8f4d814..457da60 100644
--- a/build-extensions/src/main/kotlin/extensions.kt
+++ b/build-extensions/src/main/kotlin/extensions.kt
@@ -18,27 +18,28 @@ fun Project.applyJarMetadata(mainClass: String, module: String) {
fun Project.applyJarMetadata(mainClass: String, module: String, preMain: String?) {
if ("jar" in tasks.names) {
+ val git = git()
+ val commit = providers.provider { git?.commit()?.name }
+ val branch = providers.provider { git?.branchName() }
+ val baseVersion = version.toString()
tasks.named("jar") {
manifest.attributes(
"Main-Class" to mainClass,
"Automatic-Module-Name" to module,
"Implementation-Vendor" to "WCloudService",
"Implementation-Title" to Versions.wCloudCodeName,
- "Implementation-Version" to project.version.toString() + "-${shortCommitHash()}")
+ "Implementation-Version" to commit.map { "$baseVersion-${it.take(8)}" }
+ .orElse("$baseVersion-unknown"),
+ "Git-Commit" to commit,
+ "Git-Branch" to branch)
// apply the pre-main class if given
if (preMain != null) {
manifest.attributes("Premain-Class" to preMain)
}
- // apply git information to manifest
- git()?.applyVcsInformationToManifest(manifest)
}
}
}
-fun Project.shortCommitHash(): String {
- return git()?.commit()?.name?.substring(0, 8) ?: "unknown"
-}
-
fun Project.git(): IndraGitExtension? = rootProject.extensions.findByType()
fun Project.sourceSets(): SourceSetContainer = the().sourceSets
diff --git a/build.gradle.kts b/build.gradle.kts
index abdcd0f..09c22f6 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,7 +12,7 @@ defaultTasks("build", "test", "shadowJar")
tasks.register("webDistribution") {
group = "distribution"
description = "Packages a self-contained single-master wCloud installation and its modules."
- archiveFileName.set("wcloud-web.zip")
+ archiveFileName.set("wcloud.zip")
destinationDirectory.set(layout.buildDirectory.dir("distributions"))
fun includeJar(projectPath: String, jarName: String, target: String) {
@@ -24,17 +24,17 @@ tasks.register("webDistribution") {
includeJar(":wcloud-runnable:wcloud-master", Files.master, "dependency")
includeJar(":wcloud-api", Files.api, "local/GLOBAL/EVERY/plugins")
includeJar(":wcloud-plugin", Files.plugin, "local/GLOBAL/EVERY/plugins")
- includeJar(":wcloud-modules:wmodule-permissions", Files.permissions, "modules")
- includeJar(":wcloud-modules:wmodule-signs", Files.signs, "modules")
- includeJar(":wcloud-modules:wmodule-npc", Files.npc, "modules")
- includeJar(":wcloud-modules:wmodule-syncplayer", Files.syncplayer, "modules")
+ includeJar(":wcloud-modules:wmodule-permissions", Files.permissions, "optional-modules")
+ includeJar(":wcloud-modules:wmodule-signs", Files.signs, "optional-modules")
+ includeJar(":wcloud-modules:wmodule-npc", Files.npc, "optional-modules")
+ includeJar(":wcloud-modules:wmodule-syncplayer", Files.syncplayer, "optional-modules")
includeJar(":wcloud-modules:wmodule-cloudflare", Files.cloudflare, "optional-modules")
includeJar(":wcloud-modules:wmodule-discord", Files.discord, "optional-modules")
includeJar(":wcloud-modules:wmodule-hub", Files.hub, "optional-modules")
includeJar(":wcloud-modules:wmodule-notify", Files.notify, "optional-modules")
includeJar(":wcloud-modules:wmodule-reboot", Files.reboot, "optional-modules")
includeJar(":wcloud-modules:wmodule-syncproxy", Files.syncproxy, "modules")
- includeJar(":wcloud-modules:wmodule-scoreboard", Files.scoreboard, "modules")
+ includeJar(":wcloud-modules:wmodule-scoreboard", Files.scoreboard, "optional-modules")
includeJar(":wcloud-modules:wmodule-moderation", Files.moderation, "optional-modules")
from("wcloud-launcher/src/main/dist")
}
diff --git a/gradle.properties b/gradle.properties
index 4b61054..fca2119 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,4 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.warning.mode=all
-org.gradle.logging.level=info
-org.gradle.jvmargs=-Xmx5G -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
\ No newline at end of file
+org.gradle.jvmargs=-Xmx5G -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 9fa7f28..51cbd2a 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a9a2413..04d7959 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,8 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a1bb7e9651ef09e4cd9a62d471564e0ee23b5757e5f21fd7358d7cfc21018fdf
-distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-all.zip
-networkTimeout=60000
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.1-bin.zip
+networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
diff --git a/wcloud-api/build.gradle.kts b/wcloud-api/build.gradle.kts
index f40e46b..e78f0d7 100644
--- a/wcloud-api/build.gradle.kts
+++ b/wcloud-api/build.gradle.kts
@@ -1,3 +1,5 @@
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+
plugins {
alias(libs.plugins.shadow)
}
@@ -18,6 +20,9 @@ dependencies {
implementation(projects.wcloudNetworking)
}
-tasks.named("shadowJar") {
+tasks.named("shadowJar") {
dependsOn(":wcloud-driver:shadowJar")
-}
\ No newline at end of file
+ filesMatching("META-INF/*.kotlin_module") {
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
+ }
+}
diff --git a/wcloud-driver/src/main/java/de/wcloudservice/driver/event/EventDriver.java b/wcloud-driver/src/main/java/de/wcloudservice/driver/event/EventDriver.java
index 1fc312c..e8d4e8e 100644
--- a/wcloud-driver/src/main/java/de/wcloudservice/driver/event/EventDriver.java
+++ b/wcloud-driver/src/main/java/de/wcloudservice/driver/event/EventDriver.java
@@ -96,7 +96,7 @@ public class EventDriver {
return;
}
- Class extends EventAdapter> realParam = (Class extends EventAdapter>) param;
+ Class extends EventAdapter> realParam = param.asSubclass(EventAdapter.class);
var eventHandlersForEvent =
this.bindings.computeIfAbsent(
diff --git a/wcloud-plugin/src/main/java/de/wcloudservice/plugin/velocity/VelocityBootstrap.java b/wcloud-plugin/src/main/java/de/wcloudservice/plugin/velocity/VelocityBootstrap.java
index 337d9e0..d3102cb 100644
--- a/wcloud-plugin/src/main/java/de/wcloudservice/plugin/velocity/VelocityBootstrap.java
+++ b/wcloud-plugin/src/main/java/de/wcloudservice/plugin/velocity/VelocityBootstrap.java
@@ -47,11 +47,11 @@ import java.util.TimerTask;
@Getter
@Accessors(fluent = true)
@Plugin(
- id = "metacloudplugin",
+ id = "wcloudplugin",
name = "metacloud-plugin",
version = "2.0.0-SNAPSHOT",
authors = "Weapie",
- dependencies = {@Dependency(id = "metacloudapi")})
+ dependencies = {@Dependency(id = "wcloudapi")})
public class VelocityBootstrap {
@Getter private static VelocityBootstrap instance;
@@ -90,9 +90,10 @@ public class VelocityBootstrap {
this,
() -> {
var api = CloudAPI.instance();
- if (api == null
- || NettyDriver.instance().client().channel() == null
- || !NettyDriver.instance().client().channel().isActive()) {
+ var netty = NettyDriver.instance();
+ var client = netty == null ? null : netty.client();
+ var channel = client == null ? null : client.channel();
+ if (api == null || channel == null || !channel.isActive()) {
return;
}
var plugins =
@@ -129,11 +130,17 @@ public class VelocityBootstrap {
new TimerTask() {
@Override
public void run() {
- if (NettyDriver.instance().client().closed()) {
+ var netty = NettyDriver.instance();
+ var client = netty == null ? null : netty.client();
+ if (client == null || client.closed()) {
cancel();
return;
}
- if (!NettyDriver.instance().client().channel().isActive()) {
+ var channel = client.channel();
+ if (channel == null) {
+ return;
+ }
+ if (!channel.isActive()) {
System.exit(0);
}
diff --git a/wcloud-utils/src/main/java/de/wcloudservice/utils/ClassAllocationUtil.java b/wcloud-utils/src/main/java/de/wcloudservice/utils/ClassAllocationUtil.java
index 87ab6c8..2853b06 100644
--- a/wcloud-utils/src/main/java/de/wcloudservice/utils/ClassAllocationUtil.java
+++ b/wcloud-utils/src/main/java/de/wcloudservice/utils/ClassAllocationUtil.java
@@ -20,6 +20,7 @@ import lombok.NonNull;
import org.jetbrains.annotations.ApiStatus;
import java.lang.invoke.LambdaMetafactory;
+import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Field;
@@ -66,8 +67,12 @@ public final class ClassAllocationUtil {
var unsafeClass = Class.forName("sun.misc.Unsafe");
var unsafeField = unsafeClass.getDeclaredField("theUnsafe");
var theUnsafe = getInaccessibleFieldValue(unsafeField);
- unsafeAllocator = makeUnsafeAlloc(theUnsafe);
- } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException exception) {
+ var allocateInstance = MethodHandles.publicLookup()
+ .unreflect(unsafeClass.getMethod("allocateInstance", Class.class))
+ .bindTo(theUnsafe);
+ unsafeAllocator = makeUnsafeAlloc(allocateInstance);
+ } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException
+ | IllegalAccessException exception) {
unsafeAllocator = null;
}
UNSAFE_ALLOCATOR = unsafeAllocator;
@@ -115,8 +120,9 @@ public final class ClassAllocationUtil {
SUPPLIER_GET_SIGNATURE,
noArgsConstructor,
SUPPLIER_FACTORY_SIGNATURE);
- //noinspection unchecked
- return (Supplier