Merge branch 'main' into FightSystem/LixfelAI

This commit is contained in:
Lixfel
2024-08-18 17:47:56 +02:00
158 changed files with 2521 additions and 3331 deletions

View File

@ -18,15 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
java { java {
@ -34,25 +26,10 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.15") compileOnly(libs.nms15)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
} }

View File

@ -18,15 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
java { java {
@ -34,32 +26,10 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.18") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.nms18)
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")
} }

View File

@ -18,15 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
java { java {
@ -34,33 +26,12 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.19") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.paperapi)
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT") compileOnly(libs.nms19)
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")
} }

View File

@ -18,15 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
java { java {
@ -34,31 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.20") compileOnly(libs.spigotapi)
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") compileOnly(libs.nms20)
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")
} }

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ");");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ");");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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("}");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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("}");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ");");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ");");
}
}

View File

@ -18,17 +18,11 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
} }
group = "de.steamwar"
version = ""
tasks.compileJava { tasks.compileJava {
options.encoding = "UTF-8"
options.isWarnings = false options.isWarnings = false
options.compilerArgs.add("-AprojectDir=$projectDir")
} }
java { java {
@ -36,34 +30,19 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
sourceSets {
main {
java {
srcDirs("src/", "build/generated/sources/annotationProcessor/java/main/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(libs.classindex)
annotationProcessor("org.projectlombok:lombok:1.18.32") annotationProcessor(libs.classindex)
implementation(project(":BauSystem:BauSystem_Linkage"))
annotationProcessor(project(":BauSystem:BauSystem_Linkage"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
annotationProcessor(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.20") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:fastasyncworldedit:1.18") compileOnly(libs.axiom)
compileOnly("de.steamwar:axiompaper:RELEASE") 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")) 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")
} }

View File

@ -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 TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
# Schematic # Schematic
SCHEMATIC_GUI_ITEM=§eSchematics SCHEMATIC_GUI_ITEM=§eSchematics
#VersionAnnouncer
SERVER_VERSION=§7This server runs on Minecraft version §e{0}

View File

@ -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 TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
# Schematics # Schematics
SCHEMATIC_GUI_ITEM=§eSchematics SCHEMATIC_GUI_ITEM=§eSchematics
#VersionAnnouncer
SERVER_VERSION=§7Dieser Server läuft auf Minecraft-Version §e{0}

View File

@ -19,34 +19,56 @@
package de.steamwar.bausystem; 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.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.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.PrototypeLoader;
import de.steamwar.bausystem.region.loader.RegionLoader; import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.loader.Updater; import de.steamwar.bausystem.region.loader.Updater;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.bausystem.utils.TickListener; import de.steamwar.bausystem.utils.TickListener;
import de.steamwar.bausystem.worlddata.WorldData; import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.command.AbstractValidator; import de.steamwar.command.AbstractValidator;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; 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.message.Message;
import de.steamwar.network.packets.PacketHandler;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import java.io.IOException; import java.io.*;
import java.io.OutputStream; import java.lang.reflect.Field;
import java.io.PrintStream; 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.concurrent.atomic.AtomicReference;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors;
public class BauSystem extends JavaPlugin implements Listener { public class BauSystem extends JavaPlugin implements Listener {
@ -57,6 +79,8 @@ public class BauSystem extends JavaPlugin implements Listener {
@Getter @Getter
private static BauSystem instance; private static BauSystem instance;
private final Map<Class<?>, Object> instances = new HashMap<>();
@Override @Override
public void onEnable() { public void onEnable() {
// LOGGER // LOGGER
@ -85,17 +109,111 @@ public class BauSystem extends JavaPlugin implements Listener {
SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR)); SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR));
SWCommandUtils.addValidator("owner", validator(Permission.OWNER)); SWCommandUtils.addValidator("owner", validator(Permission.OWNER));
instances.put(BauServer.class, BauServer.getInstance());
List<Class<?>> classes = new BufferedReader(new InputStreamReader(BauSystem.class.getResourceAsStream("/META-INF/annotations/de.steamwar.linkage.Linked")))
.lines()
.map(s -> {
try { try {
LinkageUtils.link(); return Class.forName(s, false, BauSystem.class.getClassLoader());
} catch (Exception e) { } catch (ClassNotFoundException | NoClassDefFoundError e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); if (e.getMessage().equals(s)) {
Bukkit.shutdown(); Bukkit.shutdown();
System.exit(1); 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; 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(); 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 <T extends CommandSender> AbstractValidator<T, ?> validator(Permission permission) { private <T extends CommandSender> AbstractValidator<T, ?> validator(Permission permission) {
return (commandSender, object, messageSender) -> { return (commandSender, object, messageSender) -> {
if (commandSender instanceof Player) { 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() { private void fixLogging() {
System.setErr(new PrintStream(new OutputStream() { System.setErr(new PrintStream(new OutputStream() {
private StringBuilder current = new StringBuilder(); private StringBuilder current = new StringBuilder();

View File

@ -19,21 +19,18 @@
package de.steamwar.bausystem.config; package de.steamwar.bausystem.config;
import de.steamwar.linkage.Linked;
import de.steamwar.providers.BauServerInfo; import de.steamwar.providers.BauServerInfo;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import lombok.Getter; import lombok.Getter;
import java.util.UUID; import java.util.UUID;
@Linked
public class BauServer { public class BauServer {
@Getter @Getter
private static BauServer instance; private static BauServer instance = new BauServer();
public BauServer() { private BauServer() {
instance = this;
} }
private Integer owner; private Integer owner;

View File

@ -23,9 +23,9 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.gui.editor.BauGuiMapping; import de.steamwar.bausystem.features.gui.editor.BauGuiMapping;
import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import lombok.Getter;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -38,13 +38,9 @@ import java.util.*;
@UtilityClass @UtilityClass
public class BauGUI { public class BauGUI {
@Getter
private static final Map<Integer, BauGuiItem> ITEMS = new HashMap<>(); private static final Map<Integer, BauGuiItem> ITEMS = new HashMap<>();
public static Map<Integer, BauGuiItem> getITEMS() {
if (ITEMS.isEmpty()) LinkageUtils.linkGUIItems();
return ITEMS;
}
private static final Set<Player> OPEN_INVS = new HashSet<>(); private static final Set<Player> OPEN_INVS = new HashSet<>();
private static boolean updating = false; private static boolean updating = false;

View File

@ -61,6 +61,9 @@ public class ResetCommand extends SWCommand {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL))) PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor()); .color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL); region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
for (Flag value : Flag.values()) {
region.set(value, value.getDefaultValue());
}
RegionUtils.message(region, "REGION_RESET_RESETED"); RegionUtils.message(region, "REGION_RESET_RESETED");
} catch (SecurityException e) { } catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p); BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);

View File

@ -23,13 +23,12 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner; import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Plain;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener; import org.bukkit.plugin.messaging.PluginMessageListener;
@Linked @Linked
public class HotkeyListener implements PluginMessageListener, Plain { public class HotkeyListener implements PluginMessageListener {
{ {
Bukkit.getServer().getMessenger().registerIncomingPluginChannel(BauSystem.getInstance(), "sw:hotkeys", this); Bukkit.getServer().getMessenger().registerIncomingPluginChannel(BauSystem.getInstance(), "sw:hotkeys", this);
@ -37,7 +36,7 @@ public class HotkeyListener implements PluginMessageListener, Plain {
@Override @Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) { 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 (!channel.equals("sw:hotkeys")) return;
if (message.length < 5) return; if (message.length < 5) return;
int action = message[4] & 0xFF; int action = message[4] & 0xFF;

View File

@ -21,26 +21,23 @@ package de.steamwar.bausystem.features.slaves.laufbau;
import com.sk89q.worldedit.blocks.SkullBlock; import com.sk89q.worldedit.blocks.SkullBlock;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.utils.NMSWrapper; import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import org.bukkit.Bukkit;
import org.bukkit.Material; 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.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.block.data.Bisected; import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional; import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.*; 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 java.util.function.Consumer;
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
@ -52,6 +49,7 @@ public class BlockBoundingBox {
private static List<String> randomPlayerHead = new ArrayList<>(); private static List<String> randomPlayerHead = new ArrayList<>();
private static Random random = new Random(); private static Random random = new Random();
static { static {
randomPlayerHead.add("zOnlyKroks"); randomPlayerHead.add("zOnlyKroks");
randomPlayerHead.add("YoyoNow"); randomPlayerHead.add("YoyoNow");
@ -274,8 +272,6 @@ public class BlockBoundingBox {
eastTrapDoor.setFacing(BlockFace.EAST); eastTrapDoor.setFacing(BlockFace.EAST);
eastTrapDoor.setOpen(true); eastTrapDoor.setOpen(true);
addPixel(eastTrapDoor, 0, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_EAST", "LAUFBAU_OPEN")); 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) { private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem) {

View File

@ -24,7 +24,6 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -41,9 +40,6 @@ import java.util.*;
public class Panzern { public class Panzern {
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>(); private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
static {
LinkageUtils.linkPanzern();
}
public static void add(PanzernAlgorithm panzernAlgorithm) { public static void add(PanzernAlgorithm panzernAlgorithm) {
panzernAlgorithmList.add(panzernAlgorithm); panzernAlgorithmList.add(panzernAlgorithm);
} }

View File

@ -27,7 +27,6 @@ import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Plain;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -50,7 +49,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Linked @Linked
public class SmartPlaceListener implements Plain, Listener { public class SmartPlaceListener implements Listener {
private static final Set<Material> CONTAINERS = new HashSet<>(); private static final Set<Material> CONTAINERS = new HashSet<>();
private static final Set<Material> IGNORED = new HashSet<>(); private static final Set<Material> IGNORED = new HashSet<>();

View File

@ -35,20 +35,16 @@ import org.bukkit.event.player.PlayerQuitEvent;
@Linked @Linked
public class AFKStopperListener implements Listener { public class AFKStopperListener implements Listener {
private int afkTicks = 0; private long lastMovementTime = System.currentTimeMillis();
public AFKStopperListener() { public AFKStopperListener() {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
switch (afkTicks) { long currentTime = System.currentTimeMillis();
case 15: if(currentTime - lastMovementTime > 10*60000) { // 10 Minutes
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers())
p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p)); p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p));
} } else if(currentTime - lastMovementTime > 9*60000)
case 14:
BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE"); BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE");
default:
afkTicks++;
}
}, 1200, 1200); //every minute }, 1200, 1200); //every minute
} }
@ -60,7 +56,7 @@ public class AFKStopperListener implements Listener {
Location from = event.getFrom(); Location from = event.getFrom();
if (from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw()) 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 @EventHandler(priority = EventPriority.LOWEST) //Potential fix for potential race condition with WE axe spontaneously not working

View File

@ -4,13 +4,13 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.scoreboard.ScoreboardCallback; import de.steamwar.scoreboard.ScoreboardCallback;
import org.apache.commons.lang3.tuple.MutableTriple; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.tuple.Triple; import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -22,8 +22,17 @@ import java.util.*;
@Linked @Linked
public class BauScoreboard implements Listener { 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<ScoreboardElement.ScoreboardGroup, List<ScoreboardElement>> ELEMENTS = new HashMap<>(); private static final Map<ScoreboardElement.ScoreboardGroup, List<ScoreboardElement>> ELEMENTS = new HashMap<>();
private static final Map<Player, Map<String, MutableTriple<ScoreboardElement.ScoreboardGroup, Integer, String>>> ADDITIONAL_SCOREBOARD_LINES = new HashMap<>(); private static final Map<Player, Map<String, Data>> ADDITIONAL_SCOREBOARD_LINES = new HashMap<>();
public static void addElement(ScoreboardElement scoreboardElement) { public static void addElement(ScoreboardElement scoreboardElement) {
List<ScoreboardElement> elements = ELEMENTS.computeIfAbsent(scoreboardElement.getGroup(), scoreboardGroup -> new ArrayList<>()); List<ScoreboardElement> 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) { public static void setAdditionalElement(Player player, String key, ScoreboardElement.ScoreboardGroup group, int priority, String value) {
Map<String, MutableTriple<ScoreboardElement.ScoreboardGroup, Integer, String>> playerElements = ADDITIONAL_SCOREBOARD_LINES.computeIfAbsent(player, player1 -> new HashMap<>()); Map<String, Data> playerElements = ADDITIONAL_SCOREBOARD_LINES.computeIfAbsent(player, player1 -> new HashMap<>());
if (value == null || value.isBlank()) { if (value == null || value.isBlank()) {
playerElements.remove(key); playerElements.remove(key);
return; return;
} }
MutableTriple<ScoreboardElement.ScoreboardGroup, Integer, String> element = playerElements.computeIfAbsent(key, s -> new MutableTriple<>(null, null, null)); Data element = playerElements.computeIfAbsent(key, s -> new Data(null, null, null));
element.setLeft(group); element.setGroup(group);
element.setMiddle(priority); element.setPriority(priority);
element.setRight(value); element.setText(value);
} }
@EventHandler @EventHandler
@ -76,10 +85,10 @@ public class BauScoreboard implements Listener {
if (ADDITIONAL_SCOREBOARD_LINES.containsKey(player)) { if (ADDITIONAL_SCOREBOARD_LINES.containsKey(player)) {
ADDITIONAL_SCOREBOARD_LINES.get(player).values() ADDITIONAL_SCOREBOARD_LINES.get(player).values()
.stream() .stream()
.filter(triple -> triple.getLeft() == group) .filter(triple -> triple.getGroup() == group)
.sorted(Comparator.comparing(MutableTriple::getMiddle)) .sorted(Comparator.comparing(Data::getPriority))
.forEach(triple -> { .forEach(triple -> {
groupElements.add(triple.getRight()); groupElements.add(triple.getText());
}); });
} }
groupElements.removeIf(Objects::isNull); groupElements.removeIf(Objects::isNull);

View File

@ -23,11 +23,10 @@ import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.utils.NMSWrapper; import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Plain;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@Linked @Linked
public class NoCreativeKnockback implements Plain { public class NoCreativeKnockback {
public NoCreativeKnockback() { public NoCreativeKnockback() {
TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> { TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> {

View File

@ -32,6 +32,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWEAboveMaskParser extends FAWEMaskParser { public class FAWEAboveMaskParser extends FAWEMaskParser {
public FAWEAboveMaskParser() { public FAWEAboveMaskParser() {

View File

@ -32,6 +32,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWEBelowMaskParser extends FAWEMaskParser { public class FAWEBelowMaskParser extends FAWEMaskParser {
public FAWEBelowMaskParser() { public FAWEBelowMaskParser() {

View File

@ -31,6 +31,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWECheckerboard3DMaskParser extends FAWEMaskParser { public class FAWECheckerboard3DMaskParser extends FAWEMaskParser {
public FAWECheckerboard3DMaskParser() { public FAWECheckerboard3DMaskParser() {

View File

@ -25,11 +25,13 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import de.steamwar.bausystem.features.worldedit.utils.FAWEMaskParser; import de.steamwar.bausystem.features.worldedit.utils.FAWEMaskParser;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.PluginCheck;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWECheckerboardMaskParser extends FAWEMaskParser { public class FAWECheckerboardMaskParser extends FAWEMaskParser {
public FAWECheckerboardMaskParser() { public FAWECheckerboardMaskParser() {

View File

@ -31,6 +31,7 @@ import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWEGridMaskParser extends FAWEMaskParser { public class FAWEGridMaskParser extends FAWEMaskParser {
public FAWEGridMaskParser() { public FAWEGridMaskParser() {

View File

@ -27,12 +27,14 @@ import com.sk89q.worldedit.regions.Region;
import de.steamwar.bausystem.features.worldedit.utils.FAWEPatternParser; import de.steamwar.bausystem.features.worldedit.utils.FAWEPatternParser;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.PluginCheck;
import org.bukkit.Axis; import org.bukkit.Axis;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
@Linked @Linked
@PluginCheck("FastAsyncWorldEdit")
public class FAWEGradientPatternParser extends FAWEPatternParser { public class FAWEGradientPatternParser extends FAWEPatternParser {
public FAWEGradientPatternParser() { public FAWEGradientPatternParser() {

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Player> 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);
}
}

View File

@ -19,10 +19,15 @@
package de.steamwar.linkage; 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) @Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
public @interface Linked { public @interface Linked {
String feature() default "";
} }

View File

@ -24,7 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
public @interface LinkedInstance { public @interface LinkedInstance {
} }

View File

@ -24,8 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@AllowedContexts(Context.SPIGOT) @Retention(RetentionPolicy.RUNTIME)
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
public @interface MaxVersion { public @interface MaxVersion {
int value(); int value();

View File

@ -24,8 +24,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@AllowedContexts(Context.SPIGOT) @Retention(RetentionPolicy.RUNTIME)
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
public @interface MinVersion { public @interface MinVersion {
int value(); int value();

View File

@ -21,8 +21,7 @@ package de.steamwar.linkage;
import java.lang.annotation.*; import java.lang.annotation.*;
@AllowedContexts({Context.BUNGEE, Context.SPIGOT}) @Retention(RetentionPolicy.RUNTIME)
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
@Repeatable(PluginCheck.PluginChecks.class) @Repeatable(PluginCheck.PluginChecks.class)
public @interface PluginCheck { public @interface PluginCheck {
@ -34,7 +33,7 @@ public @interface PluginCheck {
NOT NOT
} }
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})
@interface PluginChecks { @interface PluginChecks {
@SuppressWarnings("unused") PluginCheck[] value() default {}; @SuppressWarnings("unused") PluginCheck[] value() default {};

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Disable {
void disable();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Enable {
void enable();
}

View File

@ -2,6 +2,8 @@ name: BauSystem
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ] authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0" version: "2.0"
depend: [ WorldEdit, SpigotCore ] depend: [ WorldEdit, SpigotCore ]
softdepend:
- ViaVersion
load: POSTWORLD load: POSTWORLD
main: de.steamwar.bausystem.BauSystem main: de.steamwar.bausystem.BauSystem
api-version: "1.13" api-version: "1.13"

View File

@ -18,32 +18,15 @@
*/ */
plugins { plugins {
id("base") `java-library`
id("java-library") alias(libs.plugins.shadow)
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
tasks.build { tasks.build {
finalizedBy(tasks.shadowJar) finalizedBy(tasks.shadowJar)
} }
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
implementation(project(":BauSystem:BauSystem_Main")) implementation(project(":BauSystem:BauSystem_Main"))
implementation(project(":BauSystem:BauSystem_15")) implementation(project(":BauSystem:BauSystem_15"))
implementation(project(":BauSystem:BauSystem_18")) implementation(project(":BauSystem:BauSystem_18"))

View File

@ -18,49 +18,10 @@
*/ */
plugins { plugins {
id("base") steamwar.java
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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") testImplementation(libs.junit)
annotationProcessor("org.projectlombok:lombok:1.18.32") testImplementation(libs.hamcrest)
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")
} }

View File

@ -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")
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage;
public enum Context {
BUNGEE,
SPIGOT
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<String> 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<File> 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<String> 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<TypeElement> disabledElements = new HashSet<>();
Set<TypeElement> 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<Set<String>, List<TypeElement>> groupedByChecks = elements.stream()
.collect(Collectors.groupingBy(element -> checks(element, buildPlan)));
Map<String, TypeElement> neededFields = new HashMap<>();
Set<Runnable> fieldInjections = new HashSet<>();
for (TypeElement typeElement : elements) {
if (getLinkagesOfType(typeElement).size() > 1) {
neededFields.put(typeElement.getQualifiedName().toString(), typeElement);
}
List<VariableElement> 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<String, MethodBuilder> methods = new HashMap<>();
for (Map.Entry<Set<String>, List<TypeElement>> entry : groupedByChecks.entrySet()) {
Map<String, Map<TypeElement, List<LinkageType>>> groupedByMethod = new HashMap<>();
for (TypeElement typeElement : entry.getValue()) {
for (Map.Entry<String, List<LinkageType>> linkages : getLinkagesOfType(typeElement).entrySet()) {
groupedByMethod.computeIfAbsent(linkages.getKey(), ignored -> new HashMap<>())
.put(typeElement, linkages.getValue());
}
}
for (Map.Entry<String, Map<TypeElement, List<LinkageType>>> 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<TypeElement, List<LinkageType>> 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<String, TypeElement> 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<String> checks(TypeElement typeElement, BuildPlan buildPlan) {
Set<String> 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<String> stringConsumer, Runnable inner) {
Set<String> 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<String, List<LinkageType>> getLinkagesOfType(TypeElement typeElement) {
Map<String, List<LinkageType>> 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;
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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);
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Disable {
void disable();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Enable {
void enable();
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Plain {
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<String> imports = new HashSet<>();
private final String className;
private List<FieldBuilder> fieldBuilders = new ArrayList<>();
private Map<String, MethodBuilder> methodBuilderMap = new HashMap<>();
private List<String> 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");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<ParameterBuilder> parameters = new ArrayList<>();
private List<String> 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");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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);
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ");");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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<String, TypeElement> eventClasses = new HashMap<>();
Map<TypeElement, ExecutableElement> 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 + ");");
});
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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();");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ";");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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 + ";");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
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);");
}
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") testImplementation(libs.junit)
annotationProcessor("org.projectlombok:lombok:1.18.32") testImplementation(libs.hamcrest)
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")
} }

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(libs.sqlite)
annotationProcessor("org.projectlombok:lombok:1.18.32")
testCompileOnly("org.projectlombok:lombok:1.18.32")
testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
} }

View File

@ -21,7 +21,6 @@ package de.steamwar.sql;
import de.steamwar.sql.internal.*; import de.steamwar.sql.internal.*;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows;
import javax.crypto.SecretKeyFactory; import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEKeySpec;
@ -34,6 +33,7 @@ import java.util.function.BiConsumer;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SteamwarUser { public class SteamwarUser {
private static final SecureRandom random = new SecureRandom(); private static final SecureRandom random = new SecureRandom();
@ -61,7 +61,7 @@ public class SteamwarUser {
private static final SelectStatement<SteamwarUser> byName = table.selectFields("UserName"); private static final SelectStatement<SteamwarUser> byName = table.selectFields("UserName");
private static final SelectStatement<SteamwarUser> byDiscord = table.selectFields("DiscordId"); private static final SelectStatement<SteamwarUser> byDiscord = table.selectFields("DiscordId");
private static final SelectStatement<SteamwarUser> byTeam = table.selectFields("Team"); private static final SelectStatement<SteamwarUser> byTeam = table.selectFields("Team");
private static final SelectStatement<SteamwarUser> getServerTeam = new SelectStatement<>(table, "SELECT * FROM UserData WHERE UserGroup != 'Member' AND UserGroup != 'YouTuber'"); private static final SelectStatement<SteamwarUser> 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 updateName = table.update(Table.PRIMARY, "UserName");
private static final Statement updatePassword = table.update(Table.PRIMARY, "Password"); private static final Statement updatePassword = table.update(Table.PRIMARY, "Password");
@ -138,8 +138,19 @@ public class SteamwarUser {
} }
} }
public static List<SteamwarUser> getUsersWithPerm(UserPerm userPerm) {
return getUsersWithPerm.listSelect(userPerm);
}
public static List<SteamwarUser> getServerTeam() { public static List<SteamwarUser> getServerTeam() {
return getServerTeam.listSelect(); 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<SteamwarUser> getTeam(int teamId) { public static List<SteamwarUser> getTeam(int teamId) {

View File

@ -18,34 +18,10 @@
*/ */
plugins { plugins {
id("base") steamwar.java
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 {
} }
dependencies { 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:SQL"))
api(project(":CommonCore:Linkage"))
api(project(":CommonCore:Network")) api(project(":CommonCore:Network"))
} }

View File

@ -18,41 +18,12 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly("de.steamwar:spigot:1.10") compileOnly(libs.nms10)
compileOnly("de.steamwar:worldedit:1.12")
} }

View File

@ -18,42 +18,14 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(project(":SpigotCore"))
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8"))
compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.12") compileOnly(libs.nms12)
compileOnly("de.steamwar:worldedit:1.12") compileOnly(libs.worldedit12)
} }

View File

@ -18,45 +18,17 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(project(":SpigotCore"))
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8"))
compileOnly(project(":FightSystem:FightSystem_9")) compileOnly(project(":FightSystem:FightSystem_9"))
compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.14") compileOnly(libs.nms14)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
compileOnly("it.unimi.dsi:fastutil:8.5.6") compileOnly(libs.fastutil)
} }

View File

@ -18,41 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly("de.steamwar:spigot:1.15") compileOnly(libs.nms15)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
} }

View File

@ -18,47 +18,17 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly("de.steamwar:fastasyncworldedit:1.18") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:spigot:1.18")
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT") compileOnly(libs.nms18)
compileOnly("com.mojang:datafixerupper:4.0.26") compileOnly(libs.fawe18)
compileOnly("io.netty:netty-all:4.1.68.Final")
compileOnly("com.mojang:authlib:1.5.25") compileOnly(libs.fastutil)
compileOnly("it.unimi.dsi:fastutil:8.5.6")
} }

View File

@ -18,47 +18,14 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_18")) compileOnly(project(":FightSystem:FightSystem_18"))
compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:spigot:1.19")
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT") compileOnly(libs.nms19)
compileOnly("com.mojang:brigadier:1.0.18")
compileOnly("com.mojang:datafixerupper:4.0.26")
compileOnly("com.mojang:authlib:1.5.25")
} }

View File

@ -18,43 +18,16 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_18")) 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(libs.nms20)
compileOnly("it.unimi.dsi:fastutil:8.5.6")
compileOnly(libs.fastutil)
} }

View File

@ -18,41 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly("de.steamwar:spigot:1.8") compileOnly(libs.nms8)
compileOnly("de.steamwar:worldedit:1.12") compileOnly(libs.worldedit12)
} }

View File

@ -18,42 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(project(":SpigotCore"))
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8"))
compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.9") compileOnly(libs.nms9)
compileOnly("de.steamwar:worldedit:1.12")
} }

View File

@ -18,44 +18,15 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.spigotapi)
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT") compileOnly(libs.worldedit15)
compileOnly("it.unimi.dsi:fastutil:8.5.6") compileOnly(libs.fastutil)
compileOnly("io.netty:netty-all:4.1.68.Final") compileOnly(libs.authlib)
compileOnly("com.mojang:authlib:1.5.25")
} }

View File

@ -18,39 +18,16 @@
*/ */
plugins { plugins {
id("java") `java-library`
id("base") alias(libs.plugins.shadow)
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
tasks.build { tasks.build {
finalizedBy(tasks.shadowJar) finalizedBy(tasks.shadowJar)
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceSets {
main {
java {
srcDirs()
}
resources {
srcDirs()
}
}
}
dependencies { dependencies {
implementation(project(":SpigotCore"))
implementation(project(":FightSystem:FightSystem_Core")) implementation(project(":FightSystem:FightSystem_Core"))
implementation(project(":FightSystem:FightSystem_8")) implementation(project(":FightSystem:FightSystem_8"))
implementation(project(":FightSystem:FightSystem_9")) implementation(project(":FightSystem:FightSystem_9"))
@ -61,5 +38,4 @@ dependencies {
implementation(project(":FightSystem:FightSystem_18")) implementation(project(":FightSystem:FightSystem_18"))
implementation(project(":FightSystem:FightSystem_19")) implementation(project(":FightSystem:FightSystem_19"))
implementation(project(":FightSystem:FightSystem_20")) implementation(project(":FightSystem:FightSystem_20"))
implementation(project(":SpigotCore"))
} }

View File

@ -18,32 +18,15 @@
*/ */
plugins { plugins {
id("base") `java-library`
id("java") alias(libs.plugins.shadow)
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
tasks.build { tasks.build {
finalizedBy(tasks.shadowJar) finalizedBy(tasks.shadowJar)
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
implementation(project(":FightSystem:FightSystem_Core")) implementation(project(":FightSystem:FightSystem_Core"))
implementation(project(":FightSystem:FightSystem_8")) implementation(project(":FightSystem:FightSystem_8"))
implementation(project(":FightSystem:FightSystem_9")) implementation(project(":FightSystem:FightSystem_9"))

View File

@ -18,17 +18,8 @@
*/ */
plugins { plugins {
id("java") steamwar.kotlin
kotlin("jvm") version "2.0.0" alias(libs.plugins.shadow)
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
tasks.build { tasks.build {
@ -39,29 +30,6 @@ tasks.shadowJar {
exclude("org/**") exclude("org/**")
} }
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
implementation(kotlin("reflect")) compileOnly(libs.paperapi21)
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
}
kotlin {
jvmToolchain(21)
} }

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.core package de.steamwar.kotlin
import org.bukkit.plugin.java.JavaPlugin import org.bukkit.plugin.java.JavaPlugin

View File

@ -1,5 +1,5 @@
name: KotlinCore name: KotlinCore
version: '2.0.0' version: '2.0.0'
main: de.steamwar.core.KotlinCore main: de.steamwar.kotlin.KotlinCore
load: POSTWORLD load: POSTWORLD
api-version: '1.21' api-version: '1.21'

View File

@ -18,21 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
}
tasks.build {
finalizedBy(tasks.shadowJar)
} }
java { java {
@ -40,26 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.20") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:worldedit:1.15")
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") compileOnly(libs.nms20)
compileOnly(libs.worldedit15)
} }

View File

@ -4,7 +4,7 @@ DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===--- COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's # 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. NPC_CHAT_2 = §fWelcome on §eSteam§8War§f, have fun.
# Portal Command # Portal Command

View File

@ -4,7 +4,7 @@ DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===--- COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's # 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. NPC_CHAT_2 = §fWillkommen auf §eSteam§8War§f, viel Spaß dir.
# Portal Command # Portal Command

View File

@ -18,21 +18,7 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
}
tasks.build {
finalizedBy(tasks.shadowJar)
} }
java { java {
@ -40,26 +26,11 @@ java {
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
} }
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.20") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:fastasyncworldedit:1.18")
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") compileOnly(libs.nms20)
compileOnly(libs.fawe18)
} }

1
README.md Normal file
View File

@ -0,0 +1 @@
# SteamWar

View File

@ -18,43 +18,9 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(libs.spigotapi)
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
} }

View File

@ -18,41 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
compileOnly("de.steamwar:spigot:1.15") compileOnly(libs.nms15)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
} }

View File

@ -18,41 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":SpigotCore"))
compileOnly(project(":SchematicSystem:SchematicSystem_Core"))
compileOnly("de.steamwar:spigot:1.8") compileOnly(libs.nms8)
compileOnly("de.steamwar:worldedit:1.12") compileOnly(libs.worldedit12)
} }

View File

@ -18,40 +18,12 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore"))
compileOnly("de.steamwar:spigot:1.15") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
} }

View File

@ -18,32 +18,15 @@
*/ */
plugins { plugins {
id("java") `java-library`
id("base") alias(libs.plugins.shadow)
id("com.github.johnrengelman.shadow")
}
group = "de.steamwar"
version = ""
tasks.compileJava {
options.encoding = "UTF-8"
} }
tasks.build { tasks.build {
finalizedBy(tasks.shadowJar) finalizedBy(tasks.shadowJar)
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
implementation(project(":SchematicSystem:SchematicSystem_Core")) implementation(project(":SchematicSystem:SchematicSystem_Core"))
implementation(project(":SchematicSystem:SchematicSystem_8")) implementation(project(":SchematicSystem:SchematicSystem_8"))
implementation(project(":SchematicSystem:SchematicSystem_15")) implementation(project(":SchematicSystem:SchematicSystem_15"))

View File

@ -18,28 +18,5 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }

View File

@ -18,39 +18,11 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly("de.steamwar:spigot:1.10") compileOnly(libs.nms10)
} }

View File

@ -18,40 +18,12 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { 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(":CommonCore"))
compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly("de.steamwar:spigot:1.12") compileOnly(libs.nms12)
} }

View File

@ -18,43 +18,15 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(project(":CommonCore"))
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_8")) compileOnly(project(":SpigotCore:SpigotCore_8"))
compileOnly(project(":SpigotCore:SpigotCore_9")) compileOnly(project(":SpigotCore:SpigotCore_9"))
compileOnly(project(":CommonCore"))
compileOnly("de.steamwar:spigot:1.14") compileOnly(libs.nms14)
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
} }

View File

@ -18,39 +18,11 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly("de.steamwar:spigot:1.15") compileOnly(libs.nms15)
} }

View File

@ -18,48 +18,23 @@
*/ */
plugins { plugins {
id("java") steamwar.java
id("base")
} }
group = "de.steamwar"
version = ""
tasks.compileJava { tasks.compileJava {
options.encoding = "UTF-8"
options.isWarnings = false 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 { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly(project(":CommonCore"))
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_14")) compileOnly(project(":SpigotCore:SpigotCore_14"))
compileOnly(project(":CommonCore"))
compileOnly("de.steamwar:fastasyncworldedit:1.18") compileOnly(libs.spigotapi)
compileOnly("de.steamwar:spigot:1.18") compileOnly(libs.nms18)
compileOnly(libs.fawe18)
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT") compileOnly(libs.datafixer)
compileOnly("com.mojang:datafixerupper:4.0.26") compileOnly(libs.netty)
compileOnly("io.netty:netty-all:4.1.68.Final") compileOnly(libs.authlib)
compileOnly("com.mojang:authlib:1.5.25")
} }

View File

@ -18,47 +18,19 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) compileOnly(project(":SpigotCore:SpigotCore_Main"))
compileOnly(project(":SpigotCore:SpigotCore_14")) compileOnly(project(":SpigotCore:SpigotCore_14"))
compileOnly(project(":SpigotCore:SpigotCore_18")) compileOnly(project(":SpigotCore:SpigotCore_18"))
compileOnly("de.steamwar:worldedit:1.15") compileOnly(libs.worldedit15)
compileOnly("de.steamwar:spigot:1.19") compileOnly(libs.nms19)
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT") compileOnly(libs.spigotapi)
compileOnly("com.mojang:brigadier:1.0.18") compileOnly(libs.brigadier)
compileOnly("com.mojang:datafixerupper:4.0.26") compileOnly(libs.datafixer)
compileOnly("com.mojang:authlib:1.5.25") compileOnly(libs.authlib)
} }

View File

@ -18,41 +18,13 @@
*/ */
plugins { plugins {
id("java") steamwar.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")
}
}
} }
dependencies { dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
compileOnly(project(":SpigotCore:SpigotCore_Main")) 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)
} }

Some files were not shown because too many files have changed in this diff Show More