diff --git a/BauSystem/BauSystem_15/build.gradle.kts b/BauSystem/BauSystem_15/build.gradle.kts
index ef9f7c38..46aaa27a 100644
--- a/BauSystem/BauSystem_15/build.gradle.kts
+++ b/BauSystem/BauSystem_15/build.gradle.kts
@@ -18,15 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.java
}
java {
@@ -34,25 +26,10 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.15")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms15)
+ compileOnly(libs.worldedit15)
}
diff --git a/BauSystem/BauSystem_18/build.gradle.kts b/BauSystem/BauSystem_18/build.gradle.kts
index 8a449c9b..08a1a218 100644
--- a/BauSystem/BauSystem_18/build.gradle.kts
+++ b/BauSystem/BauSystem_18/build.gradle.kts
@@ -18,15 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.java
}
java {
@@ -34,32 +26,10 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.18")
- compileOnly("de.steamwar:worldedit:1.15")
-
- compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("com.mojang:brigadier:1.0.18")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.nms18)
}
diff --git a/BauSystem/BauSystem_19/build.gradle.kts b/BauSystem/BauSystem_19/build.gradle.kts
index fd650279..f67105e7 100644
--- a/BauSystem/BauSystem_19/build.gradle.kts
+++ b/BauSystem/BauSystem_19/build.gradle.kts
@@ -18,15 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.java
}
java {
@@ -34,33 +26,12 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.19")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.paperapi)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
- compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("com.mojang:brigadier:1.0.18")
+ compileOnly(libs.nms19)
}
diff --git a/BauSystem/BauSystem_20/build.gradle.kts b/BauSystem/BauSystem_20/build.gradle.kts
index 4a6b3d10..5ec08958 100644
--- a/BauSystem/BauSystem_20/build.gradle.kts
+++ b/BauSystem/BauSystem_20/build.gradle.kts
@@ -18,15 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.java
}
java {
@@ -34,31 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.20")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("com.mojang:brigadier:1.0.18")
+ compileOnly(libs.nms20)
}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java
deleted file mode 100644
index 160a7ca3..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class BauGuiItem_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "linkGUIItems";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- buildPlan.addImport("de.steamwar.bausystem.features.gui.BauGUI");
- methodBuilder.addLine("BauGUI.addItem(" + s + ");");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java
deleted file mode 100644
index a86d0cc5..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class BoundingBoxLoader_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "linkBoundingBox";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ".load();");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java
deleted file mode 100644
index 58db84e7..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class ConfigConverter_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- buildPlan.addImport("de.steamwar.bausystem.configplayer.Config");
- methodBuilder.addLine("Config.addConfigConverter(" + s + ");");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEMaskParser_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEMaskParser_GENERIC.java
deleted file mode 100644
index fac3093e..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEMaskParser_GENERIC.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class FAWEMaskParser_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- methodBuilder.addLine("if (org.bukkit.Bukkit.getPluginManager().getPlugin(\"FastAsyncWorldEdit\") != null) {");
- methodBuilder.addLine(" " + s + ";");
- methodBuilder.addLine("}");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEPatternParser_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEPatternParser_GENERIC.java
deleted file mode 100644
index 60a1a4ea..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/FAWEPatternParser_GENERIC.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class FAWEPatternParser_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- methodBuilder.addLine("if (org.bukkit.Bukkit.getPluginManager().getPlugin(\"FastAsyncWorldEdit\") != null) {");
- methodBuilder.addLine(" " + s + ";");
- methodBuilder.addLine("}");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java
deleted file mode 100644
index bf701923..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class PanzernAlgorithm_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "linkPanzern";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- buildPlan.addImport("de.steamwar.bausystem.features.slaves.panzern.Panzern");
- methodBuilder.addLine("Panzern.add(" + s + ");");
- }
-}
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ScoreboardElement_GENERIC.java b/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ScoreboardElement_GENERIC.java
deleted file mode 100644
index ffd6382f..00000000
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/ScoreboardElement_GENERIC.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2023 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class ScoreboardElement_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- buildPlan.addImport("de.steamwar.bausystem.features.world.BauScoreboard");
- methodBuilder.addLine("BauScoreboard.addElement(" + s + ");");
- }
-}
diff --git a/BauSystem/BauSystem_Main/build.gradle.kts b/BauSystem/BauSystem_Main/build.gradle.kts
index fcb3ee1f..5138608b 100644
--- a/BauSystem/BauSystem_Main/build.gradle.kts
+++ b/BauSystem/BauSystem_Main/build.gradle.kts
@@ -18,17 +18,11 @@
*/
plugins {
- id("java")
- id("base")
+ steamwar.java
}
-group = "de.steamwar"
-version = ""
-
tasks.compileJava {
- options.encoding = "UTF-8"
options.isWarnings = false
- options.compilerArgs.add("-AprojectDir=$projectDir")
}
java {
@@ -36,34 +30,19 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/", "build/generated/sources/annotationProcessor/java/main/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- implementation(project(":BauSystem:BauSystem_Linkage"))
- annotationProcessor(project(":BauSystem:BauSystem_Linkage"))
+ compileOnly(libs.classindex)
+ annotationProcessor(libs.classindex)
compileOnly(project(":SpigotCore"))
- annotationProcessor(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.20")
- compileOnly("de.steamwar:fastasyncworldedit:1.18")
- compileOnly("de.steamwar:axiompaper:RELEASE")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.axiom)
+ compileOnly(libs.authlib)
+ compileOnly(libs.viaapi)
- implementation("org.luaj:luaj-jse:3.0.1")
+ compileOnly(libs.nms20)
+ compileOnly(libs.fawe18)
+
+ implementation(libs.luaj)
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("io.netty:netty-all:4.1.68.Final")
}
diff --git a/BauSystem/BauSystem_Main/src/BauSystem.properties b/BauSystem/BauSystem_Main/src/BauSystem.properties
index 7f44e063..67a16a47 100644
--- a/BauSystem/BauSystem_Main/src/BauSystem.properties
+++ b/BauSystem/BauSystem_Main/src/BauSystem.properties
@@ -1012,3 +1012,5 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
# Schematic
SCHEMATIC_GUI_ITEM=§eSchematics
+#VersionAnnouncer
+SERVER_VERSION=§7This server runs on Minecraft version §e{0}
\ No newline at end of file
diff --git a/BauSystem/BauSystem_Main/src/BauSystem_de.properties b/BauSystem/BauSystem_Main/src/BauSystem_de.properties
index 46899380..4013f3b2 100644
--- a/BauSystem/BauSystem_Main/src/BauSystem_de.properties
+++ b/BauSystem/BauSystem_Main/src/BauSystem_de.properties
@@ -953,3 +953,5 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
# Schematics
SCHEMATIC_GUI_ITEM=§eSchematics
+#VersionAnnouncer
+SERVER_VERSION=§7Dieser Server läuft auf Minecraft-Version §e{0}
\ No newline at end of file
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
index 23f768a7..b37e8e8b 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
@@ -19,34 +19,56 @@
package de.steamwar.bausystem;
-import com.comphenix.tinyprotocol.TinyProtocol;
+import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.configplayer.Config;
+import de.steamwar.bausystem.configplayer.ConfigConverter;
+import de.steamwar.bausystem.features.gui.BauGUI;
+import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
+import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
+import de.steamwar.bausystem.features.slaves.panzern.Panzern;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
-import de.steamwar.bausystem.linkage.LinkageUtils;
+import de.steamwar.bausystem.features.world.BauScoreboard;
+import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.region.loader.PrototypeLoader;
import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.loader.Updater;
+import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.bausystem.utils.TickListener;
import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.command.AbstractValidator;
+import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
+import de.steamwar.core.Core;
+import de.steamwar.linkage.LinkedInstance;
+import de.steamwar.linkage.MaxVersion;
+import de.steamwar.linkage.MinVersion;
+import de.steamwar.linkage.PluginCheck;
+import de.steamwar.linkage.api.Disable;
+import de.steamwar.linkage.api.Enable;
import de.steamwar.message.Message;
+import de.steamwar.network.packets.PacketHandler;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
+import java.io.*;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.logging.Level;
+import java.util.stream.Collectors;
public class BauSystem extends JavaPlugin implements Listener {
@@ -57,6 +79,8 @@ public class BauSystem extends JavaPlugin implements Listener {
@Getter
private static BauSystem instance;
+ private final Map, Object> instances = new HashMap<>();
+
@Override
public void onEnable() {
// LOGGER
@@ -85,17 +109,111 @@ public class BauSystem extends JavaPlugin implements Listener {
SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR));
SWCommandUtils.addValidator("owner", validator(Permission.OWNER));
- try {
- LinkageUtils.link();
- } catch (Exception e) {
- Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
- Bukkit.shutdown();
- System.exit(1);
- return;
- }
+ instances.put(BauServer.class, BauServer.getInstance());
+ List> classes = new BufferedReader(new InputStreamReader(BauSystem.class.getResourceAsStream("/META-INF/annotations/de.steamwar.linkage.Linked")))
+ .lines()
+ .map(s -> {
+ try {
+ return Class.forName(s, false, BauSystem.class.getClassLoader());
+ } catch (ClassNotFoundException | NoClassDefFoundError e) {
+ if (e.getMessage().equals(s)) {
+ Bukkit.shutdown();
+ throw new SecurityException(e.getMessage(), e);
+ }
+ return null;
+ }
+ })
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ classes.forEach(clazz -> {
+ MinVersion minVersion = clazz.getAnnotation(MinVersion.class);
+ MaxVersion maxVersion = clazz.getAnnotation(MaxVersion.class);
+ PluginCheck[] pluginChecks = clazz.getAnnotationsByType(PluginCheck.class);
+ if (minVersion != null && Core.getVersion() < minVersion.value()) {
+ return;
+ }
+ if (maxVersion != null && Core.getVersion() > maxVersion.value()) {
+ return;
+ }
+ for (PluginCheck pluginCheck : pluginChecks) {
+ if (pluginCheck.has() == PluginCheck.Has.THIS && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) != null) {
+ continue;
+ }
+ if (pluginCheck.has() == PluginCheck.Has.NOT && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) == null) {
+ continue;
+ }
+ return;
+ }
+
+ Object any;
+ try {
+ any = clazz.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ getLogger().log(Level.SEVERE, e.getMessage(), e);
+ Bukkit.shutdown();
+ throw new SecurityException(e.getMessage());
+ }
+
+ instances.put(clazz, any);
+ if (any instanceof Enable) {
+ ((Enable) any).enable();
+ }
+ if (any instanceof SWCommand) {
+ ((SWCommand) any).setMessage(BauSystem.MESSAGE);
+ }
+ if (any instanceof Listener) {
+ Bukkit.getPluginManager().registerEvents((Listener) any, BauSystem.getInstance());
+ }
+ if (any instanceof PacketHandler) {
+ ((PacketHandler) any).register();
+ }
+ if (any instanceof LuaLib) {
+ SteamWarLuaPlugin.add((LuaLib) any);
+ }
+ if (any instanceof ScoreboardElement) {
+ BauScoreboard.addElement((ScoreboardElement) any);
+ }
+ if (any instanceof BauGuiItem) {
+ BauGUI.addItem((BauGuiItem) any);
+ }
+ if (any instanceof PanzernAlgorithm) {
+ Panzern.add((PanzernAlgorithm) any);
+ }
+ if (any instanceof ConfigConverter) {
+ Config.addConfigConverter((ConfigConverter) any);
+ }
+ });
+
+ instances.forEach((clazz, o) -> {
+ for (Field field : clazz.getFields()) {
+ if (field.getAnnotation(LinkedInstance.class) != null) {
+ try {
+ field.set(o, instances.get(field.getType()));
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ });
+
TickListener.impl.init();
}
+ @Override
+ public void onDisable() {
+ instances.forEach((aClass, o) -> {
+ if (o instanceof Listener) {
+ HandlerList.unregisterAll((Listener) o);
+ }
+ if (o instanceof Disable) {
+ ((Disable) o).disable();
+ }
+ });
+
+ WorldData.write();
+ Config.getInstance().saveAll();
+ }
+
private AbstractValidator validator(Permission permission) {
return (commandSender, object, messageSender) -> {
if (commandSender instanceof Player) {
@@ -109,15 +227,6 @@ public class BauSystem extends JavaPlugin implements Listener {
};
}
- @Override
- public void onDisable() {
- LinkageUtils.unlink();
-
- WorldData.write();
- Config.getInstance().saveAll();
- TinyProtocol.instance.close();
- }
-
private void fixLogging() {
System.setErr(new PrintStream(new OutputStream() {
private StringBuilder current = new StringBuilder();
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java
index 3dc792f0..ee7d48e8 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java
@@ -19,21 +19,18 @@
package de.steamwar.bausystem.config;
-import de.steamwar.linkage.Linked;
import de.steamwar.providers.BauServerInfo;
import de.steamwar.sql.SteamwarUser;
import lombok.Getter;
import java.util.UUID;
-@Linked
public class BauServer {
@Getter
- private static BauServer instance;
+ private static BauServer instance = new BauServer();
- public BauServer() {
- instance = this;
+ private BauServer() {
}
private Integer owner;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java
index 3b8dc600..4c71acf4 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java
@@ -23,9 +23,9 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.gui.editor.BauGuiMapping;
-import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWInventory;
+import lombok.Getter;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Material;
@@ -38,13 +38,9 @@ import java.util.*;
@UtilityClass
public class BauGUI {
+ @Getter
private static final Map ITEMS = new HashMap<>();
- public static Map getITEMS() {
- if (ITEMS.isEmpty()) LinkageUtils.linkGUIItems();
- return ITEMS;
- }
-
private static final Set OPEN_INVS = new HashSet<>();
private static boolean updating = false;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java
index 680224a7..3e3e4483 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java
@@ -61,6 +61,9 @@ public class ResetCommand extends SWCommand {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
+ for (Flag value : Flag.values()) {
+ region.set(value, value.getDefaultValue());
+ }
RegionUtils.message(region, "REGION_RESET_RESETED");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/HotkeyListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/HotkeyListener.java
index 52843f79..466f1e60 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/HotkeyListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/HotkeyListener.java
@@ -23,13 +23,12 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.linkage.Linked;
-import de.steamwar.linkage.api.Plain;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
@Linked
-public class HotkeyListener implements PluginMessageListener, Plain {
+public class HotkeyListener implements PluginMessageListener {
{
Bukkit.getServer().getMessenger().registerIncomingPluginChannel(BauSystem.getInstance(), "sw:hotkeys", this);
@@ -37,7 +36,7 @@ public class HotkeyListener implements PluginMessageListener, Plain {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
- if(!Permission.BUILD.hasPermission(player)) return;
+ if (!Permission.BUILD.hasPermission(player)) return;
if (!channel.equals("sw:hotkeys")) return;
if (message.length < 5) return;
int action = message[4] & 0xFF;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
index 9809ac37..f10811f8 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
@@ -21,26 +21,23 @@ package de.steamwar.bausystem.features.slaves.laufbau;
import com.sk89q.worldedit.blocks.SkullBlock;
import com.sk89q.worldedit.world.block.BaseBlock;
-import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.core.Core;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.ToString;
-import org.bukkit.Bukkit;
import org.bukkit.Material;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.SkullType;
-import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-import org.bukkit.block.Skull;
import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
import java.util.function.Consumer;
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
@@ -52,6 +49,7 @@ public class BlockBoundingBox {
private static List randomPlayerHead = new ArrayList<>();
private static Random random = new Random();
+
static {
randomPlayerHead.add("zOnlyKroks");
randomPlayerHead.add("YoyoNow");
@@ -274,8 +272,6 @@ public class BlockBoundingBox {
eastTrapDoor.setFacing(BlockFace.EAST);
eastTrapDoor.setOpen(true);
addPixel(eastTrapDoor, 0, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_EAST", "LAUFBAU_OPEN"));
-
- LinkageUtils.linkBoundingBox();
}
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem) {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
index 3b8461df..3eca97f4 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
@@ -24,7 +24,6 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
-import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.utils.WorldEditUtils;
import lombok.Getter;
import lombok.SneakyThrows;
@@ -41,9 +40,6 @@ import java.util.*;
public class Panzern {
private static List panzernAlgorithmList = new ArrayList<>();
- static {
- LinkageUtils.linkPanzern();
- }
public static void add(PanzernAlgorithm panzernAlgorithm) {
panzernAlgorithmList.add(panzernAlgorithm);
}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java
index d8aaf2c7..10916beb 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java
@@ -27,7 +27,6 @@ import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.core.Core;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
-import de.steamwar.linkage.api.Plain;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -50,7 +49,7 @@ import java.util.Set;
import java.util.stream.Collectors;
@Linked
-public class SmartPlaceListener implements Plain, Listener {
+public class SmartPlaceListener implements Listener {
private static final Set CONTAINERS = new HashSet<>();
private static final Set IGNORED = new HashSet<>();
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java
index 81e2f4dd..479dd394 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java
@@ -35,20 +35,16 @@ import org.bukkit.event.player.PlayerQuitEvent;
@Linked
public class AFKStopperListener implements Listener {
- private int afkTicks = 0;
+ private long lastMovementTime = System.currentTimeMillis();
public AFKStopperListener() {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
- switch (afkTicks) {
- case 15:
- for (Player p : Bukkit.getOnlinePlayers()) {
- p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p));
- }
- case 14:
- BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE");
- default:
- afkTicks++;
- }
+ long currentTime = System.currentTimeMillis();
+ if(currentTime - lastMovementTime > 10*60000) { // 10 Minutes
+ for (Player p : Bukkit.getOnlinePlayers())
+ p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p));
+ } else if(currentTime - lastMovementTime > 9*60000)
+ BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE");
}, 1200, 1200); //every minute
}
@@ -60,7 +56,7 @@ public class AFKStopperListener implements Listener {
Location from = event.getFrom();
if (from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw())
- afkTicks = 0;
+ lastMovementTime = System.currentTimeMillis();
}
@EventHandler(priority = EventPriority.LOWEST) //Potential fix for potential race condition with WE axe spontaneously not working
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java
index 74098b1b..66435414 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java
@@ -4,13 +4,13 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
-import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.scoreboard.ScoreboardCallback;
-import org.apache.commons.lang3.tuple.MutableTriple;
-import org.apache.commons.lang3.tuple.Triple;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -22,8 +22,17 @@ import java.util.*;
@Linked
public class BauScoreboard implements Listener {
+ @Setter
+ @Getter
+ @AllArgsConstructor
+ public static class Data {
+ private ScoreboardElement.ScoreboardGroup group;
+ private Integer priority;
+ private String text;
+ }
+
private static final Map> ELEMENTS = new HashMap<>();
- private static final Map>> ADDITIONAL_SCOREBOARD_LINES = new HashMap<>();
+ private static final Map> ADDITIONAL_SCOREBOARD_LINES = new HashMap<>();
public static void addElement(ScoreboardElement scoreboardElement) {
List elements = ELEMENTS.computeIfAbsent(scoreboardElement.getGroup(), scoreboardGroup -> new ArrayList<>());
@@ -32,15 +41,15 @@ public class BauScoreboard implements Listener {
}
public static void setAdditionalElement(Player player, String key, ScoreboardElement.ScoreboardGroup group, int priority, String value) {
- Map> playerElements = ADDITIONAL_SCOREBOARD_LINES.computeIfAbsent(player, player1 -> new HashMap<>());
+ Map playerElements = ADDITIONAL_SCOREBOARD_LINES.computeIfAbsent(player, player1 -> new HashMap<>());
if (value == null || value.isBlank()) {
playerElements.remove(key);
return;
}
- MutableTriple element = playerElements.computeIfAbsent(key, s -> new MutableTriple<>(null, null, null));
- element.setLeft(group);
- element.setMiddle(priority);
- element.setRight(value);
+ Data element = playerElements.computeIfAbsent(key, s -> new Data(null, null, null));
+ element.setGroup(group);
+ element.setPriority(priority);
+ element.setText(value);
}
@EventHandler
@@ -76,10 +85,10 @@ public class BauScoreboard implements Listener {
if (ADDITIONAL_SCOREBOARD_LINES.containsKey(player)) {
ADDITIONAL_SCOREBOARD_LINES.get(player).values()
.stream()
- .filter(triple -> triple.getLeft() == group)
- .sorted(Comparator.comparing(MutableTriple::getMiddle))
+ .filter(triple -> triple.getGroup() == group)
+ .sorted(Comparator.comparing(Data::getPriority))
.forEach(triple -> {
- groupElements.add(triple.getRight());
+ groupElements.add(triple.getText());
});
}
groupElements.removeIf(Objects::isNull);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
index 83b33d42..19417ec2 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
@@ -23,11 +23,10 @@ import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.linkage.Linked;
-import de.steamwar.linkage.api.Plain;
import org.bukkit.GameMode;
@Linked
-public class NoCreativeKnockback implements Plain {
+public class NoCreativeKnockback {
public NoCreativeKnockback() {
TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/above/FAWEAboveMaskParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/above/FAWEAboveMaskParser.java
index d25dcdeb..58130f47 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/above/FAWEAboveMaskParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/above/FAWEAboveMaskParser.java
@@ -32,6 +32,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWEAboveMaskParser extends FAWEMaskParser {
public FAWEAboveMaskParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/below/FAWEBelowMaskParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/below/FAWEBelowMaskParser.java
index bc7cb34c..449db3bf 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/below/FAWEBelowMaskParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/below/FAWEBelowMaskParser.java
@@ -32,6 +32,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWEBelowMaskParser extends FAWEMaskParser {
public FAWEBelowMaskParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboard3DMaskParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboard3DMaskParser.java
index cb943408..84cd46c6 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboard3DMaskParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboard3DMaskParser.java
@@ -31,6 +31,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWECheckerboard3DMaskParser extends FAWEMaskParser {
public FAWECheckerboard3DMaskParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboardMaskParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboardMaskParser.java
index 1bfa6fb9..3036ba8e 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboardMaskParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/checkerboard3d/FAWECheckerboardMaskParser.java
@@ -25,11 +25,13 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import de.steamwar.bausystem.features.worldedit.utils.FAWEMaskParser;
import de.steamwar.linkage.Linked;
+import de.steamwar.linkage.PluginCheck;
import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWECheckerboardMaskParser extends FAWEMaskParser {
public FAWECheckerboardMaskParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/grid/FAWEGridMaskParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/grid/FAWEGridMaskParser.java
index f0d4a867..85a01162 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/grid/FAWEGridMaskParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/mask/grid/FAWEGridMaskParser.java
@@ -31,6 +31,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWEGridMaskParser extends FAWEMaskParser {
public FAWEGridMaskParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/pattern/gradient/FAWEGradientPatternParser.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/pattern/gradient/FAWEGradientPatternParser.java
index 15b311e5..d8065658 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/pattern/gradient/FAWEGradientPatternParser.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/pattern/gradient/FAWEGradientPatternParser.java
@@ -27,12 +27,14 @@ import com.sk89q.worldedit.regions.Region;
import de.steamwar.bausystem.features.worldedit.utils.FAWEPatternParser;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.linkage.Linked;
+import de.steamwar.linkage.PluginCheck;
import org.bukkit.Axis;
import javax.annotation.Nonnull;
import java.util.stream.Stream;
@Linked
+@PluginCheck("FastAsyncWorldEdit")
public class FAWEGradientPatternParser extends FAWEPatternParser {
public FAWEGradientPatternParser() {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/VersionAnnouncer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/VersionAnnouncer.java
new file mode 100644
index 00000000..ee9e91be
--- /dev/null
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/VersionAnnouncer.java
@@ -0,0 +1,49 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.bausystem.utils;
+
+import com.viaversion.viaversion.api.Via;
+import com.viaversion.viaversion.api.ViaAPI;
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.linkage.Linked;
+import net.md_5.bungee.api.ChatMessageType;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+
+@Linked
+public class VersionAnnouncer implements Listener {
+
+ private final String versionString = Bukkit.getBukkitVersion().split("-", 2)[0];
+
+ @SuppressWarnings("unchecked")
+ private final ViaAPI via = Via.getAPI();
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent event) {
+ Player player = event.getPlayer();
+ if(via.getServerVersion().supportedVersions().contains(via.getPlayerVersion(player)))
+ return;
+
+ BauSystem.MESSAGE.sendPrefixless("SERVER_VERSION", player, ChatMessageType.ACTION_BAR, versionString);
+ }
+}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/Linked.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/Linked.java
similarity index 80%
rename from CommonCore/Linkage/src/de/steamwar/linkage/Linked.java
rename to BauSystem/BauSystem_Main/src/de/steamwar/linkage/Linked.java
index dbaf0eb7..3b0aa9e0 100644
--- a/CommonCore/Linkage/src/de/steamwar/linkage/Linked.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/Linked.java
@@ -19,10 +19,15 @@
package de.steamwar.linkage;
-import java.lang.annotation.*;
+import org.atteo.classindex.IndexAnnotated;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@IndexAnnotated
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE})
public @interface Linked {
- String feature() default "";
}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/LinkedInstance.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/LinkedInstance.java
similarity index 96%
rename from CommonCore/Linkage/src/de/steamwar/linkage/LinkedInstance.java
rename to BauSystem/BauSystem_Main/src/de/steamwar/linkage/LinkedInstance.java
index 9636ba52..04e382d1 100644
--- a/CommonCore/Linkage/src/de/steamwar/linkage/LinkedInstance.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/LinkedInstance.java
@@ -24,7 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface LinkedInstance {
}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/MaxVersion.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/MaxVersion.java
similarity index 93%
rename from CommonCore/Linkage/src/de/steamwar/linkage/MaxVersion.java
rename to BauSystem/BauSystem_Main/src/de/steamwar/linkage/MaxVersion.java
index e144b164..79dbfe94 100644
--- a/CommonCore/Linkage/src/de/steamwar/linkage/MaxVersion.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/MaxVersion.java
@@ -24,8 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-@AllowedContexts(Context.SPIGOT)
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface MaxVersion {
int value();
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/MinVersion.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/MinVersion.java
similarity index 93%
rename from CommonCore/Linkage/src/de/steamwar/linkage/MinVersion.java
rename to BauSystem/BauSystem_Main/src/de/steamwar/linkage/MinVersion.java
index b6f5b997..82d9ce3d 100644
--- a/CommonCore/Linkage/src/de/steamwar/linkage/MinVersion.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/MinVersion.java
@@ -24,8 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-@AllowedContexts(Context.SPIGOT)
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface MinVersion {
int value();
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/PluginCheck.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/PluginCheck.java
similarity index 90%
rename from CommonCore/Linkage/src/de/steamwar/linkage/PluginCheck.java
rename to BauSystem/BauSystem_Main/src/de/steamwar/linkage/PluginCheck.java
index 241f19a1..332e2b4f 100644
--- a/CommonCore/Linkage/src/de/steamwar/linkage/PluginCheck.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/PluginCheck.java
@@ -21,8 +21,7 @@ package de.steamwar.linkage;
import java.lang.annotation.*;
-@AllowedContexts({Context.BUNGEE, Context.SPIGOT})
-@Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Repeatable(PluginCheck.PluginChecks.class)
public @interface PluginCheck {
@@ -34,7 +33,7 @@ public @interface PluginCheck {
NOT
}
- @Retention(RetentionPolicy.SOURCE)
+ @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@interface PluginChecks {
@SuppressWarnings("unused") PluginCheck[] value() default {};
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Disable.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Disable.java
new file mode 100644
index 00000000..2ce273d9
--- /dev/null
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Disable.java
@@ -0,0 +1,24 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.linkage.api;
+
+public interface Disable {
+ void disable();
+}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Enable.java b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Enable.java
new file mode 100644
index 00000000..df52baca
--- /dev/null
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/linkage/api/Enable.java
@@ -0,0 +1,24 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.linkage.api;
+
+public interface Enable {
+ void enable();
+}
diff --git a/BauSystem/BauSystem_Main/src/plugin.yml b/BauSystem/BauSystem_Main/src/plugin.yml
index 71b08d95..53585eaa 100644
--- a/BauSystem/BauSystem_Main/src/plugin.yml
+++ b/BauSystem/BauSystem_Main/src/plugin.yml
@@ -2,6 +2,8 @@ name: BauSystem
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0"
depend: [ WorldEdit, SpigotCore ]
+softdepend:
+ - ViaVersion
load: POSTWORLD
main: de.steamwar.bausystem.BauSystem
api-version: "1.13"
diff --git a/BauSystem/build.gradle.kts b/BauSystem/build.gradle.kts
index ff8fbe89..55df7b50 100644
--- a/BauSystem/build.gradle.kts
+++ b/BauSystem/build.gradle.kts
@@ -18,32 +18,15 @@
*/
plugins {
- id("base")
- id("java-library")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ `java-library`
+ alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
-java {
- sourceCompatibility = JavaVersion.VERSION_17
- targetCompatibility = JavaVersion.VERSION_17
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
implementation(project(":BauSystem:BauSystem_Main"))
implementation(project(":BauSystem:BauSystem_15"))
implementation(project(":BauSystem:BauSystem_18"))
diff --git a/CommandFramework/build.gradle.kts b/CommandFramework/build.gradle.kts
index 825b7a0f..61fbf34e 100644
--- a/CommandFramework/build.gradle.kts
+++ b/CommandFramework/build.gradle.kts
@@ -18,49 +18,10 @@
*/
plugins {
- id("base")
- id("java")
-}
-
-group = "de.steamwar"
-version = ""
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
- test {
- java {
- srcDirs("testsrc/")
- }
- resources {
- srcDirs("testsrc/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- testCompileOnly("org.projectlombok:lombok:1.18.32")
- testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
-
- testImplementation("junit:junit:4.13.2")
- testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation(libs.junit)
+ testImplementation(libs.hamcrest)
}
\ No newline at end of file
diff --git a/CommonCore/Linkage/build.gradle.kts b/CommonCore/Linkage/build.gradle.kts
deleted file mode 100644
index 2d896c53..00000000
--- a/CommonCore/Linkage/build.gradle.kts
+++ /dev/null
@@ -1,49 +0,0 @@
-plugins {
- id("java")
-}
-
-group = "de.steamwar"
-version = ""
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.create("buildResources") {
- doLast {
- val to = File("$projectDir/build/classes/java/main/META-INF/services/javax.annotation.processing.Processor")
- to.parentFile.mkdirs()
- if (!to.exists()) {
- to.createNewFile()
- to.writeText("de.steamwar.linkage.LinkageProcessor\n")
- }
- }
-}
-
-tasks.classes {
- finalizedBy("buildResources")
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
-dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- testCompileOnly("org.projectlombok:lombok:1.18.32")
- testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
-}
\ No newline at end of file
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/AllowedContexts.java b/CommonCore/Linkage/src/de/steamwar/linkage/AllowedContexts.java
deleted file mode 100644
index 175a7831..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/AllowedContexts.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface AllowedContexts {
-
- /**
- * The context in which this annotation is valid.
- */
- Context[] value();
-
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/Context.java b/CommonCore/Linkage/src/de/steamwar/linkage/Context.java
deleted file mode 100644
index 7559bd0c..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/Context.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage;
-
-public enum Context {
- BUNGEE,
- SPIGOT
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/EventMode.java b/CommonCore/Linkage/src/de/steamwar/linkage/EventMode.java
deleted file mode 100644
index cdff4665..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/EventMode.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@AllowedContexts(Context.BUNGEE)
-@Retention(RetentionPolicy.SOURCE)
-@Target({ElementType.TYPE})
-public @interface EventMode {
- Mode value();
-
- @AllArgsConstructor
- enum Mode {
- EventOnly(""),
- NonEvent("!");
-
- @Getter
- private String prefix;
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/LinkageProcessor.java b/CommonCore/Linkage/src/de/steamwar/linkage/LinkageProcessor.java
deleted file mode 100644
index e6b70418..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/LinkageProcessor.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2024 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage;
-
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.FieldBuilder;
-import de.steamwar.linkage.plan.MethodBuilder;
-import de.steamwar.linkage.types.Plain_GENERIC;
-import lombok.Cleanup;
-import lombok.Getter;
-import lombok.SneakyThrows;
-
-import javax.annotation.processing.*;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.TypeMirror;
-import javax.tools.Diagnostic;
-import java.io.*;
-import java.lang.annotation.Annotation;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-@SupportedAnnotationTypes("de.steamwar.linkage.Linked")
-public class LinkageProcessor extends AbstractProcessor {
-
- private File projectDir;
-
- private static Context context;
-
- @Getter
- private static String pluginMain;
-
- private String name;
- private String className;
-
- private Set disabledFeatures = new HashSet<>();
-
- private Messager messager;
- private boolean processed = false;
-
- @Override
- public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.latestSupported();
- }
-
- @SneakyThrows
- @Override
- public synchronized void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
- messager = processingEnv.getMessager();
- className = "LinkageUtils";
-
- projectDir = new File(processingEnv.getOptions().get("projectDir"));
- mainClass(projectDir);
- disabledFeatures();
-
- String name = projectDir.getName();
- if (name.contains("_")) {
- name = name.substring(0, name.indexOf("_"));
- }
- this.name = name.replaceAll("[^a-zA-Z]", "").toLowerCase();
- }
-
- @SneakyThrows
- private void mainClass(File projectDir) {
- Optional pluginYMLFile = Files.walk(projectDir.toPath())
- .map(Path::toFile)
- .filter(File::isFile)
- .filter(f -> f.getName().equals("plugin.yml") || f.getName().equals("bungee.yml"))
- .findFirst();
- if (!pluginYMLFile.isPresent()) {
- messager.printMessage(Diagnostic.Kind.ERROR, "Could not find plugin.yml or bungee.yml");
- return;
- }
- context = pluginYMLFile.get().getName().equals("bungee.yml") ? Context.BUNGEE : Context.SPIGOT;
- @Cleanup BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pluginYMLFile.get())));
- Optional mainName = reader.lines()
- .filter(line -> line.startsWith("main:"))
- .map(line -> line.substring(line.indexOf(':') + 1).trim())
- .findFirst();
- if (mainName.isPresent()) {
- pluginMain = mainName.get();
- } else {
- messager.printMessage(Diagnostic.Kind.ERROR, "Could not find main class in plugin.yml or bungee.yml");
- }
- }
-
- @SneakyThrows
- private void disabledFeatures() {
- File file = new File(System.getProperty("user.dir"), "disabled-features.txt");
- if (!file.exists()) return;
- @Cleanup BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
- reader.lines()
- .map(String::trim)
- .filter(line -> !line.isEmpty())
- .filter(line -> !line.startsWith("#"))
- .forEach(disabledFeatures::add);
- }
-
- @SneakyThrows
- @Override
- public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (processed) return false;
- processed = true;
-
- Writer writer = processingEnv.getFiler().createSourceFile("de.steamwar." + name + ".linkage.LinkageUtils").openWriter();
- BuildPlan buildPlan = new BuildPlan("de.steamwar." + name + ".linkage", className);
-
- Set disabledElements = new HashSet<>();
-
- Set elements = roundEnv.getElementsAnnotatedWith(Linked.class).stream()
- .filter(element -> element.getKind() == ElementKind.CLASS)
- .map(TypeElement.class::cast)
- .peek(element -> {
- String featureName = element.getAnnotation(Linked.class).feature();
- if (featureName.isEmpty()) {
- String tempName = element.getQualifiedName().toString();
- if (tempName.contains(".features.")) {
- tempName = tempName.substring(tempName.indexOf(".features.") + 10);
- featureName = tempName.substring(0, tempName.indexOf('.'));
- } else {
- tempName = tempName.substring(0, tempName.lastIndexOf('.'));
- featureName = tempName.substring(tempName.lastIndexOf('.') + 1);
- }
- }
- if (disabledFeatures.contains(featureName) || disabledFeatures.contains("*")) {
- disabledElements.add(element);
- }
- })
- .peek(typeElement -> System.out.println("Found element: " + typeElement.getQualifiedName().toString()))
- .collect(Collectors.toSet());
-
- Map, List> groupedByChecks = elements.stream()
- .collect(Collectors.groupingBy(element -> checks(element, buildPlan)));
-
- Map neededFields = new HashMap<>();
- Set fieldInjections = new HashSet<>();
- for (TypeElement typeElement : elements) {
- if (getLinkagesOfType(typeElement).size() > 1) {
- neededFields.put(typeElement.getQualifiedName().toString(), typeElement);
- }
-
- List variableElements = typeElement.getEnclosedElements().stream()
- .filter(e -> e.getKind() == ElementKind.FIELD)
- .map(VariableElement.class::cast)
- .filter(e -> e.getAnnotation(LinkedInstance.class) != null)
- .collect(Collectors.toList());
- if (variableElements.isEmpty()) continue;
-
- for (VariableElement variableElement : variableElements) {
- if (!variableElement.getModifiers().contains(Modifier.PUBLIC)) {
- messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be public", variableElement);
- continue;
- }
- if (variableElement.getModifiers().contains(Modifier.STATIC)) {
- messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be non static", variableElement);
- continue;
- }
- if (variableElement.getModifiers().contains(Modifier.FINAL)) {
- messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be non final", variableElement);
- continue;
- }
- TypeElement fieldType = (TypeElement) ((DeclaredType) variableElement.asType()).asElement();
- if (disabledElements.contains(fieldType)) {
- continue;
- }
- if (disabledElements.contains(typeElement)) {
- continue;
- }
- neededFields.put(typeElement.getQualifiedName().toString(), typeElement);
- neededFields.put(fieldType.getQualifiedName().toString(), fieldType);
-
- fieldInjections.add(() -> {
- specialElements(typeElement, buildPlan, buildPlan::addStaticLine, () -> {
- buildPlan.addStaticLine(getElement(typeElement, neededFields) + "." + variableElement.getSimpleName().toString() + " = " + getElement((TypeElement) ((DeclaredType) variableElement.asType()).asElement(), neededFields) + ";");
- });
- });
- }
- }
- neededFields.forEach((s, typeElement) -> {
- if (disabledElements.contains(typeElement)) return;
- buildPlan.addImport(typeElement.getQualifiedName().toString());
- String t = typeElement.getSimpleName().toString();
- t = t.substring(0, 1).toLowerCase() + t.substring(1);
- buildPlan.addField(new FieldBuilder(typeElement.getSimpleName().toString(), t));
-
- String finalT = t;
- specialElements(typeElement, buildPlan, buildPlan::addStaticLine, () -> {
- buildPlan.addStaticLine(finalT + " = new " + typeElement.getSimpleName().toString() + "();");
- });
- });
- fieldInjections.forEach(Runnable::run);
-
- Map methods = new HashMap<>();
- for (Map.Entry, List> entry : groupedByChecks.entrySet()) {
- Map>> groupedByMethod = new HashMap<>();
- for (TypeElement typeElement : entry.getValue()) {
- for (Map.Entry> linkages : getLinkagesOfType(typeElement).entrySet()) {
- groupedByMethod.computeIfAbsent(linkages.getKey(), ignored -> new HashMap<>())
- .put(typeElement, linkages.getValue());
- }
- }
-
- for (Map.Entry>> group : groupedByMethod.entrySet()) {
- MethodBuilder method = methods.computeIfAbsent(group.getKey(), s -> {
- MethodBuilder methodBuilder = new MethodBuilder(s, "void");
- buildPlan.addMethod(methodBuilder);
- return methodBuilder;
- });
-
- boolean generated = false;
- for (Map.Entry> toGenerate : group.getValue().entrySet()) {
- if (disabledElements.contains(toGenerate.getKey())) continue;
- if (!generated && !entry.getKey().isEmpty()) {
- method.addLine("if (" + String.join(" && ", entry.getKey()) + ") {");
- generated = true;
- }
- TypeElement typeElement = toGenerate.getKey();
- String instance = getElement(typeElement, neededFields);
- if (toGenerate.getValue().size() > 1 && instance.startsWith("new ")) {
- method.addLine(typeElement.getSimpleName() + " local" + typeElement.getSimpleName().toString() + " = " + instance + ";");
- instance = "local" + typeElement.getSimpleName().toString();
- }
- String finalInstance = instance;
- toGenerate.getValue().forEach(linkageType -> {
- buildPlan.addImport(typeElement.getQualifiedName().toString());
- linkageType.generateCode(buildPlan, method, finalInstance, typeElement);
- });
- }
- if (generated && !entry.getKey().isEmpty()) method.addLine("}");
- }
- }
-
- BufferedWriter bufferedWriter = new BufferedWriter(writer);
- buildPlan.write(bufferedWriter);
- bufferedWriter.close();
- return true;
- }
-
- private String getElement(TypeElement typeElement, Map neededFields) {
- String s = typeElement.getSimpleName().toString();
- if (neededFields.containsKey(typeElement.getQualifiedName().toString())) {
- return s.substring(0, 1).toLowerCase() + s.substring(1);
- }
- return "new " + s + "()";
- }
-
- private Set checks(TypeElement typeElement, BuildPlan buildPlan) {
- Set checks = new HashSet<>();
- MinVersion minVersion = typeElement.getAnnotation(MinVersion.class);
- MaxVersion maxVersion = typeElement.getAnnotation(MaxVersion.class);
- EventMode eventMode = typeElement.getAnnotation(EventMode.class);
- PluginCheck[] pluginChecks = typeElement.getAnnotationsByType(PluginCheck.class);
- if (context == Context.SPIGOT) {
- errorOnNonNull(typeElement, eventMode);
- if (minVersion != null) {
- buildPlan.addImport("de.steamwar.core.Core");
- checks.add("Core.getVersion() >= " + minVersion.value());
- }
- if (maxVersion != null) {
- buildPlan.addImport("de.steamwar.core.Core");
- checks.add("Core.getVersion() <= " + maxVersion.value());
- }
- if (pluginChecks.length != 0) {
- buildPlan.addImport("org.bukkit.Bukkit");
- Arrays.stream(pluginChecks).map(pluginCheck -> {
- return "Bukkit.getPluginManager().getPlugin(\"" + pluginCheck.value() + "\") " + (pluginCheck.has() == PluginCheck.Has.THIS ? "!" : "=") + "= null";
- }).forEach(checks::add);
- }
- } else {
- errorOnNonNull(typeElement, minVersion, maxVersion);
- if (eventMode != null) {
- buildPlan.addImport("de.steamwar.bungeecore.BungeeCore");
- checks.add(eventMode.value().getPrefix() + "BungeeCore.EVENT_MODE");
- }
- if (pluginChecks.length != 0) {
- buildPlan.addImport("net.md_5.bungee.BungeeCord");
- Arrays.stream(pluginChecks).map(pluginCheck -> {
- return "BungeeCord.getPluginManager().getPlugin(\"" + pluginCheck.value() + "\") " + (pluginCheck.has() == PluginCheck.Has.THIS ? "!" : "=") + "= null";
- }).forEach(checks::add);
- }
- }
- return checks;
- }
-
- private void specialElements(TypeElement typeElement, BuildPlan buildPlan, Consumer stringConsumer, Runnable inner) {
- Set checks = checks(typeElement, buildPlan);
- if (!checks.isEmpty()) stringConsumer.accept("if (" + String.join(" && ", checks) + ") {");
- inner.run();
- if (!checks.isEmpty()) stringConsumer.accept("}");
- }
-
- private void errorOnNonNull(TypeElement typeElement, Annotation... annotations) {
- for (Annotation annotation : annotations) {
- if (annotation != null) {
- messager.printMessage(Diagnostic.Kind.ERROR, annotation.annotationType().getSimpleName() + " is not supported in " + context.name(), typeElement);
- }
- }
- }
-
- private Plain_GENERIC plain_GENERIC = new Plain_GENERIC();
-
- private Map> getLinkagesOfType(TypeElement typeElement) {
- Map> linkages = new HashMap<>();
- Stream.concat(Stream.of(typeElement.getSuperclass()), typeElement.getInterfaces().stream())
- .map(this::resolveSingle)
- .filter(Objects::nonNull)
- .forEach(linkageType -> linkages.computeIfAbsent(linkageType.method(), s -> new ArrayList<>()).add(linkageType));
- if (linkages.size() == 1 && linkages.containsKey("unlink")) {
- linkages.put(plain_GENERIC.method(), Collections.singletonList(plain_GENERIC));
- }
- return linkages;
- }
-
- private LinkageType resolveSingle(TypeMirror typeMirror) {
- String qualifier = typeMirror.toString();
- if (qualifier.contains("<")) qualifier = qualifier.substring(0, qualifier.indexOf('<'));
- qualifier = qualifier.substring(qualifier.lastIndexOf('.') + 1);
- try {
- return (LinkageType) Class.forName("de.steamwar.linkage.types." + qualifier + "_" + context.name()).getDeclaredConstructor().newInstance();
- } catch (Exception e) {
- // Ignore
- }
- try {
- return (LinkageType) Class.forName("de.steamwar.linkage.types." + qualifier + "_GENERIC").getDeclaredConstructor().newInstance();
- } catch (Exception e) {
- // Ignore
- }
- return null;
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/LinkageType.java b/CommonCore/Linkage/src/de/steamwar/linkage/LinkageType.java
deleted file mode 100644
index 9291279b..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/LinkageType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage;
-
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public interface LinkageType {
-
- default String getPluginMain() {
- return LinkageProcessor.getPluginMain();
- }
-
- String method();
-
- void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement);
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/api/Disable.java b/CommonCore/Linkage/src/de/steamwar/linkage/api/Disable.java
deleted file mode 100644
index f09b8468..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/api/Disable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.api;
-
-public interface Disable {
- void disable();
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/api/Enable.java b/CommonCore/Linkage/src/de/steamwar/linkage/api/Enable.java
deleted file mode 100644
index 5d516cd6..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/api/Enable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.api;
-
-public interface Enable {
- void enable();
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/api/Plain.java b/CommonCore/Linkage/src/de/steamwar/linkage/api/Plain.java
deleted file mode 100644
index 23901ed2..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/api/Plain.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.api;
-
-public interface Plain {
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/plan/BuildPlan.java b/CommonCore/Linkage/src/de/steamwar/linkage/plan/BuildPlan.java
deleted file mode 100644
index 2fc7b8b4..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/plan/BuildPlan.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.plan;
-
-import lombok.RequiredArgsConstructor;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.util.*;
-
-@RequiredArgsConstructor
-public class BuildPlan {
-
- private final String packageName;
- private Set imports = new HashSet<>();
- private final String className;
-
- private List fieldBuilders = new ArrayList<>();
- private Map methodBuilderMap = new HashMap<>();
- private List staticLines = new ArrayList<>();
-
- public void addImport(String importName) {
- imports.add(importName);
- }
-
- public void addField(FieldBuilder fieldBuilder) {
- fieldBuilders.add(fieldBuilder);
- }
-
- public void addMethod(MethodBuilder methodBuilder) {
- methodBuilderMap.put(methodBuilder.getMethodName(), methodBuilder);
- }
-
- public boolean hasMethod(String methodName) {
- return methodBuilderMap.containsKey(methodName);
- }
-
- public void addStaticLine(String line) {
- staticLines.add(line);
- }
-
- public void write(BufferedWriter writer) throws IOException {
- writer.write("package " + packageName + ";\n");
- if (!imports.isEmpty()) {
- writer.write("\n");
- for (String importName : imports) {
- writer.write("import " + importName + ";\n");
- }
- }
- writer.write("\n");
- writer.write("public class " + className + " {\n");
- if (!fieldBuilders.isEmpty()) {
- for (FieldBuilder fieldBuilder : fieldBuilders) {
- fieldBuilder.write(writer);
- }
- writer.write("\n");
- }
- if (!staticLines.isEmpty()) {
- writer.write(" static {\n");
- for (String line : staticLines) {
- writer.write(" " + line + "\n");
- }
- writer.write(" }\n");
- writer.write("\n");
- }
- for (MethodBuilder methodBuilder : methodBuilderMap.values()) {
- methodBuilder.write(writer);
- writer.write("\n");
- }
- writer.write("}\n");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/plan/FieldBuilder.java b/CommonCore/Linkage/src/de/steamwar/linkage/plan/FieldBuilder.java
deleted file mode 100644
index 12fa4408..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/plan/FieldBuilder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.plan;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-
-@RequiredArgsConstructor
-@AllArgsConstructor
-public class FieldBuilder {
- @Getter
- private final String type;
- private final String name;
- private String initializer;
-
- public String getFieldName() {
- return name;
- }
-
- public void write(BufferedWriter writer) throws IOException {
- writer.write(" private static " + type + " " + getFieldName() + (initializer == null ? "" : " = " + initializer) + ";\n");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/plan/MethodBuilder.java b/CommonCore/Linkage/src/de/steamwar/linkage/plan/MethodBuilder.java
deleted file mode 100644
index 6a31175a..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/plan/MethodBuilder.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.plan;
-
-import lombok.RequiredArgsConstructor;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-@RequiredArgsConstructor
-public class MethodBuilder {
-
- private final String name;
- private final String returnType;
- private List parameters = new ArrayList<>();
- private List lines = new ArrayList<>();
- private boolean isPrivate = false;
-
- public void addParameter(ParameterBuilder parameterBuilder) {
- parameters.add(parameterBuilder);
- }
-
- public void addLine(String line) {
- lines.add(line);
- }
-
- public String getMethodName() {
- return name;
- }
-
- public void setPrivate(boolean isPrivate) {
- this.isPrivate = isPrivate;
- }
-
- public void write(BufferedWriter writer) throws IOException {
- writer.write(" " + (isPrivate ? "private" : "public") + " static " + returnType + " " + getMethodName() + "(");
- for (int i = 0; i < parameters.size(); i++) {
- parameters.get(i).write(writer);
- if (i < parameters.size() - 1) {
- writer.write(", ");
- }
- }
- writer.write(") {");
- for (String line : lines) {
- writer.write("\n");
- writer.write(" " + line);
- }
- writer.write("\n");
- writer.write(" }\n");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/plan/ParameterBuilder.java b/CommonCore/Linkage/src/de/steamwar/linkage/plan/ParameterBuilder.java
deleted file mode 100644
index d88364be..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/plan/ParameterBuilder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.plan;
-
-import lombok.AllArgsConstructor;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-
-@AllArgsConstructor
-public class ParameterBuilder {
- private String type;
- private String name;
-
- public void write(BufferedWriter writer) throws IOException {
- writer.write(type + " " + name);
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/Disable_GENERIC.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/Disable_GENERIC.java
deleted file mode 100644
index ea58c91b..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/Disable_GENERIC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class Disable_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "unlink";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ".disable();");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/Enable_GENERIC.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/Enable_GENERIC.java
deleted file mode 100644
index 03afd570..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/Enable_GENERIC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class Enable_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ".enable();");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_BUNGEE.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_BUNGEE.java
deleted file mode 100644
index 327b19ad..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_BUNGEE.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class Listener_BUNGEE implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- buildPlan.addImport("net.md_5.bungee.api.ProxyServer");
- buildPlan.addImport("de.steamwar.bungeecore.BungeeCore");
- method.addLine("ProxyServer.getInstance().getPluginManager().registerListener(BungeeCore.get(), " + instance + ");");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_SPIGOT.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_SPIGOT.java
deleted file mode 100644
index 3491d6d2..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/Listener_SPIGOT.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.FieldBuilder;
-import de.steamwar.linkage.plan.MethodBuilder;
-import de.steamwar.linkage.plan.ParameterBuilder;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.DeclaredType;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Listener_SPIGOT implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- Map eventClasses = new HashMap<>();
- Map eventMethods = new HashMap<>();
-
- typeElement.getEnclosedElements().stream().filter(e -> e.getKind() == ElementKind.METHOD).map(ExecutableElement.class::cast).filter(e -> {
- return e.getAnnotationMirrors().stream().anyMatch(annotationMirror -> {
- return annotationMirror.getAnnotationType().asElement().getSimpleName().toString().equals("EventHandler");
- });
- }).forEach(e -> {
- TypeElement current = ((TypeElement)((DeclaredType) e.getParameters().get(0).asType()).asElement());
- eventClasses.put(current.getQualifiedName().toString(), current);
- eventMethods.put(current, e);
- });
-
- eventClasses.forEach((s, eventType) -> {
- if (buildPlan.hasMethod(eventType.getSimpleName().toString())) return;
- buildPlan.addImport("org.bukkit.event.HandlerList");
- buildPlan.addImport("org.bukkit.event.Listener");
- buildPlan.addImport("java.util.function.Consumer");
- buildPlan.addImport("org.bukkit.event.EventPriority");
- buildPlan.addImport("org.bukkit.plugin.RegisteredListener");
- buildPlan.addImport("org.bukkit.plugin.EventExecutor");
- buildPlan.addImport(s);
- buildPlan.addField(new FieldBuilder("HandlerList", "handlerList" + eventType.getSimpleName()));
- MethodBuilder methodBuilder = new MethodBuilder(eventType.getSimpleName().toString(), "void");
- methodBuilder.addParameter(new ParameterBuilder("Listener", "listener"));
- methodBuilder.addParameter(new ParameterBuilder("Consumer<" + eventType.getSimpleName() + ">", "consumer"));
- methodBuilder.addParameter(new ParameterBuilder("EventPriority", "eventPriority"));
- methodBuilder.addParameter(new ParameterBuilder("boolean", "ignoreCancelled"));
- methodBuilder.setPrivate(true);
- methodBuilder.addLine("EventExecutor eventExecutor = (l, event) -> {");
- methodBuilder.addLine(" if (event instanceof " + eventType.getSimpleName() + ") {");
- methodBuilder.addLine(" consumer.accept((" + eventType.getSimpleName() + ") event);");
- methodBuilder.addLine(" }");
- methodBuilder.addLine("};");
- methodBuilder.addLine("handlerList" + eventType.getSimpleName() + ".register(new RegisteredListener(listener, eventExecutor, eventPriority, " + getPluginMain() + ".getInstance(), ignoreCancelled));");
- buildPlan.addMethod(methodBuilder);
- method.addLine("handlerList" + eventType.getSimpleName() + " = " + eventType.getSimpleName() + ".getHandlerList();");
- });
-
- String localInstance = "local" + typeElement.getSimpleName().toString();
- if (!instance.startsWith("new ")) {
- localInstance = instance;
- } else {
- method.addLine(typeElement.getSimpleName() + " " + localInstance + " = " + instance + ";");
- }
- String finalLocalInstance = localInstance;
- eventMethods.forEach((type, executableElement) -> {
- AnnotationMirror eventHandler = executableElement.getAnnotationMirrors().stream().filter(annotationMirror -> annotationMirror.getAnnotationType().asElement().getSimpleName().toString().equals("EventHandler")).findFirst().orElse(null);
- if (eventHandler == null) {
- return;
- }
- String priority = "NORMAL";
- String ignoreCancelled = "false";
- for (Map.Entry extends ExecutableElement, ? extends AnnotationValue> entry : eventHandler.getElementValues().entrySet()) {
- if (entry.getKey().getSimpleName().toString().equals("priority")) {
- priority = entry.getValue().getValue().toString();
- } else if (entry.getKey().getSimpleName().toString().equals("ignoreCancelled")) {
- ignoreCancelled = entry.getValue().getValue().toString();
- }
- }
- method.addLine(type.getSimpleName().toString() + "(" + finalLocalInstance + ", " + finalLocalInstance + "::" + executableElement.getSimpleName().toString() + ", EventPriority." + priority + ", " + ignoreCancelled + ");");
- });
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/PacketHandler_GENERIC.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/PacketHandler_GENERIC.java
deleted file mode 100644
index 630f6f95..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/PacketHandler_GENERIC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class PacketHandler_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ".register();");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/Plain_GENERIC.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/Plain_GENERIC.java
deleted file mode 100644
index f066d035..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/Plain_GENERIC.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class Plain_GENERIC implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- if (instance.startsWith("new ")) method.addLine(instance + ";");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_BUNGEE.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_BUNGEE.java
deleted file mode 100644
index 5db62c4b..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_BUNGEE.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class SWCommand_BUNGEE implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ";");
- }
-}
diff --git a/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_SPIGOT.java b/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_SPIGOT.java
deleted file mode 100644
index 96e3f770..00000000
--- a/CommonCore/Linkage/src/de/steamwar/linkage/types/SWCommand_SPIGOT.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 SteamWar.de-Serverteam
- *
- * 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.steamwar.linkage.types;
-
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
-
-import javax.lang.model.element.TypeElement;
-
-public class SWCommand_SPIGOT implements LinkageType {
-
- @Override
- public String method() {
- return "link";
- }
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
- method.addLine(instance + ".setMessage(" + getPluginMain() + ".MESSAGE);");
- }
-}
diff --git a/CommonCore/Network/build.gradle.kts b/CommonCore/Network/build.gradle.kts
index f7845319..b633ca63 100644
--- a/CommonCore/Network/build.gradle.kts
+++ b/CommonCore/Network/build.gradle.kts
@@ -1,46 +1,27 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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 {
- id("java")
-}
-
-group = "de.steamwar"
-version = ""
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
- test {
- java {
- srcDirs("testsrc/")
- }
- resources {
- srcDirs("testsrc/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- testCompileOnly("org.projectlombok:lombok:1.18.32")
- testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
-
- testImplementation("junit:junit:4.13.2")
- testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation(libs.junit)
+ testImplementation(libs.hamcrest)
}
\ No newline at end of file
diff --git a/CommonCore/SQL/build.gradle.kts b/CommonCore/SQL/build.gradle.kts
index 7f627c74..567bd92f 100644
--- a/CommonCore/SQL/build.gradle.kts
+++ b/CommonCore/SQL/build.gradle.kts
@@ -1,34 +1,26 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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 {
- id("java")
-}
-
-group = "de.steamwar"
-version = ""
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- testCompileOnly("org.projectlombok:lombok:1.18.32")
- testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
+ compileOnly(libs.sqlite)
}
\ No newline at end of file
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.java b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.java
index 31661242..b505ab1f 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.java
+++ b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.java
@@ -21,7 +21,6 @@ package de.steamwar.sql;
import de.steamwar.sql.internal.*;
import lombok.Getter;
-import lombok.SneakyThrows;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
@@ -34,6 +33,7 @@ import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
public class SteamwarUser {
private static final SecureRandom random = new SecureRandom();
@@ -61,7 +61,7 @@ public class SteamwarUser {
private static final SelectStatement byName = table.selectFields("UserName");
private static final SelectStatement byDiscord = table.selectFields("DiscordId");
private static final SelectStatement byTeam = table.selectFields("Team");
- private static final SelectStatement getServerTeam = new SelectStatement<>(table, "SELECT * FROM UserData WHERE UserGroup != 'Member' AND UserGroup != 'YouTuber'");
+ private static final SelectStatement getUsersWithPerm = new SelectStatement<>(table, "SELECT S.* FROM UserData S JOIN UserPerm P ON S.id = P.User WHERE P.Perm = ?");
private static final Statement updateName = table.update(Table.PRIMARY, "UserName");
private static final Statement updatePassword = table.update(Table.PRIMARY, "Password");
@@ -138,10 +138,21 @@ public class SteamwarUser {
}
}
- public static List getServerTeam() {
- return getServerTeam.listSelect();
+ public static List getUsersWithPerm(UserPerm userPerm) {
+ return getUsersWithPerm.listSelect(userPerm);
}
+ public static List getServerTeam() {
+ return Stream.of(getUsersWithPerm(UserPerm.PREFIX_ADMIN),
+ getUsersWithPerm(UserPerm.PREFIX_DEVELOPER),
+ getUsersWithPerm(UserPerm.PREFIX_MODERATOR),
+ getUsersWithPerm(UserPerm.PREFIX_SUPPORTER),
+ getUsersWithPerm(UserPerm.PREFIX_BUILDER)
+ )
+ .flatMap(Collection::stream)
+ .collect(Collectors.toList());
+ }
+
public static List getTeam(int teamId) {
return byTeam.listSelect(teamId);
}
diff --git a/CommonCore/build.gradle.kts b/CommonCore/build.gradle.kts
index 170f4045..91b10d6f 100644
--- a/CommonCore/build.gradle.kts
+++ b/CommonCore/build.gradle.kts
@@ -18,34 +18,10 @@
*/
plugins {
- id("base")
- id("java-library")
-}
-
-group = "de.steamwar"
-version = ""
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-sourceSets {
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- testCompileOnly("org.projectlombok:lombok:1.18.32")
- testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly("org.xerial:sqlite-jdbc:3.46.0.0")
-
api(project(":CommonCore:SQL"))
- api(project(":CommonCore:Linkage"))
api(project(":CommonCore:Network"))
}
diff --git a/FightSystem/FightSystem_10/build.gradle.kts b/FightSystem/FightSystem_10/build.gradle.kts
index dfab54e2..882668ff 100644
--- a/FightSystem/FightSystem_10/build.gradle.kts
+++ b/FightSystem/FightSystem_10/build.gradle.kts
@@ -18,41 +18,12 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":FightSystem:FightSystem_Core"))
- compileOnly("de.steamwar:spigot:1.10")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms10)
}
diff --git a/FightSystem/FightSystem_12/build.gradle.kts b/FightSystem/FightSystem_12/build.gradle.kts
index e64720ce..c172455a 100644
--- a/FightSystem/FightSystem_12/build.gradle.kts
+++ b/FightSystem/FightSystem_12/build.gradle.kts
@@ -18,42 +18,14 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
+ compileOnly(project(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8"))
- compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.12")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms12)
+ compileOnly(libs.worldedit12)
}
diff --git a/FightSystem/FightSystem_14/build.gradle.kts b/FightSystem/FightSystem_14/build.gradle.kts
index 16e779aa..2c8e52d5 100644
--- a/FightSystem/FightSystem_14/build.gradle.kts
+++ b/FightSystem/FightSystem_14/build.gradle.kts
@@ -18,45 +18,17 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
+ compileOnly(project(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8"))
compileOnly(project(":FightSystem:FightSystem_9"))
- compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.14")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms14)
+ compileOnly(libs.worldedit15)
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
+ compileOnly(libs.fastutil)
}
diff --git a/FightSystem/FightSystem_15/build.gradle.kts b/FightSystem/FightSystem_15/build.gradle.kts
index b321f1b6..c1556233 100644
--- a/FightSystem/FightSystem_15/build.gradle.kts
+++ b/FightSystem/FightSystem_15/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":FightSystem:FightSystem_Core"))
- compileOnly("de.steamwar:spigot:1.15")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms15)
+ compileOnly(libs.worldedit15)
}
diff --git a/FightSystem/FightSystem_18/build.gradle.kts b/FightSystem/FightSystem_18/build.gradle.kts
index 604c7354..c6a938e0 100644
--- a/FightSystem/FightSystem_18/build.gradle.kts
+++ b/FightSystem/FightSystem_18/build.gradle.kts
@@ -18,47 +18,17 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":FightSystem:FightSystem_Core"))
- compileOnly("de.steamwar:fastasyncworldedit:1.18")
- compileOnly("de.steamwar:spigot:1.18")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
+ compileOnly(libs.nms18)
+ compileOnly(libs.fawe18)
+
+ compileOnly(libs.fastutil)
}
diff --git a/FightSystem/FightSystem_19/build.gradle.kts b/FightSystem/FightSystem_19/build.gradle.kts
index b3475ff2..0dc7a095 100644
--- a/FightSystem/FightSystem_19/build.gradle.kts
+++ b/FightSystem/FightSystem_19/build.gradle.kts
@@ -18,47 +18,14 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_18"))
- compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:worldedit:1.15")
- compileOnly("de.steamwar:spigot:1.19")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
- compileOnly("com.mojang:brigadier:1.0.18")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("com.mojang:authlib:1.5.25")
+ compileOnly(libs.nms19)
}
diff --git a/FightSystem/FightSystem_20/build.gradle.kts b/FightSystem/FightSystem_20/build.gradle.kts
index 51b0862f..99c4a656 100644
--- a/FightSystem/FightSystem_20/build.gradle.kts
+++ b/FightSystem/FightSystem_20/build.gradle.kts
@@ -18,43 +18,16 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_18"))
- compileOnly("de.steamwar:spigot:1.20")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
+ compileOnly(libs.nms20)
+
+ compileOnly(libs.fastutil)
}
diff --git a/FightSystem/FightSystem_8/build.gradle.kts b/FightSystem/FightSystem_8/build.gradle.kts
index c316418d..d98e4045 100644
--- a/FightSystem/FightSystem_8/build.gradle.kts
+++ b/FightSystem/FightSystem_8/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":FightSystem:FightSystem_Core"))
- compileOnly("de.steamwar:spigot:1.8")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms8)
+ compileOnly(libs.worldedit12)
}
diff --git a/FightSystem/FightSystem_9/build.gradle.kts b/FightSystem/FightSystem_9/build.gradle.kts
index 8e018b08..21c34e22 100644
--- a/FightSystem/FightSystem_9/build.gradle.kts
+++ b/FightSystem/FightSystem_9/build.gradle.kts
@@ -18,42 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
+ compileOnly(project(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8"))
- compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.9")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms9)
}
diff --git a/FightSystem/FightSystem_Core/build.gradle.kts b/FightSystem/FightSystem_Core/build.gradle.kts
index 188af1d3..8b1d5ece 100644
--- a/FightSystem/FightSystem_Core/build.gradle.kts
+++ b/FightSystem/FightSystem_Core/build.gradle.kts
@@ -18,44 +18,15 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
+ compileOnly(libs.worldedit15)
+ compileOnly(libs.fastutil)
+ compileOnly(libs.authlib)
}
diff --git a/FightSystem/FightSystem_Standalone/build.gradle.kts b/FightSystem/FightSystem_Standalone/build.gradle.kts
index 1ac6fcd6..97e19a53 100644
--- a/FightSystem/FightSystem_Standalone/build.gradle.kts
+++ b/FightSystem/FightSystem_Standalone/build.gradle.kts
@@ -18,39 +18,16 @@
*/
plugins {
- id("java")
- id("base")
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ `java-library`
+ alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs()
- }
- resources {
- srcDirs()
- }
- }
-}
-
dependencies {
+ implementation(project(":SpigotCore"))
implementation(project(":FightSystem:FightSystem_Core"))
implementation(project(":FightSystem:FightSystem_8"))
implementation(project(":FightSystem:FightSystem_9"))
@@ -61,5 +38,4 @@ dependencies {
implementation(project(":FightSystem:FightSystem_18"))
implementation(project(":FightSystem:FightSystem_19"))
implementation(project(":FightSystem:FightSystem_20"))
- implementation(project(":SpigotCore"))
}
diff --git a/FightSystem/build.gradle.kts b/FightSystem/build.gradle.kts
index 016e0832..3f367461 100644
--- a/FightSystem/build.gradle.kts
+++ b/FightSystem/build.gradle.kts
@@ -18,32 +18,15 @@
*/
plugins {
- id("base")
- id("java")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ `java-library`
+ alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
implementation(project(":FightSystem:FightSystem_Core"))
implementation(project(":FightSystem:FightSystem_8"))
implementation(project(":FightSystem:FightSystem_9"))
diff --git a/KotlinCore/build.gradle.kts b/KotlinCore/build.gradle.kts
index 6c16669c..5d00f0f6 100644
--- a/KotlinCore/build.gradle.kts
+++ b/KotlinCore/build.gradle.kts
@@ -18,17 +18,8 @@
*/
plugins {
- id("java")
- kotlin("jvm") version "2.0.0"
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.kotlin
+ alias(libs.plugins.shadow)
}
tasks.build {
@@ -39,29 +30,6 @@ tasks.shadowJar {
exclude("org/**")
}
-java {
- sourceCompatibility = JavaVersion.VERSION_21
- targetCompatibility = JavaVersion.VERSION_21
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- implementation(kotlin("reflect"))
-
- compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
+ compileOnly(libs.paperapi21)
}
-
-kotlin {
- jvmToolchain(21)
-}
\ No newline at end of file
diff --git a/KotlinCore/src/de/steamwar/core/KotlinCore.kt b/KotlinCore/src/de/steamwar/kotlin/KotlinCore.kt
similarity index 93%
rename from KotlinCore/src/de/steamwar/core/KotlinCore.kt
rename to KotlinCore/src/de/steamwar/kotlin/KotlinCore.kt
index dd5a2946..e821ade4 100644
--- a/KotlinCore/src/de/steamwar/core/KotlinCore.kt
+++ b/KotlinCore/src/de/steamwar/kotlin/KotlinCore.kt
@@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
- * Copyright (C) 2024 SteamWar.de-Serverteam
+ * Copyright (C) 2024 SteamWar.de-Serverteam
*
* 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
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package de.steamwar.core
+package de.steamwar.kotlin
import org.bukkit.plugin.java.JavaPlugin
diff --git a/KotlinCore/src/plugin.yml b/KotlinCore/src/plugin.yml
index 8b050f06..7117121e 100644
--- a/KotlinCore/src/plugin.yml
+++ b/KotlinCore/src/plugin.yml
@@ -1,5 +1,5 @@
name: KotlinCore
version: '2.0.0'
-main: de.steamwar.core.KotlinCore
+main: de.steamwar.kotlin.KotlinCore
load: POSTWORLD
api-version: '1.21'
diff --git a/LobbySystem/build.gradle.kts b/LobbySystem/build.gradle.kts
index 02a73986..3ad7a776 100644
--- a/LobbySystem/build.gradle.kts
+++ b/LobbySystem/build.gradle.kts
@@ -18,21 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
+ steamwar.java
}
java {
@@ -40,26 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.20")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
+ compileOnly(libs.nms20)
+ compileOnly(libs.worldedit15)
}
diff --git a/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties b/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties
index e2797995..4530aaaf 100644
--- a/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties
+++ b/LobbySystem/src/de/steamwar/lobby/LobbySystem.properties
@@ -4,7 +4,7 @@ DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's
-NPC_CHAT_1 = §fHello, I''m {0} and I''m a(n) {1}.
+NPC_CHAT_1 = §fHello, I''m {0} and I''m a(n) {1}§f.
NPC_CHAT_2 = §fWelcome on §eSteam§8War§f, have fun.
# Portal Command
diff --git a/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties b/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties
index d6049037..969270ee 100644
--- a/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties
+++ b/LobbySystem/src/de/steamwar/lobby/LobbySystem_de.properties
@@ -4,7 +4,7 @@ DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's
-NPC_CHAT_1 = §fHallo, ich bin {0} und bin ein {1}.
+NPC_CHAT_1 = §fHallo, ich bin {0} und bin ein {1}§f.
NPC_CHAT_2 = §fWillkommen auf §eSteam§8War§f, viel Spaß dir.
# Portal Command
diff --git a/MissileWars/build.gradle.kts b/MissileWars/build.gradle.kts
index 38432228..755e1c46 100644
--- a/MissileWars/build.gradle.kts
+++ b/MissileWars/build.gradle.kts
@@ -18,21 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
+ steamwar.java
}
java {
@@ -40,26 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.20")
- compileOnly("de.steamwar:fastasyncworldedit:1.18")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
+ compileOnly(libs.nms20)
+ compileOnly(libs.fawe18)
}
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..ad9f4739
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# SteamWar
diff --git a/Realtime/build.gradle.kts b/Realtime/build.gradle.kts
index 0fdc717b..ebde1d0a 100644
--- a/Realtime/build.gradle.kts
+++ b/Realtime/build.gradle.kts
@@ -18,43 +18,9 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
+ compileOnly(libs.spigotapi)
}
diff --git a/SchematicSystem/SchematicSystem_15/build.gradle.kts b/SchematicSystem/SchematicSystem_15/build.gradle.kts
index 261c40bd..bfb78f90 100644
--- a/SchematicSystem/SchematicSystem_15/build.gradle.kts
+++ b/SchematicSystem/SchematicSystem_15/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
- compileOnly("de.steamwar:spigot:1.15")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms15)
+ compileOnly(libs.worldedit15)
}
diff --git a/SchematicSystem/SchematicSystem_8/build.gradle.kts b/SchematicSystem/SchematicSystem_8/build.gradle.kts
index 14652dc6..f0e3ade3 100644
--- a/SchematicSystem/SchematicSystem_8/build.gradle.kts
+++ b/SchematicSystem/SchematicSystem_8/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
compileOnly(project(":SpigotCore"))
+ compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
- compileOnly("de.steamwar:spigot:1.8")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms8)
+ compileOnly(libs.worldedit12)
}
diff --git a/SchematicSystem/SchematicSystem_Core/build.gradle.kts b/SchematicSystem/SchematicSystem_Core/build.gradle.kts
index f833cb0f..3c08c5d2 100644
--- a/SchematicSystem/SchematicSystem_Core/build.gradle.kts
+++ b/SchematicSystem/SchematicSystem_Core/build.gradle.kts
@@ -18,40 +18,12 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.15")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.worldedit15)
}
diff --git a/SchematicSystem/build.gradle.kts b/SchematicSystem/build.gradle.kts
index 0c2b5ae6..2c9ef365 100644
--- a/SchematicSystem/build.gradle.kts
+++ b/SchematicSystem/build.gradle.kts
@@ -18,32 +18,15 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ `java-library`
+ alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
implementation(project(":SchematicSystem:SchematicSystem_Core"))
implementation(project(":SchematicSystem:SchematicSystem_8"))
implementation(project(":SchematicSystem:SchematicSystem_15"))
diff --git a/SpigotCore/CRIUDummy/build.gradle.kts b/SpigotCore/CRIUDummy/build.gradle.kts
index 93545c5a..d8a1521e 100644
--- a/SpigotCore/CRIUDummy/build.gradle.kts
+++ b/SpigotCore/CRIUDummy/build.gradle.kts
@@ -18,28 +18,5 @@
*/
plugins {
- id("java")
-}
-
-group = "de.steamwar"
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
\ No newline at end of file
diff --git a/SpigotCore/SpigotCore_10/build.gradle.kts b/SpigotCore/SpigotCore_10/build.gradle.kts
index 145b04d3..38bce259 100644
--- a/SpigotCore/SpigotCore_10/build.gradle.kts
+++ b/SpigotCore/SpigotCore_10/build.gradle.kts
@@ -18,39 +18,11 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore:SpigotCore_Main"))
- compileOnly("de.steamwar:spigot:1.10")
+ compileOnly(libs.nms10)
}
diff --git a/SpigotCore/SpigotCore_12/build.gradle.kts b/SpigotCore/SpigotCore_12/build.gradle.kts
index 976aa202..a4c6acd3 100644
--- a/SpigotCore/SpigotCore_12/build.gradle.kts
+++ b/SpigotCore/SpigotCore_12/build.gradle.kts
@@ -18,40 +18,12 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":CommonCore"))
+ compileOnly(project(":SpigotCore:SpigotCore_Main"))
- compileOnly("de.steamwar:spigot:1.12")
+ compileOnly(libs.nms12)
}
diff --git a/SpigotCore/SpigotCore_14/build.gradle.kts b/SpigotCore/SpigotCore_14/build.gradle.kts
index 49b7ef24..8586caeb 100644
--- a/SpigotCore/SpigotCore_14/build.gradle.kts
+++ b/SpigotCore/SpigotCore_14/build.gradle.kts
@@ -18,43 +18,15 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
+ compileOnly(project(":CommonCore"))
compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_8"))
compileOnly(project(":SpigotCore:SpigotCore_9"))
- compileOnly(project(":CommonCore"))
- compileOnly("de.steamwar:spigot:1.14")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms14)
+ compileOnly(libs.worldedit15)
}
diff --git a/SpigotCore/SpigotCore_15/build.gradle.kts b/SpigotCore/SpigotCore_15/build.gradle.kts
index 9ff92f83..b637545e 100644
--- a/SpigotCore/SpigotCore_15/build.gradle.kts
+++ b/SpigotCore/SpigotCore_15/build.gradle.kts
@@ -18,39 +18,11 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore:SpigotCore_Main"))
- compileOnly("de.steamwar:spigot:1.15")
+ compileOnly(libs.nms15)
}
diff --git a/SpigotCore/SpigotCore_18/build.gradle.kts b/SpigotCore/SpigotCore_18/build.gradle.kts
index 211b29f4..b27c3aed 100644
--- a/SpigotCore/SpigotCore_18/build.gradle.kts
+++ b/SpigotCore/SpigotCore_18/build.gradle.kts
@@ -18,48 +18,23 @@
*/
plugins {
- id("java")
- id("base")
+ steamwar.java
}
-group = "de.steamwar"
-version = ""
-
tasks.compileJava {
- options.encoding = "UTF-8"
options.isWarnings = false
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
+ compileOnly(project(":CommonCore"))
compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_14"))
- compileOnly(project(":CommonCore"))
- compileOnly("de.steamwar:fastasyncworldedit:1.18")
- compileOnly("de.steamwar:spigot:1.18")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.nms18)
+ compileOnly(libs.fawe18)
- compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
+ compileOnly(libs.datafixer)
+ compileOnly(libs.netty)
+ compileOnly(libs.authlib)
}
diff --git a/SpigotCore/SpigotCore_19/build.gradle.kts b/SpigotCore/SpigotCore_19/build.gradle.kts
index 2363a872..da876e7e 100644
--- a/SpigotCore/SpigotCore_19/build.gradle.kts
+++ b/SpigotCore/SpigotCore_19/build.gradle.kts
@@ -18,47 +18,19 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_14"))
compileOnly(project(":SpigotCore:SpigotCore_18"))
- compileOnly("de.steamwar:worldedit:1.15")
- compileOnly("de.steamwar:spigot:1.19")
+ compileOnly(libs.worldedit15)
+ compileOnly(libs.nms19)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
- compileOnly("com.mojang:brigadier:1.0.18")
- compileOnly("com.mojang:datafixerupper:4.0.26")
- compileOnly("com.mojang:authlib:1.5.25")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.brigadier)
+ compileOnly(libs.datafixer)
+ compileOnly(libs.authlib)
}
diff --git a/SpigotCore/SpigotCore_20/build.gradle.kts b/SpigotCore/SpigotCore_20/build.gradle.kts
index 671ab444..a2a54c32 100644
--- a/SpigotCore/SpigotCore_20/build.gradle.kts
+++ b/SpigotCore/SpigotCore_20/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore:SpigotCore_Main"))
- compileOnly("de.steamwar:spigot:1.20")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
+ compileOnly(libs.nms20)
}
diff --git a/SpigotCore/SpigotCore_8/build.gradle.kts b/SpigotCore/SpigotCore_8/build.gradle.kts
index aeb7077e..0ec4a191 100644
--- a/SpigotCore/SpigotCore_8/build.gradle.kts
+++ b/SpigotCore/SpigotCore_8/build.gradle.kts
@@ -18,41 +18,13 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":CommonCore"))
+ compileOnly(project(":SpigotCore:SpigotCore_Main"))
- compileOnly("de.steamwar:spigot:1.8")
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.nms8)
+ compileOnly(libs.worldedit12)
}
diff --git a/SpigotCore/SpigotCore_9/build.gradle.kts b/SpigotCore/SpigotCore_9/build.gradle.kts
index 55c33eb8..31209477 100644
--- a/SpigotCore/SpigotCore_9/build.gradle.kts
+++ b/SpigotCore/SpigotCore_9/build.gradle.kts
@@ -18,42 +18,14 @@
*/
plugins {
- id("java")
- id("base")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_8"))
- compileOnly("de.steamwar:spigot:1.9")
+ compileOnly(libs.nms9)
- compileOnly("com.viaversion:viaversion-api:4.3.1")
+ compileOnly(libs.viaapi)
}
diff --git a/SpigotCore/SpigotCore_Main/build.gradle.kts b/SpigotCore/SpigotCore_Main/build.gradle.kts
index 60e38095..c70479e5 100644
--- a/SpigotCore/SpigotCore_Main/build.gradle.kts
+++ b/SpigotCore/SpigotCore_Main/build.gradle.kts
@@ -18,55 +18,25 @@
*/
plugins {
- id("java")
- id("base")
+ steamwar.java
}
-group = "de.steamwar"
-version = ""
-
tasks.compileJava {
- options.encoding = "UTF-8"
options.isWarnings = false
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":CommonCore"))
compileOnly(project(":CommandFramework"))
+ compileOnly(project(":SpigotCore:CRIUDummy"))
- compileOnly("de.steamwar:worldedit:1.12")
+ compileOnly(libs.worldedit12)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
- compileOnly("io.netty:netty-all:4.1.68.Final")
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("mysql:mysql-connector-java:5.1.49")
- compileOnly("com.viaversion:viaversion-api:4.3.1")
- compileOnly("it.unimi.dsi:fastutil:8.5.6")
- implementation("net.wesjd:anvilgui:1.7.0-SNAPSHOT")
+ compileOnly(libs.spigotapi)
+ compileOnly(libs.netty)
+ compileOnly(libs.authlib)
+ compileOnly(libs.viaapi)
+ compileOnly(libs.fastutil)
- try {
- Class.forName("org.eclipse.openj9.criu.CRIUSupport")
- } catch (e: ClassNotFoundException) {
- compileOnly(project(":SpigotCore:CRIUDummy"))
- }
+ implementation(libs.anvilgui)
}
diff --git a/SpigotCore/build.gradle.kts b/SpigotCore/build.gradle.kts
index 61618228..3838522b 100644
--- a/SpigotCore/build.gradle.kts
+++ b/SpigotCore/build.gradle.kts
@@ -18,46 +18,26 @@
*/
plugins {
- id("base")
- id("java-library")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ `java-library`
+ alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- api(project(":SpigotCore:SpigotCore_Main"))
- api(project(":SpigotCore:SpigotCore_8"))
- api(project(":SpigotCore:SpigotCore_9"))
- api(project(":SpigotCore:SpigotCore_10"))
- api(project(":SpigotCore:SpigotCore_12"))
- api(project(":SpigotCore:SpigotCore_14"))
- api(project(":SpigotCore:SpigotCore_15"))
- api(project(":SpigotCore:SpigotCore_18"))
- api(project(":SpigotCore:SpigotCore_19"))
- api(project(":SpigotCore:SpigotCore_20"))
-
api(project(":CommonCore"))
api(project(":CommandFramework"))
+ api(project(":SpigotCore:SpigotCore_Main"))
+
+ implementation(project(":SpigotCore:SpigotCore_8"))
+ implementation(project(":SpigotCore:SpigotCore_9"))
+ implementation(project(":SpigotCore:SpigotCore_10"))
+ implementation(project(":SpigotCore:SpigotCore_12"))
+ implementation(project(":SpigotCore:SpigotCore_14"))
+ implementation(project(":SpigotCore:SpigotCore_15"))
+ implementation(project(":SpigotCore:SpigotCore_18"))
+ implementation(project(":SpigotCore:SpigotCore_19"))
+ implementation(project(":SpigotCore:SpigotCore_20"))
}
diff --git a/TNTLeague/build.gradle.kts b/TNTLeague/build.gradle.kts
new file mode 100644
index 00000000..b9689d85
--- /dev/null
+++ b/TNTLeague/build.gradle.kts
@@ -0,0 +1,9 @@
+plugins {
+ steamwar.kotlin
+}
+
+dependencies {
+ compileOnly(libs.paperapi21)
+ compileOnly(project(":SpigotCore"))
+ compileOnly(project(":KotlinCore"))
+}
\ No newline at end of file
diff --git a/TNTLeague/src/config.yml b/TNTLeague/src/config.yml
new file mode 100644
index 00000000..d2e0a1e6
--- /dev/null
+++ b/TNTLeague/src/config.yml
@@ -0,0 +1,100 @@
+startDelay: 10
+gameTime: 1200
+
+prices:
+ TNT:
+ price: 4
+ amount: 4
+ REDSTONE:
+ price: 4
+ amount: 4
+ REPEATER:
+ price: 4
+ amount: 2
+ COMPARATOR:
+ price: 4
+ amount: 1
+ REDSTONE_BLOCK:
+ price: 4
+ amount: 1
+ REDSTONE_TORCH:
+ price: 4
+ amount: 2
+ END_STONE:
+ price: 4
+ amount: 8
+ ICE:
+ price: 8
+ amount: 1
+ LEVER:
+ price: 4
+ amount: 1
+ OAK_BUTTON:
+ price: 4
+ amount: 1
+ STONE_BUTTON:
+ price: 4
+ amount: 1
+ OAK_TRAPDOOR:
+ price: 4
+ amount: 2
+ IRON_TRAPDOOR:
+ price: 4
+ amount: 1
+ PISTON:
+ price: 4
+ amount: 2
+ STICKY_PISTON:
+ price: 4
+ amount: 1
+ GLASS:
+ price: 4
+ amount: 2
+ OAK_FENCE:
+ price: 4
+ amount: 4
+ LADDER:
+ price: 6
+ amount: 2
+ WHITE_GLAZED_TERRACOTTA:
+ price: 4
+ amount: 3
+ JUKEBOX:
+ price: 4
+ amount: 2
+ OBSERVER:
+ price: 10
+ amount: 4
+ BREWING_STAND:
+ price: 4
+ amount: 1
+ STRING:
+ price: 4
+ amount: 2
+ END_STONE_BRICK_SLAB:
+ price: 4
+ amount: 2
+ TARGET:
+ price: 4
+ amount: 1
+ COPPER_BULB:
+ price: 4
+ amount: 1
+ SLIME_BLOCK:
+ price: 6
+ amount: 2
+ HONEY_BLOCK:
+ price: 6
+ amount: 2
+ STONE_PRESSURE_PLATE:
+ price: 4
+ amount: 1
+ NOTE_BLOCK:
+ price: 3
+ amount: 1
+ HOPPER:
+ price: 3
+ amount: 1
+ GRAVEL:
+ price: 4
+ amount: 3
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt
new file mode 100644
index 00000000..5479e4d7
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt
@@ -0,0 +1,48 @@
+package de.steamwar.tntleague
+
+import de.steamwar.tntleague.command.AcceptCommand
+import de.steamwar.tntleague.command.InviteCommand
+import de.steamwar.tntleague.command.LeaveCommand
+import de.steamwar.tntleague.command.RemoveCommand
+import de.steamwar.tntleague.events.GlobalListener
+import de.steamwar.tntleague.events.LobbyListener
+import net.kyori.adventure.key.Key
+import net.kyori.adventure.translation.GlobalTranslator
+import net.kyori.adventure.translation.TranslationRegistry
+import net.kyori.adventure.util.UTF8ResourceBundleControl
+import org.bukkit.plugin.java.JavaPlugin
+import java.util.*
+
+lateinit var plugin: TNTLeague
+
+class TNTLeague : JavaPlugin() {
+ init {
+ plugin = this
+ }
+
+ override fun onEnable() {
+ saveResource("config.yml", false)
+ saveDefaultConfig()
+
+ val registry = TranslationRegistry.create(Key.key("steamwar:tntleague"))
+
+ val bundleDe = ResourceBundle.getBundle("de.steamwar.tntleague.TNTLeague", Locale.GERMAN, UTF8ResourceBundleControl())
+ val bundleEn = ResourceBundle.getBundle("de.steamwar.tntleague.TNTLeague", Locale.US, UTF8ResourceBundleControl())
+ registry.defaultLocale(Locale.US)
+
+ registry.registerAll(Locale.GERMAN, bundleDe, true)
+ registry.registerAll(Locale.US, bundleEn, true)
+
+ GlobalTranslator.translator().addSource(registry)
+
+ server.pluginManager.registerEvents(LobbyListener, this)
+ server.pluginManager.registerEvents(GlobalListener, this)
+
+ logger.info("TNTLeague enabled")
+
+ InviteCommand.register()
+ AcceptCommand.register()
+ RemoveCommand.register()
+ LeaveCommand.register()
+ }
+}
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de_DE.properties b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de_DE.properties
new file mode 100644
index 00000000..7200a9e2
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de_DE.properties
@@ -0,0 +1,18 @@
+join={0} ist dem Spiel beigetreten!
+joinTeam={0} ist dem {1} team begetreten!
+quit={0} hat das Spiel verlassen!
+blue=Blau
+red=Rot
+shutdown=Der Server fährt in {0} sekunden herunter!
+teamWin=Team {0} gewinnt!
+notEnoughCoins=Du hast nicht genug Coins um dir das zu kaufen!
+gameStarting=Das Spiel beginnt in {0} Sekunden!
+gameStart=Start in {0}
+gameStarted=Das Spiel beginnt!
+gameEnded=Das Spiel ist aus!
+dealer=Händler
+dealerItem=
+dealerPrice=Kosten: {0} Coins
+scoreboardTarget=Ziel: {0}
+scoreboardTime=Zeit: {0}:{1}
+scoreboardTeam=
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague_en_US.properties b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_en_US.properties
new file mode 100644
index 00000000..2f7c11e2
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_en_US.properties
@@ -0,0 +1,37 @@
+join={0} joined the game!
+joinTeam={0} joined the {1} team!
+quit={0} left the game!
+quitTeam={0} left the {1} team!
+blue=Blue
+red=Red
+shutdown=The server stops in {0} seconds!
+teamWin=Team {0} wins!
+
+notEnoughCoins=You don't have enough coins to buy this item!
+
+gameStarting=The game starts in {0} seconds!
+gameStart=Starting in {0}
+gameStarted=The game has started!
+
+timeRemaining={0} minutes remaining!
+
+gameEnded=The game has ended!
+draw=The game ended in a draw!
+chat={0}» {1}
+
+dealer=Shopkeeper
+dealerItem={0} {1}
+dealerPrice=Price: {0} Coins
+
+scoreboardTarget=Target: {0}
+scoreboardTime=Time: {0}:{1}
+scoreboardTeam=Team {0}: {1}
+
+ready=Ready
+notReady=Not ready
+isReady=Team {0} is ready!
+isNotReady=Team {0} is not ready!
+
+invited={0} invited you to join the {1} team! *Click*
+invitedHover=Click to join the {0} team!
+invitedPlayer=Invited {0} to join your team!
\ No newline at end of file
diff --git a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java b/TNTLeague/src/de/steamwar/tntleague/command/AcceptCommand.kt
similarity index 53%
rename from BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java
rename to TNTLeague/src/de/steamwar/tntleague/command/AcceptCommand.kt
index 570f6a33..3606bdbd 100644
--- a/BauSystem/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java
+++ b/TNTLeague/src/de/steamwar/tntleague/command/AcceptCommand.kt
@@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
- * Copyright (C) 2023 SteamWar.de-Serverteam
+ * Copyright (C) 2024 SteamWar.de-Serverteam
*
* 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
@@ -17,24 +17,24 @@
* along with this program. If not, see .
*/
-package de.steamwar.linkage.types;
+package de.steamwar.tntleague.command
-import de.steamwar.linkage.LinkageType;
-import de.steamwar.linkage.plan.BuildPlan;
-import de.steamwar.linkage.plan.MethodBuilder;
+import de.steamwar.command.SWCommand
+import de.steamwar.tntleague.game.TNTLeagueGame
+import org.bukkit.entity.Player
-import javax.lang.model.element.TypeElement;
+object AcceptCommand: SWCommand("accept") {
-public class LuaLib_GENERIC implements LinkageType {
+ @Register
+ fun acceptInvite(sender: Player, @Validator("isLeader") target: Player) {
+ if (TNTLeagueGame.state != TNTLeagueGame.GameState.LOBBY) return
- @Override
- public String method() {
- return "link";
+ val team = TNTLeagueGame.getTeam(target) ?: return
+ if (team.leader != target) return
+ if (sender !in team.invites) return
+
+ team.invites.remove(target)
+ team.opposite.invites.remove(target)
+ team.join(sender)
}
-
- @Override
- public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
- buildPlan.addImport("de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin");
- methodBuilder.addLine("SteamWarLuaPlugin.add(" + s + ");");
- }
-}
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/command/InviteCommand.kt b/TNTLeague/src/de/steamwar/tntleague/command/InviteCommand.kt
new file mode 100644
index 00000000..fdfaf359
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/command/InviteCommand.kt
@@ -0,0 +1,56 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.tntleague.command
+
+import de.steamwar.command.SWCommand
+import de.steamwar.command.TypeValidator
+import de.steamwar.tntleague.game.TNTLeagueGame
+import de.steamwar.tntleague.util.*
+import net.kyori.adventure.text.event.ClickEvent
+import net.kyori.adventure.text.event.HoverEvent
+import org.bukkit.entity.Player
+
+object InviteCommand: SWCommand("invite") {
+
+ @Register
+ fun invitePlayer(@Validator("isLeader") sender: Player, target: Player) {
+ if (TNTLeagueGame.state != TNTLeagueGame.GameState.LOBBY) return
+ if (TNTLeagueGame.getTeam(target) != null) return
+
+ val team = TNTLeagueGame.getTeam(sender)!!
+ team.invites.add(target)
+
+ target.sendMessage(translate("invited", sender.name.yellow(), translate(team.name).colorByTeam(team)).basic().clickEvent(
+ ClickEvent.callback {
+ if (target !in team.invites) return@callback
+
+ team.invites.remove(target)
+ team.opposite.invites.remove(target)
+ team.join(target)
+ })
+ .hoverEvent(HoverEvent.showText(translate("invitedHover", translate(team.name).colorByTeam(team)).green())))
+ sender.sendMessage(translate("invitedPlayer", target.name.yellow()).basic())
+ }
+
+ @Validator("isLeader", local = false)
+ fun isLeader(): TypeValidator {
+ return TypeValidator { _, player, _ -> TNTLeagueGame.getTeam(player)?.leader == player}
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt b/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt
new file mode 100644
index 00000000..aeb96492
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt
@@ -0,0 +1,30 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.tntleague.command
+
+import de.steamwar.command.SWCommand
+import de.steamwar.tntleague.game.TNTLeagueGame
+import org.bukkit.entity.Player
+
+object LeaveCommand: SWCommand("leave", "l") {
+
+ @Register
+ fun leave(player: Player) = TNTLeagueGame.getTeam(player)?.remove(player)
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/command/RemoveCommand.kt b/TNTLeague/src/de/steamwar/tntleague/command/RemoveCommand.kt
new file mode 100644
index 00000000..d889f31a
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/command/RemoveCommand.kt
@@ -0,0 +1,39 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.tntleague.command
+
+import de.steamwar.command.SWCommand
+import de.steamwar.tntleague.game.TNTLeagueGame
+import org.bukkit.entity.Player
+
+object RemoveCommand: SWCommand("remove") {
+
+ @Register
+ fun removePlayer(@Validator("isLeader") sender: Player, target: Player) {
+ if (TNTLeagueGame.state != TNTLeagueGame.GameState.LOBBY) return
+
+ if (sender == target) return
+ val team = TNTLeagueGame.getTeam(sender) ?: return
+ if (team.leader != sender) return
+ if (target !in team.members) return
+
+ team.remove(target)
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt
new file mode 100644
index 00000000..30fb8353
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt
@@ -0,0 +1,35 @@
+package de.steamwar.tntleague.config
+
+import de.steamwar.tntleague.plugin
+import org.bukkit.Material
+import org.bukkit.configuration.ConfigurationSection
+import org.bukkit.configuration.file.FileConfiguration
+
+data class TNTLeagueConfig(
+ val startDelay: Int = 10,
+ val gameTime: Int = 60 * 20,
+
+ val prices: Map
+) {
+ companion object {
+ val config: TNTLeagueConfig by lazy { loadConfig(plugin.config) }
+
+ private fun loadConfig(config: FileConfiguration): TNTLeagueConfig {
+ return TNTLeagueConfig(config.getInt("startDelay"), config.getInt("gameTime"), loadPrices(config.getConfigurationSection("prices")!!))
+ }
+
+ private fun loadPrices(config: ConfigurationSection): Map {
+ return config.getKeys(false).associateWith {
+ Price(
+ config.getInt("$it.amount"),
+ config.getInt("$it.price")
+ )
+ }.mapKeys { Material.getMaterial(it.key)!! }
+ }
+ }
+
+ data class Price(
+ val amount: Int,
+ val price: Int,
+ )
+}
diff --git a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt
new file mode 100644
index 00000000..faaf73aa
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt
@@ -0,0 +1,75 @@
+package de.steamwar.tntleague.config
+
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.Area
+import de.steamwar.tntleague.util.translate
+import org.bukkit.Location
+import org.bukkit.Material
+import org.bukkit.configuration.ConfigurationSection
+import org.bukkit.configuration.file.YamlConfiguration
+import org.bukkit.entity.Villager
+import org.bukkit.entity.WanderingTrader
+import java.io.File
+
+val world by lazy { plugin.server.worlds.first()!! }
+
+private val targetedBlocksRed by lazy { TNTLeagueWorldConfig.redTeam.target.blocks.count { block -> block.type == TNTLeagueWorldConfig.targetMaterial } }
+
+private val targetedBlocksBlue by lazy { TNTLeagueWorldConfig.blueTeam.target.blocks.count { block -> block.type == TNTLeagueWorldConfig.targetMaterial } }
+
+private val targetedBlocksAll: Int
+ get() = if (targetedBlocksBlue == targetedBlocksRed) targetedBlocksBlue else error("Targeted blocks are not equal")
+
+val targetedBlocks: Int
+ get() = if (TNTLeagueWorldConfig.target != -1) TNTLeagueWorldConfig.target else targetedBlocksAll
+
+object TNTLeagueWorldConfig {
+ private val config: YamlConfiguration by lazy {
+ YamlConfiguration.loadConfiguration(
+ File(
+ plugin.server.worlds.first().worldFolder,
+ "tntleague.yml"
+ )
+ )
+ }
+
+ val blueTeam: TeamConfig = TeamConfig.fromConfig(config.getConfigurationSection("blueTeam")!!)
+ val redTeam: TeamConfig = TeamConfig.fromConfig(config.getConfigurationSection("redTeam")!!)
+ val lobby: Location = config.getLocation("lobby", blueTeam.spawnLocation.clone().add(redTeam.spawnLocation).multiply(0.5))!!
+ val targetMaterial: Material = Material.matchMaterial(config.getString("targetMaterial", "IRON_BLOCK")!!)!!
+ val minHeight: Int = config.getInt("minHeight", 0)
+ val target: Int = config.getInt("target", -1)
+
+ @JvmRecord
+ data class TeamConfig(
+ val spawnLocation: Location,
+ val dealerSpawn: Location,
+ val itemSpawn: Location,
+ val target: Area
+ ) {
+ companion object {
+ fun fromConfig(config: ConfigurationSection): TeamConfig {
+ val spawnLocation = config.getLocation("spawn")!!
+ val dealerSpawn = config.getLocation("dealerSpawn")!!
+ val itemSpawn = config.getLocation("itemSpawn")!!
+ val targetPos1 = config.getLocation("targetMin")!!
+ val targetPos2 = config.getLocation("targetMax")!!
+
+ spawnDealer(dealerSpawn)
+
+ return TeamConfig(spawnLocation, dealerSpawn, itemSpawn, Area(targetPos1, targetPos2))
+ }
+
+ private fun spawnDealer(loc: Location) = world.spawn(loc, WanderingTrader::class.java)
+ .apply {
+ customName(translate("dealer"))
+ isCustomNameVisible = false
+ isInvulnerable = true
+ isSilent = true
+ isCollidable = false
+ isAware = false
+ setAI(false)
+ }
+ }
+ }
+}
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt
new file mode 100644
index 00000000..f9f616de
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt
@@ -0,0 +1,25 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.tntleague.events
+
+import org.bukkit.event.Listener
+
+object DummyListener: Listener {
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt
new file mode 100644
index 00000000..f2930adb
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt
@@ -0,0 +1,88 @@
+package de.steamwar.tntleague.events
+
+import de.steamwar.tntleague.config.TNTLeagueWorldConfig
+import de.steamwar.tntleague.game.TNTLeagueGame
+import de.steamwar.tntleague.game.TNTLeagueTeam
+import de.steamwar.tntleague.inventory.SWInventoryHolder
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.*
+import io.papermc.paper.event.player.AsyncChatEvent
+import org.bukkit.GameMode
+import org.bukkit.Material
+import org.bukkit.event.EventHandler
+import org.bukkit.event.EventPriority
+import org.bukkit.event.Listener
+import org.bukkit.event.entity.PlayerDeathEvent
+import org.bukkit.event.inventory.InventoryClickEvent
+import org.bukkit.event.player.PlayerJoinEvent
+import org.bukkit.event.player.PlayerMoveEvent
+import org.bukkit.event.player.PlayerQuitEvent
+import org.bukkit.event.player.PlayerRespawnEvent
+
+object GlobalListener: Listener {
+
+ @EventHandler(priority = EventPriority.LOW)
+ fun onPlayerJoin(e: PlayerJoinEvent) {
+ e.joinMessage(null)
+ with(e.player) {
+ teleport(TNTLeagueWorldConfig.lobby)
+ inventory.clear()
+ plugin.server.broadcast(translate("join", name.bold()).basic())
+ isOp = false
+ gameMode = GameMode.SPECTATOR
+ respawnLocation = TNTLeagueWorldConfig.lobby
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ fun onPlayerQuit(e: PlayerQuitEvent) {
+ e.quitMessage(null)
+ plugin.server.broadcast(translate("quit", e.player.name.bold().colorByTeam(TNTLeagueGame.getTeam(e.player))).basic())
+ TNTLeagueGame.playerLeave(e.player)
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ fun onPlayerClick(e: InventoryClickEvent) {
+ val holder = e.inventory.getHolder(false)
+ if (holder is SWInventoryHolder && e.clickedInventory == holder._inventory) {
+ e.isCancelled = true
+ holder.handleInventoryClick(e)
+ }
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ fun onPlayerMove(e: PlayerMoveEvent) {
+ if (e.to.blockY < TNTLeagueWorldConfig.minHeight) {
+ when (val team = TNTLeagueGame.getTeam(e.player)) {
+ is TNTLeagueTeam -> e.player.teleport(team.config.spawnLocation)
+ null -> e.player.teleport(TNTLeagueWorldConfig.blueTeam.spawnLocation)
+ }
+ }
+
+ e.player.foodLevel = 20
+ e.player.saturation = 20f
+ }
+
+ @EventHandler
+ fun onPlayerDeath(e: PlayerDeathEvent) {
+ e.deathMessage(null)
+ e.drops.clear()
+
+ e.itemsToKeep.removeIf { it.type != Material.DIAMOND_PICKAXE }
+ }
+
+ @EventHandler
+ fun onPlayerRespawn(e: PlayerRespawnEvent) {
+ when (val team = TNTLeagueGame.getTeam(e.player)) {
+ is TNTLeagueTeam -> e.respawnLocation = team.config.spawnLocation
+ null -> e.respawnLocation = TNTLeagueWorldConfig.lobby
+ }
+ }
+
+ @EventHandler
+ fun onChat(e: AsyncChatEvent) {
+ e.renderer { source, sourceDisplayName, message, _ ->
+ translate("chat", sourceDisplayName.colorByTeam(TNTLeagueGame.getTeam(source)), message).basic()
+ }
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt
new file mode 100644
index 00000000..bb9b0415
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt
@@ -0,0 +1,77 @@
+package de.steamwar.tntleague.events
+
+import de.steamwar.scoreboard.SWScoreboard
+import de.steamwar.tntleague.config.TNTLeagueWorldConfig
+import de.steamwar.tntleague.game.TNTLeagueGame
+import de.steamwar.tntleague.game.TNTLeagueTeam
+import de.steamwar.tntleague.inventory.DealerInventory
+import de.steamwar.tntleague.util.TNTLeagueScoreboard
+import org.bukkit.GameMode
+import org.bukkit.Location
+import org.bukkit.Material
+import org.bukkit.entity.EntityType
+import org.bukkit.event.EventHandler
+import org.bukkit.event.Listener
+import org.bukkit.event.entity.EntityExplodeEvent
+import org.bukkit.event.entity.PlayerDeathEvent
+import org.bukkit.event.player.PlayerDropItemEvent
+import org.bukkit.event.player.PlayerInteractEntityEvent
+import org.bukkit.event.player.PlayerJoinEvent
+import org.bukkit.event.player.PlayerMoveEvent
+import org.bukkit.event.player.PlayerQuitEvent
+
+object IngameListener: Listener {
+
+ @EventHandler
+ fun onEntityInteract(e: PlayerInteractEntityEvent) {
+ if (e.player.gameMode == GameMode.SPECTATOR) return
+
+ if(e.rightClicked.type == EntityType.VILLAGER) {
+ e.isCancelled = true
+ e.player.openInventory(DealerInventory(e.player).getInventory())
+ }
+ }
+
+ @EventHandler
+ fun onExplode(e: EntityExplodeEvent) {
+ e.blockList().filter { it.type == TNTLeagueWorldConfig.targetMaterial }
+ .groupBy { getTeamByTargetLocation(it.location) }
+ .filterKeysNotNull()
+ .mapValues { it.value.size }
+ .forEach { it.key.damagedBlocks += it.value }
+ }
+
+ @EventHandler
+ fun onJoin(e: PlayerJoinEvent) {
+ SWScoreboard.createScoreboard(e.player, TNTLeagueScoreboard(e.player))
+ }
+
+ @EventHandler
+ fun onMove(e: PlayerMoveEvent) {
+ if (TNTLeagueGame.getTeam(e.player) != null) {
+ if (e.to.blockX >= TNTLeagueWorldConfig.lobby.blockX && e.to.blockX <= TNTLeagueWorldConfig.lobby.blockX + 1 ||
+ e.to.blockZ >= TNTLeagueWorldConfig.lobby.blockZ && e.to.blockZ <= TNTLeagueWorldConfig.lobby.blockZ + 1) {
+ e.isCancelled = true
+ }
+ }
+ }
+
+ @EventHandler
+ fun onDropPickaxe(e: PlayerDropItemEvent) {
+ if (e.itemDrop.itemStack.type == Material.DIAMOND_PICKAXE) {
+ e.isCancelled = true
+ }
+ }
+
+ private fun getTeamByTargetLocation(location: Location): TNTLeagueTeam? =
+ when (location) {
+ in TNTLeagueWorldConfig.redTeam.target -> TNTLeagueGame.redTeam
+ in TNTLeagueWorldConfig.blueTeam.target -> TNTLeagueGame.blueTeam
+ else -> null
+ }
+
+ private fun Map.filterKeysNotNull(destination: MutableMap = mutableMapOf()): Map {
+ this.forEach { (t, u) -> if(t != null) destination[t] = u }
+ return destination
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt
new file mode 100644
index 00000000..e88cfbaa
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt
@@ -0,0 +1,61 @@
+package de.steamwar.tntleague.events
+
+import de.steamwar.tntleague.game.TNTLeagueGame
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.basic
+import de.steamwar.tntleague.util.colorByTeam
+import de.steamwar.tntleague.util.translate
+import de.steamwar.tntleague.util.yellow
+import io.papermc.paper.util.Tick
+import org.bukkit.event.EventHandler
+import org.bukkit.event.EventPriority
+import org.bukkit.event.Listener
+import org.bukkit.event.block.Action
+import org.bukkit.event.entity.EntityDamageEvent
+import org.bukkit.event.inventory.InventoryClickEvent
+import org.bukkit.event.player.PlayerDropItemEvent
+import org.bukkit.event.player.PlayerInteractEvent
+import org.bukkit.event.player.PlayerJoinEvent
+import org.bukkit.event.player.PlayerQuitEvent
+
+object LobbyListener: Listener {
+
+ @EventHandler
+ fun onPlayerJoin(e: PlayerJoinEvent) {
+ TNTLeagueGame.getFreeTeam()?.run {
+ join(e.player)
+ TNTLeagueGame.checkStart()
+ }
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ fun onPlayerQuit(e: PlayerQuitEvent) {
+ val team = TNTLeagueGame.getTeam(e.player) ?: return
+ team.leave(e.player)
+ }
+
+ @EventHandler
+ fun onPlayerDamage(e: EntityDamageEvent) {
+ e.isCancelled = true
+ }
+
+ @EventHandler
+ fun onDropEvent(e: PlayerDropItemEvent) {
+ e.isCancelled = true
+ }
+
+ @EventHandler
+ fun interactEvent(e: PlayerInteractEvent) {
+ val team = TNTLeagueGame.getTeam(e.player)
+ if (e.action.isRightClick && team != null && e.item?.isSimilar(team.readyItem()) == true && team.opposite.leader != null) {
+ team.isReady = !team.isReady
+ }
+ }
+
+ @EventHandler
+ fun inventoryClick(e: InventoryClickEvent) {
+ if (e.clickedInventory == e.whoClicked.inventory) {
+ e.isCancelled = true
+ }
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt
new file mode 100644
index 00000000..59d4e65c
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt
@@ -0,0 +1,259 @@
+package de.steamwar.tntleague.game
+
+import de.steamwar.scoreboard.SWScoreboard
+import de.steamwar.sql.Fight
+import de.steamwar.sql.FightPlayer
+import de.steamwar.sql.SteamwarUser
+import de.steamwar.tntleague.config.TNTLeagueConfig
+import de.steamwar.tntleague.config.TNTLeagueWorldConfig
+import de.steamwar.tntleague.config.world
+import de.steamwar.tntleague.events.DummyListener
+import de.steamwar.tntleague.events.IngameListener
+import de.steamwar.tntleague.events.LobbyListener
+import de.steamwar.tntleague.inventory.DealerInventory
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.*
+import net.kyori.adventure.bossbar.BossBar
+import net.kyori.adventure.sound.Sound
+import org.bukkit.GameMode
+import org.bukkit.Location
+import org.bukkit.Material
+import org.bukkit.block.data.type.TNT
+import org.bukkit.entity.Entity
+import org.bukkit.entity.Item
+import org.bukkit.entity.Player
+import org.bukkit.entity.TNTPrimed
+import org.bukkit.entity.Villager
+import org.bukkit.event.HandlerList
+import org.bukkit.event.Listener
+import org.bukkit.inventory.ItemStack
+import org.bukkit.scheduler.BukkitTask
+import java.sql.Timestamp
+import java.time.Instant
+
+object TNTLeagueGame {
+ var state: GameState = GameState.LOBBY
+ set(value) {
+ if (field.listener != value.listener) {
+ HandlerList.unregisterAll(field.listener)
+ plugin.server.pluginManager.registerEvents(value.listener, plugin)
+ }
+ field = value
+ }
+
+ var gameTimeRemaining: Int = TNTLeagueConfig.config.gameTime
+
+ val blueTeam = TNTLeagueTeam(TNTLeagueWorldConfig.blueTeam, TNTLeagueTeam.Team.BLUE)
+ val redTeam = TNTLeagueTeam(TNTLeagueWorldConfig.redTeam, TNTLeagueTeam.Team.RED)
+
+ private lateinit var start: Timestamp
+
+ private var task: Int? = null
+ private lateinit var spawnerTask: BukkitTask
+ private lateinit var timerTask: BukkitTask
+
+ private fun setup() {
+ assert(state == GameState.STARTING) { "Game is already running" }
+
+ state = GameState.RUNNING
+
+ plugin.server.onlinePlayers.forEach { SWScoreboard.createScoreboard(it, TNTLeagueScoreboard(it)) }
+
+ blueTeam.start()
+ redTeam.start()
+
+ plugin.server.broadcast(translate("gameStarted").success())
+
+ val tnt = ItemStack(Material.TNT)
+
+ start = Timestamp.from(Instant.now())
+
+ spawnerTask = plugin.server.scheduler.runTaskTimer(plugin, bukkit {
+ if (world.getNearbyEntitiesByType(Item::class.java, TNTLeagueWorldConfig.blueTeam.itemSpawn, 3.0).sumOf { it.itemStack.amount } <= 256) {
+ spawnItems(TNTLeagueWorldConfig.blueTeam.itemSpawn, tnt)
+ spawnItems(TNTLeagueWorldConfig.blueTeam.itemSpawn, DealerInventory.coins)
+ }
+ if (world.getNearbyEntitiesByType(Item::class.java, TNTLeagueWorldConfig.redTeam.itemSpawn, 3.0).sumOf { it.itemStack.amount } <= 256) {
+ spawnItems(TNTLeagueWorldConfig.redTeam.itemSpawn, tnt)
+ spawnItems(TNTLeagueWorldConfig.redTeam.itemSpawn, DealerInventory.coins)
+ }
+ }, 5, 10)
+
+ timerTask = plugin.server.scheduler.runTaskTimer(plugin, bukkit {
+ gameTimeRemaining--
+ if (gameTimeRemaining == 0) {
+ draw(WinReason.TIMEOUT)
+ return@bukkit
+ }
+
+ if (gameTimeRemaining % 300 == 0) {
+ plugin.server.broadcast(translate("timeRemaining", (gameTimeRemaining / 60).toString().yellow()).basic())
+ plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f)) }
+ }
+ }, 20, 20)
+ }
+
+ private fun bukkit(f: () -> Unit): () -> Unit = f
+
+ private fun end() {
+ if(state != GameState.RUNNING) return
+ state = GameState.END
+
+ plugin.server.onlinePlayers.forEach {
+ it.gameMode = GameMode.SPECTATOR
+ SWScoreboard.removeScoreboard(it)
+ it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f))
+ }
+
+ plugin.server.broadcast(translate("gameEnded").success())
+
+ spawnerTask.cancel()
+
+ var shutdown = 10
+
+ plugin.server.scheduler.runTaskTimer(plugin, bukkit {
+ if (shutdown == 0) {
+ plugin.server.shutdown()
+ }
+
+ plugin.server.broadcast(translate("shutdown", shutdown.toString().yellow()).basic())
+
+ shutdown--
+ }, 20, 20)
+ }
+
+ private fun spawnItems(loc: Location, item: ItemStack) = plugin.server.worlds.first().dropItem(loc, item)
+
+ fun getTeam(player: Player) = if (player in blueTeam.members) blueTeam else if (player in redTeam.members) redTeam else null
+
+ fun getFreeTeam() = if (blueTeam.leader == null) blueTeam else if (redTeam.leader == null) redTeam else null
+
+ fun checkStart() {
+ if (blueTeam.isReady && redTeam.isReady) {
+ blueTeam.leader?.inventory?.clear()
+ redTeam.leader?.inventory?.clear()
+ state = GameState.STARTING
+
+ var countdown = TNTLeagueConfig.config.startDelay
+ plugin.server.broadcast(translate("gameStarting", countdown.toString().yellow()).basic())
+ val bar = BossBar.bossBar(translate("gameStart", countdown.toString().yellow()).gray(), (TNTLeagueConfig.config.startDelay - countdown) / TNTLeagueConfig.config.startDelay.toFloat(), BossBar.Color.GREEN, BossBar.Overlay.NOTCHED_10)
+ plugin.server.onlinePlayers.forEach { bar.addViewer(it) }
+ task = plugin.server.scheduler.scheduleSyncRepeatingTask(plugin, {
+ plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_EXPERIENCE_ORB_PICKUP.key, Sound.Source.MASTER, 1f, 1f)) }
+ if (countdown-- == 0) {
+ plugin.server.onlinePlayers.forEach { it.hideBossBar(bar) }
+ task = task?.also { plugin.server.scheduler.cancelTask(it) }.let { null }
+ setup()
+ } else {
+ bar.name(translate("gameStart", countdown.toString().yellow()).gray())
+ bar.progress((TNTLeagueConfig.config.startDelay - countdown) / TNTLeagueConfig.config.startDelay.toFloat())
+ plugin.server.onlinePlayers.filter { !it.activeBossBars().contains(bar) }.forEach { bar.addViewer(it) }
+ }
+ }, 20, 20)
+
+ if (task == -1) {
+ error("Failed to start countdown task")
+ }
+ }
+ }
+
+ fun playerLeave(player: Player) {
+ blueTeam.invites.remove(player)
+ redTeam.invites.remove(player)
+ getTeam(player)?.apply {
+ members.remove(player)
+ if (leader == player) {
+ win(this.opposite, WinReason.LEAVE)
+ }
+ }
+ }
+
+ fun reset() {
+ assert(state == GameState.LOBBY || state == GameState.STARTING) { "Game is not in lobby or starting state" }
+
+ if (state == GameState.STARTING) {
+ task = task?.also { plugin.server.scheduler.cancelTask(it) }.let { null }
+ plugin.server.onlinePlayers.forEach { p -> p.activeBossBars().forEach { it.removeViewer(p) } }
+ state = GameState.LOBBY
+ }
+ }
+
+ fun win(tntLeagueTeam: TNTLeagueTeam, reason: WinReason) {
+ if (state != GameState.RUNNING) return
+ end()
+ plugin.server.broadcast(translate("teamWin", translate(tntLeagueTeam.name).color(tntLeagueTeam.color)).success())
+ statistic(tntLeagueTeam, reason)
+ explode(tntLeagueTeam.opposite)
+ }
+
+ fun draw(reason: WinReason) {
+ if (state != GameState.RUNNING) return
+ end()
+ plugin.server.broadcast(translate("draw").success())
+ statistic(null, reason)
+ }
+
+ fun explode(team: TNTLeagueTeam) {
+ Area(team.config.spawnLocation.clone().add(20.0, 30.0, 20.0), team.config.spawnLocation.clone().subtract(20.0, 0.0, 20.0).add(0.0, 30.0, 0.0))
+ .locations
+ .filterIndexed { index, _ -> index % 7 == 0 }
+ .forEachIndexed { index, location ->
+ world.spawn(location, TNTPrimed::class.java).apply {
+ fuseTicks = index + 40
+ }
+ }
+ }
+
+ private fun statistic(winTeam: TNTLeagueTeam?, reason: WinReason) {
+ val fightId = Fight.create(
+ "TNTLeague",
+ world.name,
+ start,
+ TNTLeagueConfig.config.gameTime - gameTimeRemaining,
+ SteamwarUser.get(blueTeam.leader!!.uniqueId).id,
+ SteamwarUser.get(redTeam.leader!!.uniqueId).id,
+ null,
+ null,
+ when (winTeam) {
+ blueTeam -> 1
+ redTeam -> 2
+ else -> 0
+ },
+ when (reason) {
+ WinReason.TIMEOUT -> "TIMEOUT"
+ WinReason.DESTROYED -> "DESTROYED"
+ WinReason.LEAVE -> "LEAVE"
+ }
+ )
+
+ addTeamMember(blueTeam, fightId)
+ addTeamMember(redTeam, fightId)
+ }
+
+ private fun addTeamMember(team: TNTLeagueTeam, fightId: Int) {
+ team.members.filter { team.leader != it }
+ .forEach {
+ FightPlayer.create(
+ fightId,
+ SteamwarUser.get(it.uniqueId).id,
+ team == blueTeam,
+ "TNTLeague",
+ 0,
+ false
+ )
+ }
+ }
+
+ enum class GameState(val listener: Listener) {
+ LOBBY(LobbyListener),
+ STARTING(LobbyListener),
+ RUNNING(IngameListener),
+ END(DummyListener);
+ }
+
+ enum class WinReason {
+ TIMEOUT,
+ DESTROYED,
+ LEAVE
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt
new file mode 100644
index 00000000..cafa70c2
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt
@@ -0,0 +1,146 @@
+package de.steamwar.tntleague.game
+
+import de.steamwar.tntleague.config.TNTLeagueWorldConfig
+import de.steamwar.tntleague.config.targetedBlocks
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.*
+import net.kyori.adventure.sound.Sound
+import net.kyori.adventure.text.format.NamedTextColor
+import net.kyori.adventure.text.format.TextColor
+import org.bukkit.GameMode
+import org.bukkit.Material
+import org.bukkit.enchantments.Enchantment
+import org.bukkit.entity.Player
+import org.bukkit.inventory.ItemStack
+import java.awt.Color.green
+
+data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private val team: Team) {
+
+ var leader: Player? = null
+ set(player) {
+ field = player
+ if (player != null) {
+ with(player.inventory) {
+ clear()
+ setItem(4, readyItem())
+ }
+ }
+ }
+
+ val members = mutableListOf()
+ val invites = mutableListOf()
+
+ val name: String
+ get() = team.name.lowercase()
+
+ val color: TextColor
+ get() = team.color
+
+ var isReady: Boolean = false
+ set(value) {
+ field = value
+ leader?.inventory?.setItem(4, readyItem())
+ leader?.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f))
+
+ plugin.server.onlinePlayers.forEach { it.sendActionBar(translate(if (value) "isReady" else "isNotReady", translate(this.name).colorByTeam(this)).let { cmp ->
+ if (value) {
+ cmp.green()
+ } else {
+ cmp.red()
+ }
+ }) }
+
+ if (value && opposite.isReady) {
+ TNTLeagueGame.checkStart()
+ }
+ }
+
+ var damagedBlocks: Int = 0
+ set(value) {
+ field = value
+ if (value >= targetedBlocks) {
+ TNTLeagueGame.win(this, TNTLeagueGame.WinReason.DESTROYED)
+ }
+ }
+
+ val opposite: TNTLeagueTeam
+ get() = when (team) {
+ Team.BLUE -> TNTLeagueGame.redTeam
+ Team.RED -> TNTLeagueGame.blueTeam
+ }
+
+ fun join(player: Player): Boolean {
+ members.add(player)
+
+ with(player) {
+ teleport(config.spawnLocation)
+ gameMode = GameMode.ADVENTURE
+ inventory.clear()
+ plugin.server.broadcast(translate("joinTeam", name().colorByTeam(this@TNTLeagueTeam), translate(this@TNTLeagueTeam.name).colorByTeam(this@TNTLeagueTeam)).basic())
+ }
+
+ if (leader == null) {
+ leader = player
+ }
+
+ return true
+ }
+
+ fun readyItem() = if (isReady) {
+ ItemStack.of(Material.LIME_DYE).apply {
+ itemMeta = itemMeta.apply {
+ displayName(translate("ready").green().translate(leader!!))
+ }
+ }
+ } else {
+ ItemStack.of(Material.RED_DYE).apply {
+ itemMeta = itemMeta.apply {
+ displayName(translate("notReady").red().translate(leader!!))
+ }
+ }
+ }
+
+ fun start() = members.forEach {
+ with(it) {
+ gameMode = GameMode.SURVIVAL
+ inventory.addItem(ItemStack.of(Material.DIAMOND_PICKAXE).apply {
+ itemMeta = itemMeta.apply {
+ isUnbreakable = true
+ addEnchant(Enchantment.EFFICIENCY, 1, false)
+ }
+ })
+ }
+ }
+
+ fun leave(player: Player) {
+ if (TNTLeagueGame.state == TNTLeagueGame.GameState.RUNNING) {
+ TNTLeagueGame.playerLeave(player)
+ } else {
+ members.remove(player)
+
+ if (members.isEmpty()) {
+ plugin.server.onlinePlayers.firstOrNull { it != player && TNTLeagueGame.getTeam(it) == null }?.run {
+ members.add(this)
+ }
+ }
+ if (leader == player) {
+ leader = members.firstOrNull()
+ }
+ }
+ }
+
+ fun remove(player: Player) {
+ leave(player)
+ with(player) {
+ teleport(TNTLeagueWorldConfig.lobby)
+ gameMode = GameMode.SPECTATOR
+ inventory.clear()
+ plugin.server.broadcast(translate("quitTeam", name().colorByTeam(this@TNTLeagueTeam), translate(this@TNTLeagueTeam.name).colorByTeam(this@TNTLeagueTeam)).basic())
+ }
+ }
+
+ enum class Team(val color: TextColor) {
+ BLUE(NamedTextColor.BLUE),
+ RED(NamedTextColor.RED);
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt b/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt
new file mode 100644
index 00000000..04c1c288
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt
@@ -0,0 +1,75 @@
+package de.steamwar.tntleague.inventory
+
+import de.steamwar.tntleague.config.TNTLeagueConfig
+import de.steamwar.tntleague.plugin
+import de.steamwar.tntleague.util.*
+import net.kyori.adventure.sound.Sound
+import net.kyori.adventure.text.Component
+import net.kyori.adventure.text.format.Style
+import net.kyori.adventure.text.format.TextDecoration
+import org.bukkit.Material
+import org.bukkit.NamespacedKey
+import org.bukkit.entity.Player
+import org.bukkit.inventory.Inventory
+import org.bukkit.inventory.ItemStack
+import org.bukkit.persistence.PersistentDataType
+import java.util.*
+import kotlin.math.ceil
+
+class DealerInventory(player: Player): SWInventoryHolder() {
+
+ init {
+ items.forEachIndexed { index, item ->
+ this[index] = item.first to {
+ val price = item.second.price * if (it.isShiftClick) 5 else 1
+ val amount = item.second.amount * if (it.isShiftClick) 5 else 1
+
+ if (!player.inventory.containsAtLeast(coins, price)) {
+ player.sendMessage(translate("notEnoughCoins").error())
+ player.playSound(Sound.sound(org.bukkit.Sound.ENTITY_VILLAGER_HURT.key, net.kyori.adventure.sound.Sound.Source.MASTER, 1f, 1f))
+ return@to
+ }
+
+ player.inventory.removeItem(coins.asQuantity(price))
+ player.inventory.addItem(ItemStack.of(item.first.type, amount))
+ }
+ }
+ }
+
+ override fun createInventory(): Inventory = plugin.server.createInventory(this, ceil(TNTLeagueConfig.config.prices.size / 9f).toInt() * 9, translate("dealer").reset())
+
+ companion object {
+ private val priceKey = NamespacedKey(plugin, "price")
+ private val amountKey = NamespacedKey(plugin, "amount")
+ private val coinKey = NamespacedKey(plugin, "coin")
+
+ val coins = ItemStack(Material.RAW_GOLD).apply {
+ itemMeta = itemMeta.apply {
+ displayName(Component.text("Coins").bold().gold())
+ persistentDataContainer.apply {
+ set(coinKey, PersistentDataType.BOOLEAN, true)
+ }
+ }
+ }
+
+ val items by lazy {
+ val prices = TNTLeagueConfig.config.prices
+
+ prices.map { (material, price) ->
+ ItemStack(material).apply {
+ itemMeta = itemMeta.apply {
+ displayName(material.name.lowercase().replace("_", " ")
+ .replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }
+ .component().gray().appendSpace().append(price.amount.toString().component().yellow()))
+ amount = price.amount
+ lore(listOf(price.price.toString().component().yellow().bold().appendSpace().append(Component.text("Coins").yellow())))
+ persistentDataContainer.apply {
+ set(priceKey, PersistentDataType.INTEGER, price.price)
+ set(amountKey, PersistentDataType.INTEGER, price.amount)
+ }
+ }
+ } to price
+ }
+ }
+ }
+}
diff --git a/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt b/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt
new file mode 100644
index 00000000..5d89e541
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt
@@ -0,0 +1,41 @@
+package de.steamwar.tntleague.inventory
+
+import org.bukkit.event.inventory.InventoryClickEvent
+import org.bukkit.event.inventory.InventoryCloseEvent
+import org.bukkit.inventory.Inventory
+import org.bukkit.inventory.InventoryHolder
+import org.bukkit.inventory.ItemStack
+
+abstract class SWInventoryHolder: InventoryHolder {
+
+ val _inventory: Inventory by lazy { createInventory() }
+
+ private val callbacks = mutableMapOf Unit>()
+
+ override fun getInventory(): Inventory = _inventory
+
+ abstract fun createInventory(): Inventory
+
+ open fun handleInventoryClick(event: InventoryClickEvent) {
+ callbacks[event.slot]?.invoke(event)
+ }
+
+ fun addItem(item: ItemStack, slot: Int, callback: (event: InventoryClickEvent) -> Unit) {
+ _inventory.setItem(slot, item)
+ addCallback(slot, callback)
+ }
+
+ fun addCallback(slot: Int, callback: (event: InventoryClickEvent) -> Unit) {
+ callbacks[slot] = callback
+ }
+
+ open fun handleClose(event: InventoryCloseEvent) { }
+
+ operator fun set(slot: Int, item: Pair Unit>) {
+ addItem(item.first, slot, item.second)
+ }
+
+ operator fun set(slot: Int, item: ItemStack) {
+ addItem(item, slot) { }
+ }
+}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/Area.kt b/TNTLeague/src/de/steamwar/tntleague/util/Area.kt
new file mode 100644
index 00000000..0b27d227
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/util/Area.kt
@@ -0,0 +1,46 @@
+package de.steamwar.tntleague.util
+
+import org.bukkit.Location
+import org.bukkit.block.Block
+
+class Area(loc1: Location, loc2: Location) {
+
+ val min: Location
+ val max: Location
+
+ init {
+ require(loc1.world == loc2.world) { "Locations must be in the same world" }
+ this.min = loc1 min loc2
+ this.max = loc1 max loc2
+ }
+
+ operator fun contains(loc: Location): Boolean {
+ return loc.world == min.world && loc.x >= min.x && loc.x <= max.x && loc.y >= min.y && loc.y <= max.y && loc.z >= min.z && loc.z <= max.z
+ }
+
+ val blocks: Sequence
+ inline get() = sequence {
+ for (x in locations) {
+ yield(x.block)
+ }
+ }
+
+ val locations: Sequence
+ inline get() = sequence {
+ for (x in min.blockX..max.blockX) {
+ for (y in min.blockY..max.blockY) {
+ for (z in min.blockZ..max.blockZ) {
+ yield(Location(min.world, x.toDouble(), y.toDouble(), z.toDouble()))
+ }
+ }
+ }
+ }
+}
+
+infix fun Location.max(other: Location): Location {
+ return Location(world, x.coerceAtLeast(other.x), y.coerceAtLeast(other.y), z.coerceAtLeast(other.z))
+}
+
+infix fun Location.min(other: Location): Location {
+ return Location(world, x.coerceAtMost(other.x), y.coerceAtMost(other.y), z.coerceAtMost(other.z))
+}
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/Style.kt b/TNTLeague/src/de/steamwar/tntleague/util/Style.kt
new file mode 100644
index 00000000..3ef28b9a
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/util/Style.kt
@@ -0,0 +1,73 @@
+package de.steamwar.tntleague.util
+
+import de.steamwar.tntleague.game.TNTLeagueTeam
+import net.kyori.adventure.text.Component
+import net.kyori.adventure.text.ComponentLike
+import net.kyori.adventure.text.TranslatableComponent
+import net.kyori.adventure.text.format.NamedTextColor
+import net.kyori.adventure.text.format.Style
+import net.kyori.adventure.text.format.TextDecoration
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
+import net.kyori.adventure.translation.GlobalTranslator
+import org.bukkit.entity.Player
+import java.util.Locale
+
+val prefix = Component.text("Steam").yellow()
+ .append(Component.text("War").darkGray())
+ .appendSpace()
+
+val tntLeaguePrefix = Component.text("TNT").color(NamedTextColor.DARK_RED)
+ .append(Component.text("League").color(NamedTextColor.GOLD))
+
+val tntLeagueChatPrefix: Component = tntLeaguePrefix
+ .append(Component.text("»").darkGray())
+ .appendSpace()
+
+fun TranslatableComponent.basic(): Component = tntLeagueChatPrefix.append(this.gray())
+
+fun TranslatableComponent.error(): Component = tntLeagueChatPrefix.append(this.red())
+
+fun TranslatableComponent.success(): Component = tntLeagueChatPrefix.append(this.green())
+
+fun String.component(): Component = Component.text(this)
+
+fun Component.bold(): Component = this.decorate(TextDecoration.BOLD)
+
+fun String.bold(): Component = this.component().bold()
+
+fun Component.yellow(): Component = this.color(NamedTextColor.YELLOW)
+
+fun String.yellow(): Component = this.component().yellow()
+
+fun Component.red(): Component = this.color(NamedTextColor.RED)
+
+fun String.red(): Component = this.component().red()
+
+fun Component.green(): Component = this.color(NamedTextColor.GREEN)
+
+fun String.green(): Component = this.component().green()
+
+fun Component.gray(): Component = this.color(NamedTextColor.GRAY)
+
+fun String.gray(): Component = this.component().gray()
+
+fun Component.darkGray(): Component = this.color(NamedTextColor.DARK_GRAY)
+
+fun String.darkGray(): Component = this.component().darkGray()
+
+fun Component.gold(): Component = this.color(NamedTextColor.GOLD)
+
+fun translate(key: String, vararg args: ComponentLike): TranslatableComponent = Component.translatable(key, *args).decoration(TextDecoration.ITALIC, false)
+
+fun Component.reset(): Component = this.style(Style.empty())
+
+fun Component.colorByTeam(team: TNTLeagueTeam?) = when (team) {
+ null -> this.gray()
+ else -> this.color(team.color)
+}
+
+fun Component.translate(locale: Locale): Component = GlobalTranslator.render(this, locale)
+
+fun Component.translate(p: Player): Component = this.translate(p.locale())
+
+fun Component.toLegacy(): String = LegacyComponentSerializer.legacySection().serialize(this)
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt b/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt
new file mode 100644
index 00000000..7b8da592
--- /dev/null
+++ b/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt
@@ -0,0 +1,57 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.tntleague.util
+
+import de.steamwar.scoreboard.ScoreboardCallback
+import de.steamwar.tntleague.config.targetedBlocks
+import de.steamwar.tntleague.game.TNTLeagueGame
+import net.kyori.adventure.text.Component
+import org.bukkit.entity.Player
+import kotlin.collections.HashMap
+
+private val scoreboardTitle by lazy { tntLeaguePrefix.toLegacy() }
+
+data class TNTLeagueScoreboard(val p: Player): ScoreboardCallback {
+ override fun getData(): HashMap {
+ val lines = mutableListOf()
+
+ lines.add(Component.space().green())
+
+ val minutes = TNTLeagueGame.gameTimeRemaining.floorDiv(60)
+ val seconds = TNTLeagueGame.gameTimeRemaining.rem(60).toString().padStart(2, '0')
+ lines.add(translate("scoreboardTime", minutes.toString().yellow(), seconds.yellow()).gray())
+
+ lines.add(Component.space().yellow())
+
+ with(TNTLeagueGame.blueTeam) {
+ lines.add(translate("scoreboardTeam", translate(name).colorByTeam(this), (targetedBlocks - damagedBlocks).toString().yellow()).gray())
+ }
+ with(TNTLeagueGame.redTeam) {
+ lines.add(translate("scoreboardTeam", translate(name).colorByTeam(this), (targetedBlocks - damagedBlocks).toString().yellow()).gray())
+ }
+
+ lines.add(Component.space().gray())
+
+ return lines
+ .foldIndexed(HashMap()) { index, acc, component -> acc.also { it[component.translate(p).toLegacy()] = index } }
+ }
+
+ override fun getTitle(): String = scoreboardTitle
+}
diff --git a/TNTLeague/src/paper-plugin.yml b/TNTLeague/src/paper-plugin.yml
new file mode 100644
index 00000000..8687424a
--- /dev/null
+++ b/TNTLeague/src/paper-plugin.yml
@@ -0,0 +1,10 @@
+name: TNTLeague
+version: '1.0.0'
+main: de.steamwar.tntleague.TNTLeague
+load: POSTWORLD
+api-version: '1.21'
+dependencies:
+ - name: SpigotCore
+ required: true
+ - name: KotlinCore
+ required: true
\ No newline at end of file
diff --git a/Teamserver/build.gradle.kts b/Teamserver/build.gradle.kts
index eb1b15fc..a2b2a4bb 100644
--- a/Teamserver/build.gradle.kts
+++ b/Teamserver/build.gradle.kts
@@ -18,48 +18,14 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:worldedit:1.15")
- compileOnly("de.steamwar:axiompaper:RELEASE")
+ compileOnly(libs.spigotapi)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
+ compileOnly(libs.worldedit15)
+ compileOnly(libs.axiom)
}
diff --git a/TowerRun/build.gradle.kts b/TowerRun/build.gradle.kts
index fcecdfeb..ad7532f4 100644
--- a/TowerRun/build.gradle.kts
+++ b/TowerRun/build.gradle.kts
@@ -18,21 +18,7 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
+ steamwar.java
}
java {
@@ -40,28 +26,14 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
- compileOnly("org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT")
- annotationProcessor("org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT")
+ annotationProcessor(libs.spigotannotations)
+ compileOnly(libs.spigotannotations)
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.19")
- compileOnly("de.steamwar:worldedit:1.15")
+ compileOnly(libs.nms19)
+ compileOnly(libs.worldedit15)
- compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
+ compileOnly(libs.spigotapi)
}
diff --git a/TutorialSystem/build.gradle.kts b/TutorialSystem/build.gradle.kts
index 34f36246..4b7a557a 100644
--- a/TutorialSystem/build.gradle.kts
+++ b/TutorialSystem/build.gradle.kts
@@ -18,45 +18,11 @@
*/
plugins {
- id("java")
- id("base")
-
- id("com.github.johnrengelman.shadow")
-}
-
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
-tasks.build {
- finalizedBy(tasks.shadowJar)
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
+ steamwar.java
}
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
compileOnly(project(":SpigotCore"))
- compileOnly("de.steamwar:spigot:1.15")
+ compileOnly(libs.nms15)
}
diff --git a/VelocityCore/Persistent/build.gradle.kts b/VelocityCore/Persistent/build.gradle.kts
index f0c37802..a65d414a 100644
--- a/VelocityCore/Persistent/build.gradle.kts
+++ b/VelocityCore/Persistent/build.gradle.kts
@@ -18,13 +18,7 @@
*/
plugins {
- id("java")
-}
-
-group = "de.steamwar"
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+ steamwar.java
}
java {
@@ -32,22 +26,7 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly("de.steamwar:velocity:RELEASE")
- annotationProcessor("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
+ compileOnly(libs.velocity)
+ annotationProcessor(libs.velocityapi)
}
\ No newline at end of file
diff --git a/VelocityCore/build.gradle.kts b/VelocityCore/build.gradle.kts
index 0b5d2f8e..2255dc08 100644
--- a/VelocityCore/build.gradle.kts
+++ b/VelocityCore/build.gradle.kts
@@ -18,12 +18,10 @@
*/
plugins {
- id("java")
- id("com.github.johnrengelman.shadow")
+ steamwar.java
+ alias(libs.plugins.shadow)
}
-group = "de.steamwar"
-
tasks.shadowJar {
exclude("META-INF/*")
exclude("org/sqlite/native/FreeBSD/**', 'org/sqlite/native/Mac/**', 'org/sqlite/native/Windows/**', 'org/sqlite/native/Linux-Android/**', 'org/sqlite/native/Linux-Musl/**")
@@ -41,48 +39,29 @@ tasks.build {
finalizedBy(tasks.shadowJar)
}
-tasks.compileJava {
- options.encoding = "UTF-8"
-}
-
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
-sourceSets {
- main {
- java {
- srcDirs("src/")
- }
- resources {
- srcDirs("src/")
- exclude("**/*.java", "**/*.kt")
- }
- }
-}
-
dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
+ annotationProcessor(libs.velocityapi)
+ compileOnly(libs.velocity)
- annotationProcessor("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
- compileOnly("de.steamwar:velocity:RELEASE")
+ compileOnly(project(":VelocityCore:Persistent"))
implementation(project(":CommonCore"))
implementation(project(":CommandFramework"))
- compileOnly(project(":VelocityCore:Persistent"))
+ implementation(libs.sqlite)
+ implementation(libs.mysql)
- implementation("org.xerial:sqlite-jdbc:3.46.0.0")
- implementation("mysql:mysql-connector-java:8.0.33")
-
- implementation("net.dv8tion:JDA:4.4.0_352") {
+ implementation(libs.jda) {
exclude(module = "opus-java")
}
- implementation("org.msgpack:msgpack-core:0.9.8")
+ implementation(libs.msgpack)
- implementation("com.lunarclient:apollo-api:1.1.0")
- implementation("com.lunarclient:apollo-common:1.1.0")
+ implementation(libs.apolloapi)
+ implementation(libs.apollocommon)
}
\ No newline at end of file
diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties
index d126ac74..6b92436c 100644
--- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties
+++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties
@@ -130,6 +130,7 @@ USAGE_ALERT=§8/§7alert §8[§emessage§8]
USAGE_IGNORE=§8/§7ignore §8[§eplayer§8]
#ModListener
+CLIENT_DISALLOWED=Attempted use of client {0}
MOD_RED_SING=Attempted use of mod {0}
MOD_RED_PLUR=Attempted use of mods:\n{0}
MOD_YELLOW_SING=§7Deactivate the mod §e{0}§7 to continue playing on §eSteam§8War§7.
@@ -292,7 +293,7 @@ FIGHT_UNKNOWN_GAMEMODE=§cUnknown gamemode: {0}
FIGHT_UNKNOWN_ARENA=§cThe desired arena does not exist.
FIGHT_IN_ARENA=§cYou are already in an arena.
FIGHT_BROADCAST=§7Click §ehere§7 to fight §e{0} §7against §e{1}!
-FIGHT_BROADCAST_HOVER=§aFight §eagainst §7{1}
+FIGHT_BROADCAST_HOVER=§aFight §eagainst §7{0}
#CheckCommand
CHECK_REMINDER=§7There are §e{0} §7schematics left for review§8!
@@ -664,10 +665,9 @@ ARENA_NOT_FOUND=§cThe specified arena could not be found
#Rank
RANK_PLAYER_NOT_FOUND=§cPlayer not found
RANK_PLAYER_FOUND=§eRank §7of §e{0}
-RANK_HEADER=§e{0} {1}
+RANK_HEADER={0} §e{1} {2}
RANK_UNPLACED=§7unranked
RANK_PLACED=§e{0}§8. §7with §e{1} §7Elo§8.
-RANK_EMBLEM=§7Emblem§8: {0}
#Fabric Mod Sender
MODIFICATION_BAN_MESSAGE=You tried to bypass / modify the FabricModSender!
diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties
index 71d8ce9b..fb4067c8 100644
--- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties
+++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties
@@ -115,6 +115,7 @@ USAGE_ALERT=§8/§7alert §8[§eNachricht§8]
USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8]
#ModListener
+CLIENT_DISALLOWED=Versuchte Benutzung des Clients {0}
MOD_RED_SING=Versuchte Benutzung des Mods {0}
MOD_RED_PLUR=Versuchte Benutzung der Mods:\n{0}
MOD_YELLOW_SING=§7Deaktiviere den Mod §e{0}§7, um weiter auf §eSteam§8War §7spielen zu können.
@@ -275,7 +276,7 @@ FIGHT_UNKNOWN_GAMEMODE=§cUnbekannter Spielmodus: {0}
FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht.
FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena.
FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen!
-FIGHT_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen
+FIGHT_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen
#CheckCommand
CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8!
@@ -639,10 +640,9 @@ ARENA_NOT_FOUND=§cDie angegebene Arena konnte nicht gefunden werden
#Rank
RANK_PLAYER_NOT_FOUND=§cSpieler nicht gefunden
RANK_PLAYER_FOUND=§eRang §7von §e{0}
-RANK_HEADER=§e{0} {1}
+RANK_HEADER={0} §e{1} {2}
RANK_UNPLACED=§7unplatziert
RANK_PLACED=§e{0}§8. §7mit §e{1} §7Elo§8.
-RANK_EMBLEM=§7Emblem§8: {0}
#Fabric Mod Sender
MODIFICATION_BAN_MESSAGE=Du hast probiert den FabricModSender zu umgehen / zu modifizieren!
diff --git a/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java b/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java
index a185dcb8..5595d9d9 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java
@@ -118,4 +118,11 @@ public class ArenaMode extends GameModeConfig {
return getServer().getChatNames().isEmpty();
}
+ public String getSchemTypeOrInternalName() {
+ Schematic schematic = getSchematic();
+ if (schematic == null) {
+ return internalName;
+ }
+ return schematic.getType();
+ }
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/EventStarter.java b/VelocityCore/src/de/steamwar/velocitycore/EventStarter.java
index 1be170f3..17d4f537 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/EventStarter.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/EventStarter.java
@@ -20,6 +20,7 @@
package de.steamwar.velocitycore;
import de.steamwar.messages.Chatter;
+import de.steamwar.messages.Message;
import de.steamwar.persistent.Subserver;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.Team;
@@ -43,7 +44,7 @@ public class EventStarter {
public EventStarter() {
EventFight.loadAllComingFights();
- VelocityCore.schedule(this::run).delay(10, TimeUnit.SECONDS).schedule();
+ VelocityCore.schedule(this::run).repeat(10, TimeUnit.SECONDS).schedule();
}
public static Map getEventServer() {
@@ -73,7 +74,7 @@ public class EventStarter {
} else {
command = "/" + spectatePorts.get(next.getSpectatePort());
}
- Chatter.broadcast().system("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", ClickEvent.runCommand(command), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
+ Chatter.broadcast().system("EVENT_FIGHT_BROADCAST", new Message("EVENT_FIGHT_BROADCAST_HOVER"), ClickEvent.runCommand(command), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
}
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
index 39442713..6a5b3ade 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
@@ -170,6 +170,7 @@ public class VelocityCore implements ReloadablePlugin {
teamCommand = new TeamCommand();
new ServerTeamchatCommand();
new DevCommand();
+ new SendCommand();
new EventCommand();
new EventreloadCommand();
new EventRescheduleCommand();
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
index 037b4ab6..3e1b5d74 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
@@ -126,8 +126,8 @@ public class BauCommand extends SWCommand {
});
}
- @Register("setbuild")
- public void setBuild(Chatter sender, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
+ @Register("setbuilder")
+ public void setBuilder(Chatter sender, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
setPerms(sender, user, "setbuild", "BAU_MEMBER_SET_BUILDER", member -> {
member.setBuild(true);
member.setSupervisor(false);
@@ -165,14 +165,17 @@ public class BauCommand extends SWCommand {
withMember(owner, user, target -> {
target.remove();
+ Bauserver bauserver = Bauserver.get(owner.user().getUUID());
Chatter member = Chatter.of(user.getUUID());
- member.system("BAU_DELMEMBER_DELETED_TARGET", owner);
member.withPlayer(player -> {
- Bauserver bauserver = Bauserver.get(owner.user().getUUID());
if (bauserver != null && bauserver.getRegisteredServer().getPlayersConnected().contains(player))
player.createConnectionRequest(VelocityCore.get().getConfig().lobbyserver()).fireAndForget();
});
+ if(bauserver != null)
+ bauserver.getRegisteredServer().getPlayersConnected().stream().findAny().ifPresent(player -> NetworkSender.send(player, new BaumemberUpdatePacket()));
+
+ member.system("BAU_DELMEMBER_DELETED_TARGET", owner);
owner.system("BAU_DELMEMBER_DELETED");
});
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/EventCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/EventCommand.java
index df90c02b..b57d6aad 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/EventCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/EventCommand.java
@@ -19,19 +19,22 @@
package de.steamwar.velocitycore.commands;
-import de.steamwar.velocitycore.EventStarter;
-import de.steamwar.persistent.Subserver;
-import de.steamwar.velocitycore.SubserverSystem;
+import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.PlayerChatter;
+import de.steamwar.persistent.Subserver;
import de.steamwar.sql.*;
+import de.steamwar.velocitycore.EventStarter;
+import de.steamwar.velocitycore.SubserverSystem;
+import java.sql.Timestamp;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
+import java.util.function.Function;
import java.util.stream.Collectors;
public class EventCommand extends SWCommand {
@@ -50,17 +53,17 @@ public class EventCommand extends SWCommand {
sender.system("EVENT_NO_CURRENT");
List coming = Event.getComing();
- if(coming.isEmpty())
+ if (coming.isEmpty())
return;
sender.system("EVENT_COMING");
Instant now = Instant.now();
DateTimeFormatter format = DateTimeFormatter.ofPattern(sender.parseToPlain("EVENT_DATE_FORMAT"));
- for(Event e : coming){
+ for (Event e : coming) {
sender.prefixless("EVENT_COMING_EVENT", e.getStart().toLocalDateTime().format(format), e.getEnd().toLocalDateTime().format(format), e.getEventName());
- if(now.isBefore(e.getDeadline().toInstant()))
+ if (now.isBefore(e.getDeadline().toInstant()))
sender.prefixless("EVENT_COMING_DEADLINE", e.getDeadline());
SchematicType schemType = e.getSchematicType();
@@ -68,7 +71,7 @@ public class EventCommand extends SWCommand {
sender.prefixless("EVENT_COMING_SCHEM_DEADLINE", schemType.getDeadline());
Set teams = TeamTeilnahme.getTeams(e.getEventID());
- if(!teams.isEmpty())
+ if (!teams.isEmpty())
sender.prefixless("EVENT_COMING_TEAMS", teams.stream().map(team -> sender.parseToLegacy("EVENT_COMING_TEAM", team.getTeamColor(), team.getTeamKuerzel())).collect(Collectors.joining(" ")));
}
}
@@ -81,13 +84,13 @@ public class EventCommand extends SWCommand {
sender.system("EVENT_CURRENT_EVENT", currentEvent.getEventName());
DateTimeFormatter format = DateTimeFormatter.ofPattern(sender.parseToPlain("EVENT_TIME_FORMAT"));
- for(EventFight fight : EventFight.getEvent(currentEvent.getEventID())){
+ for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) {
Team blue = Team.get(fight.getTeamBlue());
Team red = Team.get(fight.getTeamRed());
StringBuilder fline = new StringBuilder(sender.parseToLegacy("EVENT_CURRENT_FIGHT", fight.getStartTime().toLocalDateTime().format(format), blue.getTeamColor(), blue.getTeamKuerzel(), red.getTeamColor(), red.getTeamKuerzel()));
- if(fight.hasFinished()){
- switch(fight.getErgebnis()){
+ if (fight.hasFinished()) {
+ switch (fight.getErgebnis()) {
case 1:
fline.append(sender.parseToLegacy("EVENT_CURRENT_FIGHT_WIN", blue.getTeamColor(), blue.getTeamKuerzel()));
break;
@@ -106,7 +109,7 @@ public class EventCommand extends SWCommand {
@Register
public void eventWithTeam(@Validator(value = "noEvent", invert = true) PlayerChatter sender, @ErrorMessage("EVENT_NO_TEAM") Team team) {
Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId());
- if(eventArena == null || !Subserver.getServerList().contains(eventArena)){
+ if (eventArena == null || !Subserver.getServerList().contains(eventArena)) {
sender.system("EVENT_NO_FIGHT_TEAM");
return;
}
@@ -114,4 +117,39 @@ public class EventCommand extends SWCommand {
SubserverSystem.sendPlayer(eventArena, sender.getPlayer());
}
}
-}
+
+ protected static TypeMapper eventTeam(Function> teamMapper) {
+ return new TypeMapper<>() {
+ @Override
+ public Team map(Chatter sender, PreviousArguments previousArguments, String s) {
+ if ("PUB".equalsIgnoreCase(s) || "public".equalsIgnoreCase(s)) {
+ return Team.get(0);
+ }
+ return Team.get(s);
+ }
+
+ @Override
+ public Collection tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
+ Set teams = new HashSet<>();
+ Event currentEvent = Event.get();
+ for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) {
+ if (fight.hasFinished()) continue;
+ teamMapper.apply(fight).forEach(integer -> {
+ Team team = Team.get(integer);
+ teams.add(team.getTeamName());
+ teams.add(team.getTeamKuerzel());
+ });
+ }
+ return teams;
+ }
+ };
+ }
+
+ @ClassMapper(value = Team.class, local = true)
+ public TypeMapper eventTeams() {
+ return eventTeam(eventFight -> {
+ if (eventFight.getStartTime().after(new Timestamp(System.currentTimeMillis()))) return Collections.emptyList();
+ return List.of(eventFight.getTeamBlue(), eventFight.getTeamRed());
+ });
+ }
+}
\ No newline at end of file
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java
index d639abd4..9660eba4 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java
@@ -20,6 +20,7 @@
package de.steamwar.velocitycore.commands;
import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeMapper;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.Event;
import de.steamwar.sql.EventFight;
@@ -38,7 +39,7 @@ public class EventRescheduleCommand extends SWCommand {
}
@Register
- public void reschedule(Chatter sender, Team teamBlue, Team teamRed) {
+ public void reschedule(Chatter sender, @Mapper("BLUE_TEAM") Team teamBlue, @Mapper("RED_TEAM") Team teamRed) {
Event event = Event.get();
if(event == null){
sender.system("EVENTRESCHEDULE_UNKNOWN_TEAM");
@@ -63,4 +64,14 @@ public class EventRescheduleCommand extends SWCommand {
sender.system("EVENTRESCHEDULE_NO_FIGHT");
}
-}
+
+ @Mapper(value = "BLUE_TEAM", local = true)
+ public TypeMapper eventBlueTeams() {
+ return EventCommand.eventTeam(eventFight -> List.of(eventFight.getTeamBlue()));
+ }
+
+ @Mapper(value = "RED_TEAM", local = true)
+ public TypeMapper eventRedTeams() {
+ return EventCommand.eventTeam(eventFight -> List.of(eventFight.getTeamRed()));
+ }
+}
\ No newline at end of file
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/FightCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/FightCommand.java
index 1d5283ea..633405e8 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/FightCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/FightCommand.java
@@ -130,7 +130,7 @@ public class FightCommand extends SWCommand {
public void fight(@Validator("arenaPlayer") PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
createArena(sender, "/fight ", true, arenaMode, map, false,
(p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
- arena -> Chatter.broadcast().system("FIGHT_BROADCAST", new Message("FIGHT_BROADCAST_HOVER"), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer().getUsername())
+ arena -> Chatter.broadcast().system("FIGHT_BROADCAST", new Message("FIGHT_BROADCAST_HOVER", p.getPlayer().getUsername()), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer().getUsername())
).start()
);
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/JoinmeCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/JoinmeCommand.java
index f6b4262f..4bab8d11 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/JoinmeCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/JoinmeCommand.java
@@ -21,6 +21,7 @@ package de.steamwar.velocitycore.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
+import de.steamwar.messages.Message;
import de.steamwar.messages.PlayerChatter;
import de.steamwar.sql.UserPerm;
import net.kyori.adventure.text.event.ClickEvent;
@@ -33,6 +34,6 @@ public class JoinmeCommand extends SWCommand {
@Register
public void genericCommand(PlayerChatter sender) {
- Chatter.broadcast().system("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER", ClickEvent.runCommand("/join " + sender.getPlayer().getUsername()), sender, sender.getPlayer().getCurrentServer().orElseThrow().getServerInfo().getName());
+ Chatter.broadcast().system("JOINME_BROADCAST", new Message("JOINME_BROADCAST_HOVER"), ClickEvent.runCommand("/join " + sender.getPlayer().getUsername()), sender, sender.getPlayer().getCurrentServer().orElseThrow().getServerInfo().getName());
}
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/RankCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/RankCommand.java
index 5254d52c..4d68f07b 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/RankCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/RankCommand.java
@@ -19,12 +19,12 @@
package de.steamwar.velocitycore.commands;
-import de.steamwar.velocitycore.ArenaMode;
-import de.steamwar.messages.Message;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
+import de.steamwar.messages.Message;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserElo;
+import de.steamwar.velocitycore.ArenaMode;
import java.util.Optional;
@@ -48,17 +48,16 @@ public class RankCommand extends SWCommand {
if (!mode.isRanked())
continue;
- Optional elo = UserElo.getElo(user.getId(), mode.getSchemType());
+ Optional elo = UserElo.getElo(user.getId(), mode.getSchemTypeOrInternalName());
Message eloMsg;
if (elo.isPresent()) {
- int placement = UserElo.getPlacement(elo.get(), mode.getSchemType());
+ int placement = UserElo.getPlacement(elo.get(), mode.getSchemTypeOrInternalName());
eloMsg = new Message("RANK_PLACED", placement, elo.get());
} else {
eloMsg = new Message("RANK_UNPLACED");
}
- sender.prefixless("RANK_HEADER", mode.getChatName(), eloMsg);
- sender.prefixless("RANK_EMBLEM", UserElo.getEmblemProgression(mode.getChatName(), user.getId()));
+ sender.prefixless("RANK_HEADER", UserElo.getEmblemProgression(mode.getChatName(), user.getId()), mode.getChatName(), eloMsg);
}
}
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java
new file mode 100644
index 00000000..660a4ec3
--- /dev/null
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java
@@ -0,0 +1,93 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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.steamwar.velocitycore.commands;
+
+import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.proxy.server.RegisteredServer;
+import com.velocitypowered.api.proxy.server.ServerInfo;
+import de.steamwar.command.PreviousArguments;
+import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeMapper;
+import de.steamwar.messages.Chatter;
+import de.steamwar.persistent.Subserver;
+import de.steamwar.sql.SteamwarUser;
+import de.steamwar.sql.UserPerm;
+import de.steamwar.velocitycore.VelocityCore;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class SendCommand extends SWCommand {
+
+ public SendCommand() {
+ super("send", UserPerm.TEAM);
+ }
+
+ @Register
+ public void sendToServer(Chatter sender, Player send, RegisteredServer server) {
+ send.createConnectionRequest(server).fireAndForget();
+ }
+
+ @ClassMapper(value = RegisteredServer.class, local = true)
+ public TypeMapper subserverTypeMapper() {
+ return new TypeMapper<>() {
+ private boolean check(SteamwarUser user, RegisteredServer registeredServer) {
+ ServerInfo serverInfo = registeredServer.getServerInfo();
+ String name = serverInfo.getName();
+ if (name.contains(" ")) return false;
+
+ Subserver subserver = Subserver.getSubserver(serverInfo);
+ if (subserver == null) {
+ return true;
+ }
+
+ return switch (subserver.getType()) {
+ case ARENA -> true;
+ case BUILDER -> user.hasPerm(UserPerm.BUILD);
+ default -> false;
+ };
+ }
+
+ @Override
+ public RegisteredServer map(Chatter sender, PreviousArguments previousArguments, String s) {
+ SteamwarUser user = sender.user();
+ for (RegisteredServer registeredServer : VelocityCore.getProxy().getAllServers()) {
+ if (check(user, registeredServer)) {
+ return registeredServer;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Collection tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
+ SteamwarUser user = sender.user();
+ List tabCompletes = new ArrayList<>();
+ for (RegisteredServer registeredServer : VelocityCore.getProxy().getAllServers()) {
+ if (check(user, registeredServer)) {
+ tabCompletes.add(registeredServer.getServerInfo().getName());
+ }
+ }
+ return tabCompletes;
+ }
+ };
+ }
+}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/listeners/ChannelListener.java b/VelocityCore/src/de/steamwar/velocitycore/discord/listeners/ChannelListener.java
index 7665c40f..e1922b48 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/discord/listeners/ChannelListener.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/discord/listeners/ChannelListener.java
@@ -85,7 +85,7 @@ public class ChannelListener extends ListenerAdapter {
if(permission != null && !sender.user().perms().contains(permission))
return;
- command.execute(sender, args.split(" "));
+ command.execute(sender, args.isEmpty() ? new String[0] : args.split(" "));
});
}
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java
index 74429c13..0880a0bf 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java
@@ -52,7 +52,7 @@ public class ChatListener extends BasicListener {
private static final Logger cmdLogger = Logger.getLogger("Command logger");
- private static final List rankedModes = ArenaMode.getAllModes().stream().filter(ArenaMode::isRanked).map(ArenaMode::getSchemType).toList();
+ private static final List rankedModes = ArenaMode.getAllModes().stream().filter(ArenaMode::isRanked).map(ArenaMode::getSchemTypeOrInternalName).toList();
@Subscribe(order = PostOrder.FIRST)
public void fixCommands(CommandExecuteEvent e) {
@@ -86,6 +86,7 @@ public class ChatListener extends BasicListener {
cmdLogger.log(Level.INFO, "%s -> executed command /%s".formatted(name, command));
} else if (e.getCommandSource() instanceof Player player) {
+ // System.out.println("spoofChatInput " + e);
player.spoofChatInput("/" + command);
e.setResult(CommandExecuteEvent.CommandResult.denied());
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
index 4fb3d0df..ec8d1726 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
@@ -49,7 +49,7 @@ public class ConnectionListener extends BasicListener {
newPlayers.add(player);
}
- private static final Set TEAM_PERMISSIONS = Set.of("velocity.command.send", "velocity.command.glist");
+ private static final Set TEAM_PERMISSIONS = Set.of("velocity.command.glist");
@Subscribe
public void onPermissionSetup(PermissionsSetupEvent event) {
diff --git a/VelocityCore/src/de/steamwar/velocitycore/mods/Badlion.java b/VelocityCore/src/de/steamwar/velocitycore/mods/Badlion.java
index 74c18eb0..113697ee 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/mods/Badlion.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/mods/Badlion.java
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.mods;
import com.google.gson.JsonObject;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
+import de.steamwar.messages.Chatter;
public class Badlion {
// https://github.com/BadlionClient/BadlionClientModAPI
@@ -50,6 +51,10 @@ public class Badlion {
}
public void sendRestrictions(Player player) {
+ // TODO: Remove when Badlion is fixed, or we fixed the Badlion packet
+ Chatter sender = Chatter.of(player);
+ player.disconnect(sender.parse("CLIENT_DISALLOWED", "Badlion"));
+
player.sendPluginMessage(MinecraftChannelIdentifier.from("badlion:mods"), packet);
}
}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloPlayerHandler.java b/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloPlayerHandler.java
index 327adbac..417a0e5e 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloPlayerHandler.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloPlayerHandler.java
@@ -20,13 +20,13 @@
package de.steamwar.velocitycore.network.handlers;
import com.velocitypowered.api.proxy.Player;
-import de.steamwar.velocitycore.ArenaMode;
-import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.network.packets.PacketHandler;
import de.steamwar.network.packets.common.FightEndsPacket;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserElo;
+import de.steamwar.velocitycore.ArenaMode;
+import de.steamwar.velocitycore.VelocityCore;
import lombok.RequiredArgsConstructor;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
@@ -52,8 +52,15 @@ public class EloPlayerHandler extends PacketHandler {
*/
@Handler
public void handle(FightEndsPacket fightEndsPacket) {
- if (!ArenaMode.getBySchemType(SchematicType.fromDB(fightEndsPacket.getGameMode())).isRanked())
- return;
+ SchematicType schematicType = SchematicType.fromDB(fightEndsPacket.getGameMode());
+ ArenaMode arenaMode;
+ if (schematicType == null) {
+ arenaMode = ArenaMode.getByInternal(fightEndsPacket.getGameMode());
+ } else {
+ arenaMode = ArenaMode.getBySchemType(schematicType);
+ }
+ if (arenaMode == null) return;
+ if (!arenaMode.isRanked()) return;
if (EloSchemHandler.publicVsPrivate(fightEndsPacket))
return;
diff --git a/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloSchemHandler.java b/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloSchemHandler.java
index 68144738..49da0116 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloSchemHandler.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/network/handlers/EloSchemHandler.java
@@ -19,18 +19,21 @@
package de.steamwar.velocitycore.network.handlers;
-import de.steamwar.velocitycore.ArenaMode;
import de.steamwar.network.packets.PacketHandler;
import de.steamwar.network.packets.common.FightEndsPacket;
import de.steamwar.sql.SchemElo;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
+import de.steamwar.velocitycore.ArenaMode;
public class EloSchemHandler extends PacketHandler {
private static final int K = 20;
public static boolean publicVsPrivate(FightEndsPacket packet) {
+ if (packet.getRedSchem() == -1 && packet.getBlueSchem() == -1) {
+ return false;
+ }
SchematicNode blueSchem = SchematicNode.getSchematicNode(packet.getBlueSchem());
SchematicNode redSchem = SchematicNode.getSchematicNode(packet.getRedSchem());
return (blueSchem.getOwner() == 0) != (redSchem.getOwner() == 0);
@@ -38,9 +41,10 @@ public class EloSchemHandler extends PacketHandler {
@Handler
public void handle(FightEndsPacket fightEndsPacket) {
- if (!ArenaMode.getBySchemType(SchematicType.fromDB(fightEndsPacket.getGameMode())).isRanked()) {
- return;
- }
+ SchematicType type = SchematicType.fromDB(fightEndsPacket.getGameMode());
+ if (type == null) return;
+ ArenaMode arenaMode = ArenaMode.getBySchemType(type);
+ if (!arenaMode.isRanked()) return;
if (publicVsPrivate(fightEndsPacket))
return;
diff --git a/VelocityCore/src/de/steamwar/velocitycore/tablist/Tablist.java b/VelocityCore/src/de/steamwar/velocitycore/tablist/Tablist.java
index f8dc1783..315717a6 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/tablist/Tablist.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/tablist/Tablist.java
@@ -43,6 +43,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import java.util.*;
+import java.util.logging.Level;
import java.util.stream.IntStream;
@ChannelHandler.Sharable
@@ -63,7 +64,6 @@ public class Tablist extends ChannelInboundHandlerAdapter {
this.player = player;
this.viewer = Chatter.of(player);
this.directTabItems = Storage.directTabItems.computeIfAbsent(player, p -> new HashMap<>());
- injection();
}
public void update(TablistPart global, int seconds) {
@@ -139,7 +139,9 @@ public class Tablist extends ChannelInboundHandlerAdapter {
synchronized (directTabItems) {
directTabItems.clear();
}
+ }
+ public void onServerPostSwitch() {
if(player.getProtocolVersion().greaterThan(ProtocolVersion.MINECRAFT_1_20)) {
current.clear();
sendPacket(player, createTeamPacket);
@@ -148,8 +150,14 @@ public class Tablist extends ChannelInboundHandlerAdapter {
private void injection() {
connection = (VelocityServerConnection) player.getCurrentServer().orElse(null);
- if(connection == null)
- return;
+ if(connection == null) {
+ connection = ((ConnectedPlayer) player).getConnectionInFlight();
+
+ if(connection == null) {
+ VelocityCore.getLogger().log(Level.WARNING, "Could not inject Tablist: %s".formatted(player));
+ return;
+ }
+ }
ChannelPipeline pipeline = connection.getConnection().getChannel().pipeline();
if(pipeline.get("steamwar-tablist") != null) //Catch unclean exit
diff --git a/VelocityCore/src/de/steamwar/velocitycore/tablist/TablistManager.java b/VelocityCore/src/de/steamwar/velocitycore/tablist/TablistManager.java
index 2b8b47bd..29cebb38 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/tablist/TablistManager.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/tablist/TablistManager.java
@@ -21,8 +21,9 @@ package de.steamwar.velocitycore.tablist;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
-import com.velocitypowered.api.event.connection.PostLoginEvent;
+import com.velocitypowered.api.event.player.ServerConnectedEvent;
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
+import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import de.steamwar.network.packets.common.FightInfoPacket;
@@ -59,17 +60,19 @@ public class TablistManager extends BasicListener {
}
@Subscribe
- public void onJoin(PostLoginEvent event) {
+ public void onServerConnection(ServerConnectedEvent event) {
synchronized (tablists) {
- tablists.put(event.getPlayer(), new Tablist(event.getPlayer()));
+ tablists.computeIfAbsent(event.getPlayer(), Tablist::new).onServerSwitch();
}
- Tablist.sendPacket(event.getPlayer(), Tablist.createTeamPacket);
+
+ if(event.getPlayer().getProtocolVersion().noGreaterThan(ProtocolVersion.MINECRAFT_1_20))
+ Tablist.sendPacket(event.getPlayer(), Tablist.createTeamPacket);
}
@Subscribe
- public void onServerConnection(ServerPostConnectEvent event) {
+ public void onServerPostConnection(ServerPostConnectEvent event) {
synchronized (tablists) {
- tablists.get(event.getPlayer()).onServerSwitch();
+ tablists.get(event.getPlayer()).onServerPostSwitch();
}
}
@@ -90,14 +93,14 @@ public class TablistManager extends BasicListener {
private void updateTablist() {
List subservers = new ArrayList<>();
- for (RegisteredServer server : new ArrayList<>(VelocityCore.getProxy().getAllServers())){
- if(server.getPlayersConnected().isEmpty())
+ for (RegisteredServer server : new ArrayList<>(VelocityCore.getProxy().getAllServers())) {
+ if (server.getPlayersConnected().isEmpty())
continue;
Subserver subserver = Subserver.getSubserver(server.getServerInfo());
- if(fightInfos.containsKey(server))
+ if (fightInfos.containsKey(server))
subservers.add(new TablistServer(server, fightInfos.get(server)));
- else if(subserver == null || subserver.getType() != Servertype.BAUSERVER)
+ else if (subserver == null || subserver.getType() != Servertype.BAUSERVER)
subservers.add(new TablistServer(server));
}
subservers.add(new TablistBuild());
diff --git a/build.gradle.kts b/build.gradle.kts
index e5070caf..21b9838c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -17,97 +17,11 @@
* along with this program. If not, see .
*/
-import org.codehaus.plexus.util.Os
-import java.net.URI
-import java.util.Properties
-
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2024 SteamWar.de-Serverteam
- *
- * 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 {
- id("base")
- id("application")
-
- id("com.github.johnrengelman.shadow") version "8.1.1" apply false
+ base
}
-group = "de.steamwar"
-version = ""
-
-private val isInCi by lazy { Os.isFamily(Os.FAMILY_UNIX) && ProcessBuilder("hostname").start().inputStream.bufferedReader().readText().startsWith("steamwar.de") }
-
allprojects {
- repositories {
- mavenCentral()
-
- maven {
- url = URI("https://m2.dv8tion.net/releases")
- content {
- includeGroup("net.dv8tion")
- }
- }
-
- maven {
- url = URI("https://repo.lunarclient.dev")
- content {
- includeGroup("com.lunarclient")
- }
- }
-
- if (isInCi) {
- maven {
- url = URI("file:///var/www/html/maven/")
- }
- } else {
- maven {
- url = URI("https://steamwar.de/maven/")
- credentials {
- val swProps = Properties()
- swProps.load(rootProject.file("steamwar.properties").inputStream())
-
- username = swProps.getProperty("maven.username")
- password = swProps.getProperty("maven.password")
- }
- }
- }
-
- maven {
- url = URI("https://repo.codemc.io/repository/maven-snapshots/")
- }
-
- maven {
- url = URI("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
- }
-
- maven {
- url = URI("https://libraries.minecraft.net")
- }
-
- maven {
- url = URI("https://repo.viaversion.com")
- }
-
- maven {
- url = URI("https://repo.papermc.io/repository/maven-public/")
- }
- }
-}
-
-sourceSets {
+ group = "de.steamwar"
+ version = ""
}
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 00000000..ff9b2587
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,38 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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 {
+ id 'groovy-gradle-plugin'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDirs("src/")
+ }
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.10")
+}
\ No newline at end of file
diff --git a/buildSrc/src/steamwar.java.gradle b/buildSrc/src/steamwar.java.gradle
new file mode 100644
index 00000000..e68f9fda
--- /dev/null
+++ b/buildSrc/src/steamwar.java.gradle
@@ -0,0 +1,59 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * 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 {
+ id 'java-library'
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+tasks.compileJava {
+ options.encoding "UTF-8"
+}
+
+sourceSets {
+ main {
+ java {
+ srcDirs("src/")
+ }
+ resources {
+ srcDirs("src/")
+ exclude("**/*.java", "**/*.kt")
+ }
+ }
+ test {
+ java {
+ srcDirs("testsrc/")
+ }
+ resources {
+ srcDirs("testsrc/")
+ exclude("**/*.java", "**/*.kt")
+ }
+ }
+}
+
+dependencies {
+ annotationProcessor libs.lombok
+ compileOnly libs.lombok
+ testCompileOnly libs.lombok
+ testAnnotationProcessor libs.lombok
+}
\ No newline at end of file
diff --git a/BauSystem/BauSystem_Linkage/build.gradle.kts b/buildSrc/src/steamwar.kotlin.gradle
similarity index 70%
rename from BauSystem/BauSystem_Linkage/build.gradle.kts
rename to buildSrc/src/steamwar.kotlin.gradle
index aa5e1db0..03b0a99d 100644
--- a/BauSystem/BauSystem_Linkage/build.gradle.kts
+++ b/buildSrc/src/steamwar.kotlin.gradle
@@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
- * Copyright (C) 2024 SteamWar.de-Serverteam
+ * Copyright (C) 2024 SteamWar.de-Serverteam
*
* 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
@@ -18,20 +18,20 @@
*/
plugins {
- id("java")
- id("base")
+ id "org.jetbrains.kotlin.jvm"
}
-group = "de.steamwar"
-version = ""
-
-tasks.compileJava {
- options.encoding = "UTF-8"
+kotlin {
+ jvmToolchain(21)
}
java {
- sourceCompatibility = JavaVersion.VERSION_17
- targetCompatibility = JavaVersion.VERSION_17
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
+}
+
+tasks.compileJava {
+ options.encoding "UTF-8"
}
sourceSets {
@@ -44,11 +44,13 @@ sourceSets {
exclude("**/*.java", "**/*.kt")
}
}
-}
-
-dependencies {
- compileOnly("org.projectlombok:lombok:1.18.32")
- annotationProcessor("org.projectlombok:lombok:1.18.32")
-
- compileOnly(project(":SpigotCore"))
+ test {
+ java {
+ srcDirs("testsrc/")
+ }
+ resources {
+ srcDirs("testsrc/")
+ exclude("**/*.java", "**/*.kt")
+ }
+ }
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ebb1ddb1..ad769fd8 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -17,37 +17,166 @@
* along with this program. If not, see .
*/
+import org.apache.tools.ant.taskdefs.condition.Os
+import java.net.URI
+import java.util.Properties
+
rootProject.name = "SteamWar"
-include("BauSystem")
-include("BauSystem:BauSystem_15")
-include("BauSystem:BauSystem_18")
-include("BauSystem:BauSystem_19")
-include("BauSystem:BauSystem_20")
-include("BauSystem:BauSystem_Linkage")
-include("BauSystem:BauSystem_Main")
+private val isInCi by lazy { Os.isFamily(Os.FAMILY_UNIX) && ProcessBuilder("hostname").start().inputStream.bufferedReader().readText().startsWith("steamwar.de") }
+
+dependencyResolutionManagement {
+ repositories {
+
+ maven {
+ url = URI("https://m2.dv8tion.net/releases")
+ content {
+ includeGroup("net.dv8tion")
+ }
+ }
+
+ maven {
+ url = URI("https://repo.lunarclient.dev")
+ content {
+ includeGroup("com.lunarclient")
+ }
+ }
+
+ maven {
+ if (isInCi) {
+ url = URI("file:///var/www/html/maven/")
+ } else {
+ url = URI("https://steamwar.de/maven/")
+ credentials {
+ val swProps = Properties()
+ swProps.load(rootDir.resolve("steamwar.properties").inputStream())
+
+ username = swProps.getProperty("maven.username")
+ password = swProps.getProperty("maven.password")
+ }
+ }
+
+ content {
+ includeGroup("de.steamwar")
+ }
+ }
+
+ maven {
+ url = URI("https://repo.codemc.io/repository/maven-snapshots/")
+ content {
+ includeGroup("net.wesjd")
+ }
+ }
+
+ maven {
+ url = URI("https://libraries.minecraft.net")
+ content {
+ includeGroup("com.mojang")
+ }
+ }
+
+ maven {
+ url = URI("https://repo.viaversion.com")
+ content {
+ includeGroup("com.viaversion")
+ }
+ }
+
+ maven {
+ url = URI("https://repo.papermc.io/repository/maven-public/")
+ content {
+ includeGroup("org.bukkit")
+ includeGroup("org.spigotmc")
+ includeGroup("io.papermc.paper")
+ includeGroup("com.velocitypowered")
+ includeGroup("net.md-5")
+ }
+ }
+ mavenCentral()
+ }
+
+ versionCatalogs {
+ create("libs") {
+ plugin("shadow", "com.github.johnrengelman.shadow").version("8.1.1")
+
+ library("lombok", "org.projectlombok:lombok:1.18.32")
+ library("luaj", "org.luaj:luaj-jse:3.0.1")
+ library("sqlite", "org.xerial:sqlite-jdbc:3.46.0.0")
+ library("mysql", "mysql:mysql-connector-java:8.0.33")
+ library("fastutil", "it.unimi.dsi:fastutil:8.5.6")
+ library("netty", "io.netty:netty-all:4.1.68.Final")
+ library("junit", "junit:junit:4.13.2")
+ library("hamcrest", "org.hamcrest:hamcrest:2.2")
+ library("jda", "net.dv8tion:JDA:4.4.0_352")
+ library("msgpack", "org.msgpack:msgpack-core:0.9.8")
+ library("classindex", "org.atteo.classindex:classindex:3.13")
+
+ library("spigotapi", "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
+ library("spigotannotations", "org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT")
+ library("paperapi", "io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
+ library("paperapi21", "io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
+ library("authlib", "com.mojang:authlib:1.5.25")
+ library("datafixer", "com.mojang:datafixerupper:4.0.26")
+ library("brigadier", "com.mojang:brigadier:1.0.18")
+ library("viaapi", "com.viaversion:viaversion-api:4.3.1")
+ library("anvilgui", "net.wesjd:anvilgui:1.7.0-SNAPSHOT")
+
+ library("nms8", "de.steamwar:spigot:1.8")
+ library("nms9", "de.steamwar:spigot:1.9")
+ library("nms10", "de.steamwar:spigot:1.10")
+ library("nms12", "de.steamwar:spigot:1.12")
+ library("nms14", "de.steamwar:spigot:1.14")
+ library("nms15", "de.steamwar:spigot:1.15")
+ library("nms18", "de.steamwar:spigot:1.18")
+ library("nms19", "de.steamwar:spigot:1.19")
+ library("nms20", "de.steamwar:spigot:1.20")
+
+ library("axiom", "de.steamwar:axiompaper:RELEASE")
+ library("worldedit12", "de.steamwar:worldedit:1.12")
+ library("worldedit15", "de.steamwar:worldedit:1.15")
+ library("fawe18", "de.steamwar:fastasyncworldedit:1.18")
+
+ library("velocity", "de.steamwar:velocity:RELEASE")
+ library("velocityapi", "com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
+ library("apolloapi", "com.lunarclient:apollo-api:1.1.0")
+ library("apollocommon", "com.lunarclient:apollo-common:1.1.0")
+ }
+ }
+}
+
+include(
+ "BauSystem",
+ "BauSystem:BauSystem_15",
+ "BauSystem:BauSystem_18",
+ "BauSystem:BauSystem_19",
+ "BauSystem:BauSystem_20",
+ "BauSystem:BauSystem_Main"
+)
include("CommandFramework")
-include("CommonCore")
-include("CommonCore:SQL")
-include("CommonCore:Linkage")
-include("CommonCore:Network")
+include(
+ "CommonCore",
+ "CommonCore:SQL",
+ "CommonCore:Network"
+)
-include("FightSystem")
-include("FightSystem:FightSystem_8")
-include("FightSystem:FightSystem_9")
-include("FightSystem:FightSystem_10")
-include("FightSystem:FightSystem_12")
-include("FightSystem:FightSystem_14")
-include("FightSystem:FightSystem_15")
-include("FightSystem:FightSystem_18")
-include("FightSystem:FightSystem_19")
-include("FightSystem:FightSystem_20")
-include("FightSystem:FightSystem_Core")
-include("FightSystem:FightSystem_Standalone")
+include(
+ "FightSystem",
+ "FightSystem:FightSystem_8",
+ "FightSystem:FightSystem_9",
+ "FightSystem:FightSystem_10",
+ "FightSystem:FightSystem_12",
+ "FightSystem:FightSystem_14",
+ "FightSystem:FightSystem_15",
+ "FightSystem:FightSystem_18",
+ "FightSystem:FightSystem_19",
+ "FightSystem:FightSystem_20",
+ "FightSystem:FightSystem_Core",
+ "FightSystem:FightSystem_Standalone"
+)
-// include("KotlinCore")
+include("KotlinCore")
include("LobbySystem")
@@ -55,23 +184,27 @@ include("MissileWars")
include("Realtime")
-include("SchematicSystem")
-include("SchematicSystem:SchematicSystem_8")
-include("SchematicSystem:SchematicSystem_15")
-include("SchematicSystem:SchematicSystem_Core")
+include(
+ "SchematicSystem",
+ "SchematicSystem:SchematicSystem_8",
+ "SchematicSystem:SchematicSystem_15",
+ "SchematicSystem:SchematicSystem_Core"
+)
-include("SpigotCore")
-include("SpigotCore:CRIUDummy")
-include("SpigotCore:SpigotCore_8")
-include("SpigotCore:SpigotCore_9")
-include("SpigotCore:SpigotCore_10")
-include("SpigotCore:SpigotCore_12")
-include("SpigotCore:SpigotCore_14")
-include("SpigotCore:SpigotCore_15")
-include("SpigotCore:SpigotCore_18")
-include("SpigotCore:SpigotCore_19")
-include("SpigotCore:SpigotCore_20")
-include("SpigotCore:SpigotCore_Main")
+include(
+ "SpigotCore",
+ "SpigotCore:CRIUDummy",
+ "SpigotCore:SpigotCore_8",
+ "SpigotCore:SpigotCore_9",
+ "SpigotCore:SpigotCore_10",
+ "SpigotCore:SpigotCore_12",
+ "SpigotCore:SpigotCore_14",
+ "SpigotCore:SpigotCore_15",
+ "SpigotCore:SpigotCore_18",
+ "SpigotCore:SpigotCore_19",
+ "SpigotCore:SpigotCore_20",
+ "SpigotCore:SpigotCore_Main"
+)
include("Teamserver")
@@ -79,5 +212,9 @@ include("TowerRun")
include("TutorialSystem")
-include("VelocityCore")
-include("VelocityCore:Persistent")
+include(
+ "VelocityCore",
+ "VelocityCore:Persistent"
+)
+
+include("TNTLeague")
diff --git a/steamwarci.yml b/steamwarci.yml
index 9a0811a4..c2769abd 100644
--- a/steamwarci.yml
+++ b/steamwarci.yml
@@ -1,7 +1,5 @@
-setup: []
-
build:
- - "JAVA_HOME=/usr/lib/jvm/java-17-openj9-amd64 ./gradlew build --no-daemon"
+ - "./gradlew build --no-daemon"
artifacts:
"/binarys/bausystem2.0.jar": "BauSystem/build/libs/BauSystem-all.jar"
@@ -11,21 +9,21 @@ artifacts:
# KotlinCore !!
- "/binarys/lobbysystem2.0.jar": "LobbySystem/build/libs/LobbySystem-all.jar"
+ "/binarys/lobbysystem2.0.jar": "LobbySystem/build/libs/LobbySystem.jar"
- "/binarys/missilewars.jar": "MissileWars/build/libs/MissileWars-all.jar"
+ "/binarys/missilewars.jar": "MissileWars/build/libs/MissileWars.jar"
- "/binarys/realtime.jar": "Realtime/build/libs/Realtime-all.jar"
+ "/binarys/realtime.jar": "Realtime/build/libs/Realtime.jar"
"/binarys/schematicsystem.jar": "SchematicSystem/build/libs/SchematicSystem-all.jar"
"/binarys/spigotcore.jar": "SpigotCore/build/libs/SpigotCore-all.jar"
- "/binarys/Builder.jar": "Teamserver/build/libs/Teamserver-all.jar"
+ "/binarys/Builder.jar": "Teamserver/build/libs/Teamserver.jar"
- "/binarys/towerrun.jar": "TowerRun/build/libs/TowerRun-all.jar"
+ "/binarys/towerrun.jar": "TowerRun/build/libs/TowerRun.jar"
- "/binarys/tutorialsystem.jar": "TutorialSystem/build/libs/TutorialSystem-all.jar"
+ "/binarys/tutorialsystem.jar": "TutorialSystem/build/libs/TutorialSystem.jar"
"/binarys/PersistentVelocityCore.jar": "VelocityCore/Persistent/build/libs/Persistent.jar"
"/binarys/VelocityCore.jar": "VelocityCore/build/libs/VelocityCore-all.jar"