diff --git a/build.gradle b/build.gradle index 9a69471..e100180 100644 --- a/build.gradle +++ b/build.gradle @@ -24,12 +24,11 @@ loom { splitEnvironmentSourceSets() mods { - "ct-server" { + "rcc-server" { sourceSet sourceSets.main sourceSet sourceSets.client } } - } dependencies { @@ -57,7 +56,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 17 } java { @@ -66,8 +65,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { diff --git a/gradle.properties b/gradle.properties index 0cc6377..270332d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,18 +4,18 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 -yarn_mappings=1.21+build.9 -loader_version=0.15.11 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.16.3 # Mod Properties -mod_version=1.5.0 -maven_group=ct -archives_base_name=ct-server +mod_version=1.6.0 +maven_group=cc.reconnected +archives_base_name=rcc-server # Dependencies -fabric_version=0.101.2+1.21 +fabric_version=0.92.2+1.20.1 -owo_version=0.12.11+1.21 +owo_version=0.11.2+1.20 postgresql_version=42.7.3 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/client/java/ct/server/CtserverClient.java b/src/client/java/ct/server/CtserverClient.java deleted file mode 100644 index 3b740f1..0000000 --- a/src/client/java/ct/server/CtserverClient.java +++ /dev/null @@ -1,10 +0,0 @@ -package ct.server; - -import net.fabricmc.api.ClientModInitializer; - -public class CtserverClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - // This entrypoint is suitable for setting up client-specific logic, such as rendering. - } -} \ No newline at end of file diff --git a/src/client/java/ct/server/mixin/client/ExampleClientMixin.java b/src/client/java/ct/server/mixin/client/ExampleClientMixin.java deleted file mode 100644 index 84c3640..0000000 --- a/src/client/java/ct/server/mixin/client/ExampleClientMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package ct.server.mixin.client; - -import net.minecraft.client.MinecraftClient; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftClient.class) -public class ExampleClientMixin { - @Inject(at = @At("HEAD"), method = "run") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftClient.run()V - } -} \ No newline at end of file diff --git a/src/client/resources/ct-server.client.mixins.json b/src/client/resources/ct-server.client.mixins.json deleted file mode 100644 index 5c7d7f2..0000000 --- a/src/client/resources/ct-server.client.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "ct.server.mixin.client", - "compatibilityLevel": "JAVA_21", - "client": [ - "ExampleClientMixin" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/src/main/java/ct/server/CtServer.java b/src/main/java/cc/reconnected/server/RccServer.java similarity index 83% rename from src/main/java/ct/server/CtServer.java rename to src/main/java/cc/reconnected/server/RccServer.java index 3401975..e62034b 100644 --- a/src/main/java/ct/server/CtServer.java +++ b/src/main/java/cc/reconnected/server/RccServer.java @@ -1,14 +1,13 @@ -package ct.server; +package cc.reconnected.server; -import ct.server.database.DatabaseClient; -import ct.server.database.PlayerData; -import ct.server.database.PlayerTable; -import ct.server.events.PlayerWelcome; -import ct.server.http.ServiceServer; +import cc.reconnected.server.database.DatabaseClient; +import cc.reconnected.server.database.PlayerData; +import cc.reconnected.server.database.PlayerTable; +import cc.reconnected.server.events.PlayerWelcome; +import cc.reconnected.server.http.ServiceServer; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; @@ -22,18 +21,18 @@ import java.sql.SQLException; import java.util.Date; -public class CtServer implements ModInitializer { - public static final String MOD_ID = "ct-server"; +public class RccServer implements ModInitializer { + public static final String MOD_ID = "rcc-server"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); - public static final ct.server.CtServerConfig CONFIG = ct.server.CtServerConfig.createAndLoad(); + public static final cc.reconnected.server.RccServerConfig CONFIG = cc.reconnected.server.RccServerConfig.createAndLoad(); private static float currentTps = 0; private static float currentMspt = 0; private static int currentPlayerCount = 0; - private static CtServer INSTANCE; - public static CtServer getInstance() { + private static RccServer INSTANCE; + public static RccServer getInstance() { return INSTANCE; } @@ -64,14 +63,14 @@ public class CtServer implements ModInitializer { return currentPlayerCount; } - public CtServer() { + public RccServer() { INSTANCE = this; } @Override public void onInitialize() { - LOGGER.info("Starting ct-server"); + LOGGER.info("Starting rcc-server"); try { // Jumpstart connection @@ -88,7 +87,7 @@ public class CtServer implements ModInitializer { } ServerTickEvents.END_SERVER_TICK.register(server -> { - currentMspt = server.getAverageTickTime(); + currentMspt = server.getTickTime(); if (currentMspt != 0) { currentTps = Math.min(20, 1000 / currentMspt); } diff --git a/src/main/java/cc/reconnected/server/RccServerConfigModel.java b/src/main/java/cc/reconnected/server/RccServerConfigModel.java new file mode 100644 index 0000000..91c9229 --- /dev/null +++ b/src/main/java/cc/reconnected/server/RccServerConfigModel.java @@ -0,0 +1,9 @@ +package cc.reconnected.server; + +import io.wispforest.owo.config.annotation.Config; + +@Config(name = "rcc-server-config", wrapperName = "RccServerConfig") +public class RccServerConfigModel { + public short httpPort = 25581; + public String databaseUrl = "jdbc:postgresql://127.0.0.1:5432/rcc?user=myuser&password=mypassword"; +} diff --git a/src/main/java/ct/server/database/DatabaseClient.java b/src/main/java/cc/reconnected/server/database/DatabaseClient.java similarity index 59% rename from src/main/java/ct/server/database/DatabaseClient.java rename to src/main/java/cc/reconnected/server/database/DatabaseClient.java index e059eb2..91b76ba 100644 --- a/src/main/java/ct/server/database/DatabaseClient.java +++ b/src/main/java/cc/reconnected/server/database/DatabaseClient.java @@ -1,6 +1,6 @@ -package ct.server.database; +package cc.reconnected.server.database; -import ct.server.CtServer; +import cc.reconnected.server.RccServer; import java.sql.*; @@ -8,7 +8,7 @@ public class DatabaseClient { private Connection connection; public Connection connection() throws SQLException { if (connection == null || connection.isClosed()) { - connection = DriverManager.getConnection(CtServer.CONFIG.databaseUrl()); + connection = DriverManager.getConnection(RccServer.CONFIG.databaseUrl()); } return connection; } diff --git a/src/main/java/ct/server/database/PlayerData.java b/src/main/java/cc/reconnected/server/database/PlayerData.java similarity index 97% rename from src/main/java/ct/server/database/PlayerData.java rename to src/main/java/cc/reconnected/server/database/PlayerData.java index 1fc66e5..bd54b45 100644 --- a/src/main/java/ct/server/database/PlayerData.java +++ b/src/main/java/cc/reconnected/server/database/PlayerData.java @@ -1,4 +1,4 @@ -package ct.server.database; +package cc.reconnected.server.database; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/ct/server/database/PlayerTable.java b/src/main/java/cc/reconnected/server/database/PlayerTable.java similarity index 89% rename from src/main/java/ct/server/database/PlayerTable.java rename to src/main/java/cc/reconnected/server/database/PlayerTable.java index a242141..9cedd02 100644 --- a/src/main/java/ct/server/database/PlayerTable.java +++ b/src/main/java/cc/reconnected/server/database/PlayerTable.java @@ -1,6 +1,6 @@ -package ct.server.database; +package cc.reconnected.server.database; -import ct.server.CtServer; +import cc.reconnected.server.RccServer; import org.jetbrains.annotations.Nullable; import java.sql.SQLException; @@ -13,7 +13,7 @@ public class PlayerTable { private final HashMap cache = new HashMap<>(); private DatabaseClient database() { - return CtServer.getInstance().database(); + return RccServer.getInstance().database(); } public void ensureDatabaseCreated() { @@ -35,7 +35,7 @@ public class PlayerTable { stmt.close(); } catch (SQLException e) { - CtServer.LOGGER.error("Could not create players data tables", e); + RccServer.LOGGER.error("Could not create players data tables", e); } } @@ -73,7 +73,7 @@ public class PlayerTable { cache.put(uuid, playerData); return playerData; } catch (SQLException e) { - CtServer.LOGGER.error("Could not get player data from database", e); + RccServer.LOGGER.error("Could not get player data from database", e); return null; } } @@ -90,7 +90,7 @@ public class PlayerTable { cache.remove(uuid); return true; } catch(SQLException e) { - CtServer.LOGGER.error("Could not delete player data from database", e); + RccServer.LOGGER.error("Could not delete player data from database", e); return false; } } @@ -115,7 +115,7 @@ public class PlayerTable { cache.put(playerData.uuid(), playerData); return true; } catch (SQLException e) { - CtServer.LOGGER.error("Could not get player data from database", e); + RccServer.LOGGER.error("Could not get player data from database", e); return false; } } diff --git a/src/main/java/ct/server/events/PlayerWelcome.java b/src/main/java/cc/reconnected/server/events/PlayerWelcome.java similarity index 88% rename from src/main/java/ct/server/events/PlayerWelcome.java rename to src/main/java/cc/reconnected/server/events/PlayerWelcome.java index 573062e..9cfd34d 100644 --- a/src/main/java/ct/server/events/PlayerWelcome.java +++ b/src/main/java/cc/reconnected/server/events/PlayerWelcome.java @@ -1,6 +1,6 @@ -package ct.server.events; +package cc.reconnected.server.events; -import ct.server.database.PlayerData; +import cc.reconnected.server.database.PlayerData; import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; import net.minecraft.server.MinecraftServer; diff --git a/src/main/java/ct/server/http/ServiceServer.java b/src/main/java/cc/reconnected/server/http/ServiceServer.java similarity index 82% rename from src/main/java/ct/server/http/ServiceServer.java rename to src/main/java/cc/reconnected/server/http/ServiceServer.java index 590cd8e..2587aa9 100644 --- a/src/main/java/ct/server/http/ServiceServer.java +++ b/src/main/java/cc/reconnected/server/http/ServiceServer.java @@ -1,9 +1,9 @@ -package ct.server.http; +package cc.reconnected.server.http; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; -import ct.server.CtServer; +import cc.reconnected.server.RccServer; import java.io.IOException; import java.net.InetSocketAddress; @@ -15,7 +15,7 @@ public class ServiceServer { } public ServiceServer() throws IOException { - server = HttpServer.create(new InetSocketAddress(CtServer.CONFIG.httpPort()), 0); + server = HttpServer.create(new InetSocketAddress(RccServer.CONFIG.httpPort()), 0); server.createContext("/tps", new TPSHandler()); server.createContext("/mspt", new MSPTHandler()); server.createContext("/player", new PlayerCountHandler()); @@ -28,7 +28,7 @@ public class ServiceServer { static class TPSHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { - var tps = String.valueOf(CtServer.getTPS()); + var tps = String.valueOf(RccServer.getTPS()); t.sendResponseHeaders(200, tps.length()); var body = t.getResponseBody(); body.write(tps.getBytes()); @@ -39,7 +39,7 @@ public class ServiceServer { static class MSPTHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { - var tps = String.valueOf(CtServer.getMSPT()); + var tps = String.valueOf(RccServer.getMSPT()); t.sendResponseHeaders(200, tps.length()); var body = t.getResponseBody(); body.write(tps.getBytes()); @@ -50,7 +50,7 @@ public class ServiceServer { static class PlayerCountHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { - var tps = String.valueOf(CtServer.getPlayerCount()); + var tps = String.valueOf(RccServer.getPlayerCount()); t.sendResponseHeaders(200, tps.length()); var body = t.getResponseBody(); body.write(tps.getBytes()); diff --git a/src/main/java/ct/server/CtServerConfigModel.java b/src/main/java/ct/server/CtServerConfigModel.java deleted file mode 100644 index f2c9b52..0000000 --- a/src/main/java/ct/server/CtServerConfigModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package ct.server; - -import io.wispforest.owo.config.annotation.Config; - -@Config(name = "ct-server-config", wrapperName = "CtServerConfig") -public class CtServerConfigModel { - public short httpPort = 25581; - public String databaseUrl = "jdbc:postgresql://127.0.0.1:5432/ct?user=myuser&password=mypassword"; -} diff --git a/src/main/java/ct/server/mixin/ExampleMixin.java b/src/main/java/ct/server/mixin/ExampleMixin.java deleted file mode 100644 index 1e9f657..0000000 --- a/src/main/java/ct/server/mixin/ExampleMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package ct.server.mixin; - -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftServer.class) -public class ExampleMixin { - @Inject(at = @At("HEAD"), method = "loadWorld") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftServer.loadWorld()V - } -} \ No newline at end of file diff --git a/src/main/resources/assets/ct-server/icon.png b/src/main/resources/assets/rcc-server/icon.png similarity index 100% rename from src/main/resources/assets/ct-server/icon.png rename to src/main/resources/assets/rcc-server/icon.png diff --git a/src/main/resources/ct-server.mixins.json b/src/main/resources/ct-server.mixins.json deleted file mode 100644 index c20d2b1..0000000 --- a/src/main/resources/ct-server.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "ct.server.mixin", - "compatibilityLevel": "JAVA_21", - "mixins": [ - "ExampleMixin" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a3348c5..001fb7b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,38 +1,30 @@ { "schemaVersion": 1, - "id": "ct-server", + "id": "rcc-server", "version": "${version}", - "name": "ct-server", - "description": "Server mod for the project CT Minecraft server", + "name": "rcc-server", + "description": "Server mod for the ReconnectedCC Minecraft server", "authors": [ "AlexDevs", "EmmaKnijn" ], "contact": { - "sources": "https://github.com/project-connecticut/ct-server" + "sources": "https://github.com/ReconnectedCC/rcc-server" }, "license": "MIT License", - "icon": "assets/ct-server/icon.png", + "icon": "assets/rcc-server/icon.png", "environment": "*", "entrypoints": { "main": [ - "ct.server.CtServer" - ], - "client": [ - "ct.server.CtserverClient" + "cc.reconnected.server.RccServer" ] }, "mixins": [ - "ct-server.mixins.json", - { - "config": "ct-server.client.mixins.json", - "environment": "client" - } ], "depends": { - "fabricloader": ">=0.15.11", - "minecraft": "~1.21", - "java": ">=21", + "fabricloader": ">=0.16.0", + "minecraft": "~1.20.1", + "java": ">=17", "fabric-api": "*" } } \ No newline at end of file