Refactor CommonCore

This commit is contained in:
2024-08-05 12:08:04 +02:00
parent c286d5999e
commit 41d31e6c9c
94 changed files with 182 additions and 78 deletions
+43
View File
@@ -0,0 +1,43 @@
plugins {
id("java")
}
group = "de.steamwar"
version = ""
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.compileJava {
options.encoding = "UTF-8"
}
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
test {
java {
srcDirs("testsrc/")
}
resources {
srcDirs("testsrc/")
exclude("**/*.java", "**/*.kt")
}
}
}
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")
}
@@ -1,20 +1,20 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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.
* 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/>.
* 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;
@@ -36,7 +36,6 @@ import javax.lang.model.element.VariableElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic;
import javax.tools.StandardLocation;
import java.io.*;
import java.lang.annotation.Annotation;
import java.nio.file.Files;
+46
View File
@@ -0,0 +1,46 @@
plugins {
id("java")
}
group = "de.steamwar"
version = ""
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.compileJava {
options.encoding = "UTF-8"
}
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
test {
java {
srcDirs("testsrc/")
}
resources {
srcDirs("testsrc/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
testCompileOnly("org.projectlombok:lombok:1.18.32")
testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest:2.2")
}
@@ -20,12 +20,8 @@
package de.steamwar.network;
import de.steamwar.network.packets.NetworkPacket;
import de.steamwar.network.packets.client.ExecuteCommandPacket;
import de.steamwar.network.packets.client.ImALobbyPacket;
import de.steamwar.network.packets.client.InventoryCallbackPacket;
import de.steamwar.network.packets.client.PrepareSchemPacket;
import de.steamwar.network.packets.common.FightEndsPacket;
import de.steamwar.network.packets.common.FightInfoPacket;
import de.steamwar.network.packets.client.*;
import de.steamwar.network.packets.common.*;
import de.steamwar.network.packets.server.*;
import lombok.SneakyThrows;
+43
View File
@@ -0,0 +1,43 @@
plugins {
id("java")
}
group = "de.steamwar"
version = ""
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.compileJava {
options.encoding = "UTF-8"
}
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
test {
java {
srcDirs("testsrc/")
}
resources {
srcDirs("testsrc/")
exclude("**/*.java", "**/*.kt")
}
}
}
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")
}
@@ -1,20 +1,20 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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.
* 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/>.
* 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.sql;
@@ -53,7 +53,7 @@ public class Mod {
return new Mod(platform, name, ModType.UNKLASSIFIED);
}
public static List<Mod> getAllModsFiltered(int page, int elementsPerPage, Mod.ModType filter) {
public static List<Mod> getAllModsFiltered(int page, int elementsPerPage, ModType filter) {
return Mod.getPageOfType.listSelect(filter, page * elementsPerPage, elementsPerPage);
}
@@ -71,7 +71,7 @@ public class Mod {
@Field(def = "0")
private ModType modType;
public void setModType(Mod.ModType modType) {
public void setModType(ModType modType) {
set.update(modType, platform, modName);
this.modType = modType;
}
@@ -1,20 +1,20 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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.
* 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/>.
* 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.sql;
@@ -60,7 +60,7 @@ public class Punishment {
return getAllPunishments.listSelect(user);
}
public static boolean isPunished(SteamwarUser user, Punishment.PunishmentType type, Consumer<Punishment> callback) {
public static boolean isPunished(SteamwarUser user, PunishmentType type, Consumer<Punishment> callback) {
Punishment punishment = Punishment.getPunishmentOfPlayer(user.getId(), type);
if(punishment == null || !punishment.isCurrent()) {
return false;
@@ -34,7 +34,7 @@ public class Table<T> {
private final Map<String, TableField<?>> fieldsByIdentifier = new HashMap<>();
final Constructor<T> constructor;
private final Map<String, Table.TableField<?>[]> keys;
private final Map<String, TableField<?>[]> keys;
public Table(Class<T> clazz) {
+5 -22
View File
@@ -19,7 +19,7 @@
plugins {
id("base")
id("java")
id("java-library")
}
group = "de.steamwar"
@@ -35,24 +35,6 @@ tasks.compileJava {
}
sourceSets {
main {
java {
srcDirs("src/")
}
resources {
srcDirs("src/")
exclude("**/*.java", "**/*.kt")
}
}
test {
java {
srcDirs("testsrc/")
}
resources {
srcDirs("testsrc/")
exclude("**/*.java", "**/*.kt")
}
}
}
dependencies {
@@ -61,8 +43,9 @@ dependencies {
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")
compileOnly("org.xerial:sqlite-jdbc:3.46.0.0")
api(project(":CommonCore:SQL"))
api(project(":CommonCore:Linkage"))
api(project(":CommonCore:Network"))
}
@@ -19,7 +19,6 @@
package de.steamwar.lobby;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.lobby.portal.FightserverPortal;
import de.steamwar.network.packets.common.FightInfoPacket;
import org.bukkit.Bukkit;
-8
View File
@@ -110,12 +110,4 @@ allprojects {
}
sourceSets {
main {
java {
srcDirs()
}
resources {
srcDirs()
}
}
}
+3
View File
@@ -22,6 +22,9 @@ rootProject.name = "SteamWar"
include("CommandFramework")
include("CommonCore")
include("CommonCore:SQL")
include("CommonCore:Linkage")
include("CommonCore:Network")
include("FightSystem")
include("FightSystem:FightSystem_8")