diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ca3795..50495da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,25 @@ -# Automatically build the project and run any configured tests for every push -# and submitted pull request. This can help catch issues that only occur on -# certain platforms or Java versions, and provides a first line of defence -# against bad commits. - name: build on: [pull_request, push] jobs: build: - strategy: - matrix: - # Use these Java versions - java: [ - 17, # Current Java LTS & minimum supported by Minecraft - ] - # and run on both Linux and Windows - os: [ubuntu-22.04, windows-2022] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: gradle/wrapper-validation-action@v2 + - name: setup jdk 21 + uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + java-version: 21 distribution: 'microsoft' - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: build run: ./gradlew build - name: capture build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts path: build/libs/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 41d4d2d..90698d5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' } @@ -11,7 +11,6 @@ base { } repositories { - maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } maven { url 'https://maven.nucleoid.xyz' } maven { url "https://api.modrinth.com/maven" } maven { url 'https://jitpack.io' } @@ -43,7 +42,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { @@ -52,8 +51,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index f56f8ac..673b1cc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,8 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=24w13a - -loader_version=0.15.7 +minecraft_version=1.20.5 +loader_version=0.15.10 # Mod Properties mod_version=1.0.0+1.20.5 @@ -15,9 +14,9 @@ archives_base_name=votelistener # Dependencies -fabric_version=0.96.12+1.20.5 +fabric_version=0.97.6+1.20.5 nuvotifier_version=2.7.2 -nuvotifier_fabric_version=1.0.0-1.20.4 -placeholder_api_version=2.3.0+1.20.3 -fabric_permission_api_version=0.3-SNAPSHOT -vanish_version=1.5.1+1.20.4 +nuvotifier_fabric_version=1.0.0-1.20.5 +placeholder_api_version=2.4.0-pre.1+1.20.5 +fabric_permission_api_version=0.3.1 +vanish_version=1.5.3+1.20.5 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac72c34..b82aa23 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.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/me/drex/votelistener/VoteListener.java b/src/main/java/me/drex/votelistener/VoteListener.java index 7fd877e..57cb2a2 100644 --- a/src/main/java/me/drex/votelistener/VoteListener.java +++ b/src/main/java/me/drex/votelistener/VoteListener.java @@ -55,6 +55,7 @@ public void onInitializeServer() { loadData(server); VoteListener.server = server; }); + ServerLifecycleEvents.AFTER_SAVE.register((server, flush, force) -> saveData(server)); CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> Commands.register(dispatcher)); ServerTickEvents.START_SERVER_TICK.register(VoteListener::onTick); com.vexsoftware.votifier.fabric.event.VoteListener.EVENT.register(VoteListener::onVote); diff --git a/src/main/java/me/drex/votelistener/mixin/MinecraftServerMixin.java b/src/main/java/me/drex/votelistener/mixin/MinecraftServerMixin.java deleted file mode 100644 index bde9113..0000000 --- a/src/main/java/me/drex/votelistener/mixin/MinecraftServerMixin.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.drex.votelistener.mixin; - -import me.drex.votelistener.VoteListener; -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.CallbackInfoReturnable; - -@Mixin(MinecraftServer.class) -public abstract class MinecraftServerMixin { - - @Inject( - method = "saveEverything", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/players/PlayerList;saveAll()V" - ) - ) - private void saveVoteData(boolean bl, boolean bl2, boolean bl3, CallbackInfoReturnable cir) { - VoteListener.saveData((MinecraftServer) (Object) this); - } - -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cf1288c..d475706 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -14,12 +14,9 @@ "me.drex.votelistener.VoteListener" ] }, - "mixins": [ - "votelistener.mixins.json" - ], "depends": { - "fabricloader": ">=0.15.6", - "java": ">=17", + "fabricloader": ">=0.15.10", + "java": ">=21", "nuvotifier-fabric": "*", "fabric-api": "*" } diff --git a/src/main/resources/votelistener.mixins.json b/src/main/resources/votelistener.mixins.json deleted file mode 100644 index 2f5db1a..0000000 --- a/src/main/resources/votelistener.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "me.drex.votelistener.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "MinecraftServerMixin" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file