diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ede2ea32..8c34ec6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,15 +53,19 @@ jobs: changelog: ${{ github.event.head_commit.message }} distro-names: | paper + fabric-1.21.1 fabric-1.21.4 distro-groups: | paper fabric + fabric distro-descriptions: | Paper + Fabric 1.21.1 Fabric 1.21.4 files: | target/HuskHomes-Paper-${{ env.version_name }}.jar + target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.1.jar target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.4.jar - name: 'Spigot: Publish to Modrinth & Hangar 🚰' uses: WiIIiam278/mc-publish@hangar @@ -108,7 +112,35 @@ jobs: 1.21.2 1.21.4 java: 17 - - name: 'Fabric: Publish to Modrinth & CurseForge 🧵' + - name: 'Fabric 1.21.1: Publish to Modrinth & CurseForge 🧵' + uses: WiIIiam278/mc-publish@hangar + if: success() || failure() + with: + modrinth-id: J6U9o3JG + modrinth-featured: false + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + curseforge-id: 849217 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + dependencies: | + fabric-api | requires | * + dynmap | suggests | * + bluemap | suggests | * + pl3xmap | suggests | * + luckperms | suggests | * + plan | suggests | * + impactor | suggests | * + placeholder-api | suggests | * + files-primary: target/HuskHomes-Fabric-${{ env.version_name }}+mc.1.21.1.jar + name: HuskHomes (Fabric) v${{ env.version_name }} + version: ${{ env.version_name }} + version-type: alpha + changelog: ${{ github.event.head_commit.message }} + loaders: | + fabric + game-versions: | + 1.21.1 + java: 21 + - name: 'Fabric 1.21.4: Publish to Modrinth & CurseForge 🧵' uses: WiIIiam278/mc-publish@hangar if: success() || failure() with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42bf4c0b..d0c33830 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,15 +42,19 @@ jobs: changelog: ${{ github.event.release.body }} distro-names: | paper + fabric-1.21.1 fabric-1.21.4 distro-groups: | paper fabric + fabric distro-descriptions: | Paper + Fabric 1.21.1 Fabric 1.21.4 files: | target/HuskHomes-Paper-${{ github.event.release.tag_name }}.jar + target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.1.jar target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.4.jar - name: 'Spigot: Publish to Modrinth & Hangar 🚰' uses: WiIIiam278/mc-publish@hangar @@ -96,7 +100,34 @@ jobs: 1.21.2 1.21.4 java: 17 - - name: 'Fabric: Publish to Modrinth & CurseForge 🧵' + - name: 'Fabric 1.21.1: Publish to Modrinth & CurseForge 🧵' + uses: WiIIiam278/mc-publish@hangar + with: + modrinth-id: J6U9o3JG + modrinth-featured: false + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + curseforge-id: 849217 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + dependencies: | + fabric-api | requires | * + dynmap | suggests | * + bluemap | suggests | * + pl3xmap | suggests | * + luckperms | suggests | * + plan | suggests | * + impactor | suggests | * + placeholder-api | suggests | * + files-primary: target/HuskHomes-Fabric-${{ github.event.release.tag_name }}+mc.1.21.1.jar + name: HuskHomes (Fabric) v${{ github.event.release.tag_name }} + version: ${{ github.event.release.tag_name }} + version-type: release + changelog: ${{ github.event.release.body }} + loaders: | + fabric + game-versions: | + 1.21.1 + java: 21 + - name: 'Fabric 1.21.4: Publish to Modrinth & CurseForge 🧵' uses: WiIIiam278/mc-publish@hangar with: modrinth-id: J6U9o3JG diff --git a/README.md b/README.md index 7cca18ca..105ba1a8 100644 --- a/README.md +++ b/README.md @@ -69,4 +69,4 @@ Translations of the plugin locales are welcome to help make the plugin more acce - [bStats](https://bstats.org/plugin/bukkit/HuskHomes/8430) — View plugin metrics --- -© [William278](https://william278.net/), 2023. Licensed under the Apache-2.0 License. +© [William278](https://william278.net/), 2025. Licensed under the Apache-2.0 License. diff --git a/build.gradle b/build.gradle index ec867e3c..559c6fec 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id 'io.github.goooler.shadow' version '8.1.8' id 'org.cadixdev.licenser' version '0.6.1' apply false id 'fabric-loom' version "$fabric_loom_version" apply false + id 'gg.essential.multi-version.root' apply false id 'org.ajoberstar.grgit' version '5.3.0' id 'maven-publish' id 'java' @@ -57,6 +58,10 @@ publishing { } allprojects { + if (project.name == 'fabric') { + return + } + apply plugin: 'io.github.goooler.shadow' apply plugin: 'org.cadixdev.licenser' apply plugin: 'java' @@ -90,7 +95,6 @@ allprojects { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.4' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.4' - testCompileOnly 'org.jetbrains:annotations:26.0.1' } @@ -113,14 +117,26 @@ allprojects { } subprojects { + // Ignore root fabric project (no jars) + if (project.name == 'fabric') { + return + } + + // Project naming version rootProject.version - archivesBaseName = "${rootProject.name}-${project.name.capitalize()}" + def name = "$rootProject.name" + if (rootProject != project.parent) { + name += "-${project.parent.name.capitalize()}" + } else { + name += "-${project.name.capitalize()}" + } + archivesBaseName = name // Fabric-specific configuration - if (['fabric'].contains(project.name)) { + if (project.parent?.name?.equals('fabric')) { apply plugin: 'fabric-loom' compileJava.options.release.set 21 - version += "+mc.${fabric_minecraft_version}" + version += "+mc.${project.name}" } jar { @@ -133,7 +149,7 @@ subprojects { } // API publishing - if (['common', 'bukkit', 'fabric'].contains(project.name)) { + if (['common', 'bukkit'].contains(project.name) || project.parent?.name?.equals('fabric')) { java { withSourcesJar() withJavadocJar() @@ -173,12 +189,12 @@ subprojects { } } - if (['fabric'].contains(project.name)) { + if (project.parent?.name?.equals('fabric')) { publications { - mavenJavaFabric(MavenPublication) { + "mavenJavaFabric_${project.name.replace('.', '_')}"(MavenPublication) { groupId = 'net.william278.huskhomes' artifactId = 'huskhomes-fabric' - version = "$rootProject.version+${fabric_minecraft_version}" + version = "$rootProject.version+$project.name" artifact remapJar artifact sourcesJar artifact javadocJar diff --git a/fabric/1.21.1/.gitkeep b/fabric/1.21.1/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/fabric/1.21.1/gradle.properties b/fabric/1.21.1/gradle.properties new file mode 100644 index 00000000..cfabefa3 --- /dev/null +++ b/fabric/1.21.1/gradle.properties @@ -0,0 +1,8 @@ +essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.1+build.3:v2 + +fabric_loader_version=0.16.9 +fabric_api_version=0.114.0+1.21.1 +fabric_permissions_api_version=0.3.1 +fabric_adventure_platform_version=5.14.1 +fabric_impactor_api_version=5.3.0 +fabric_placeholder_api_version=2.4.1+1.21 \ No newline at end of file diff --git a/fabric/1.21.4/.gitkeep b/fabric/1.21.4/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/fabric/1.21.4/gradle.properties b/fabric/1.21.4/gradle.properties new file mode 100644 index 00000000..4cd74ab9 --- /dev/null +++ b/fabric/1.21.4/gradle.properties @@ -0,0 +1,8 @@ +essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.4+build.4:v2 + +fabric_loader_version=0.16.9 +fabric_api_version=0.113.0+1.21.4 +fabric_permissions_api_version=0.3.3 +fabric_adventure_platform_version=6.2.0 +fabric_impactor_api_version=5.3.0 +fabric_placeholder_api_version=2.5.1+1.21.3 \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 0c543dbf..63a9ee2f 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,8 +1,8 @@ plugins { - id 'fabric-loom' version "$fabric_loom_version" + id 'gg.essential.multi-version' + id 'gg.essential.defaults' } -apply plugin: 'fabric-loom' loom.serverOnlyMinecraftJar() repositories { @@ -12,21 +12,17 @@ repositories { } dependencies { - minecraft "com.mojang:minecraft:${fabric_minecraft_version}" - mappings "net.fabricmc:yarn:${fabric_yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" - modImplementation include("net.kyori:adventure-platform-fabric:${fabric_adventure_platform_version}") modImplementation include("me.lucko:fabric-permissions-api:${fabric_permissions_api_version}") modImplementation include("eu.pb4:placeholder-api:${fabric_placeholder_api_version}") modImplementation include("net.impactdev.impactor.api:economy:${fabric_impactor_api_version}") - modCompileOnly "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" implementation include('org.apache.commons:commons-pool2:2.12.0') - implementation include("redis.clients:jedis:$jedis_version") + implementation include("org.xerial:sqlite-jdbc:$sqlite_driver_version") implementation include("com.mysql:mysql-connector-j:$mysql_driver_version") implementation include("org.mariadb.jdbc:mariadb-java-client:$mariadb_driver_version") - implementation include("org.xerial:sqlite-jdbc:$sqlite_driver_version") + implementation include("redis.clients:jedis:$jedis_version") implementation include("com.h2database:h2:$h2_driver_version") compileOnly 'org.jetbrains:annotations:26.0.1' @@ -34,7 +30,23 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.36' - shadow project(path: ":common") + implementation include(project(path: ":common")) + project(":common").configurations.api.dependencies.each { dependency -> + if (dependency.name in ['cloplib-common', 'gson']) { // skip because it already exists (e.g. in cloplib-fabric) + return + } + include(dependency) + } +} + +processResources { + filesMatching(Arrays.asList("fabric.mod.json")) { + expand([ + version: version, + fabric_loader_version: fabric_loader_version, + fabric_minecraft_version: project.name, + ]) + } } shadowJar { @@ -44,19 +56,6 @@ shadowJar { exclude('net.fabricmc:.*') exclude('net.kyori:.*') exclude '/mappings/*' - - relocate 'org.apache.commons.io', 'net.william278.huskhomes.libraries.commons.io' - relocate 'org.apache.commons.text', 'net.william278.huskhomes.libraries.commons.text' - relocate 'org.apache.commons.lang3', 'net.william278.huskhomes.libraries.commons.lang3' - relocate 'de.themoep', 'net.william278.huskhomes.libraries' - relocate 'org.jetbrains', 'net.william278.huskhomes.libraries' - relocate 'org.intellij', 'net.william278.huskhomes.libraries' - relocate 'com.zaxxer', 'net.william278.huskhomes.libraries' - relocate 'net.william278.paginedown', 'net.william278.huskhomes.libraries.paginedown' - relocate 'net.william278.desertwell', 'net.william278.huskhomes.libraries.desertwell' - relocate 'de.exlll', 'net.william278.huskhomes.libraries' - relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml' - relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson' } remapJar { diff --git a/fabric/gradle.properties b/fabric/gradle.properties new file mode 100644 index 00000000..724004a4 --- /dev/null +++ b/fabric/gradle.properties @@ -0,0 +1,10 @@ +loom.platform=fabric + +essential.defaults.loom=1 +essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.16.9 + +org.gradle.daemon=false +org.gradle.parallel=true +org.gradle.configureoncommand=true +org.gradle.parallel.threads=4 +org.gradle.jvmargs=-Xmx8G \ No newline at end of file diff --git a/fabric/mainProject b/fabric/mainProject new file mode 100644 index 00000000..3d8ac637 --- /dev/null +++ b/fabric/mainProject @@ -0,0 +1 @@ +1.21.4 \ No newline at end of file diff --git a/fabric/root.gradle b/fabric/root.gradle new file mode 100644 index 00000000..c22a31fb --- /dev/null +++ b/fabric/root.gradle @@ -0,0 +1,11 @@ +plugins { + id("gg.essential.multi-version.root") +} + +preprocess { + def fabric12104 = createNode("1.21.4", 12104, "yarn") + def fabric12101 = createNode("1.21.1", 12101, "yarn") + + strictExtraMappings.set(true) + fabric12101.link(fabric12104, null) +} \ No newline at end of file diff --git a/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java index 886b4c46..e51bb205 100644 --- a/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java +++ b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java @@ -33,7 +33,11 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.kyori.adventure.audience.Audience; +//#if MC==12104 import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences; +//#else +//$$ import net.kyori.adventure.platform.fabric.FabricServerAudiences; +//#endif import net.minecraft.entity.Entity; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; @@ -95,8 +99,12 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes .orElseThrow(() -> new RuntimeException("Failed to get Mod Container")); private final Map permissions = Maps.newHashMap(); - private MinecraftServer minecraftServer; + //#if MC==12104 private MinecraftServerAudiences audiences; + //#else + //$$ private FabricServerAudiences audiences; + //#endif + private MinecraftServer minecraftServer; private final Set savedUsers = Sets.newHashSet(); private final Set currentlyOnWarmup = Sets.newConcurrentHashSet(); @@ -140,7 +148,11 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes private void onEnable(@NotNull MinecraftServer server) { this.minecraftServer = server; + //#if MC==12104 this.audiences = MinecraftServerAudiences.of(minecraftServer); + //#else + //$$ this.audiences = FabricServerAudiences.of(minecraftServer); + //#endif this.enable(); } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 3f21f4c8..d4a38a43 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ }, "depends": { "fabricloader": ">=${fabric_loader_version}", - "minecraft": ">=${fabric_minecraft_version}", + "minecraft": "${fabric_minecraft_version}", "fabric-api": "*" }, "suggests": { diff --git a/gradle.properties b/gradle.properties index 53f8813f..6d677772 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,12 +17,4 @@ h2_driver_version=2.3.232 postgresql_driver_version=42.7.4 # Fabric settings -fabric_loom_version=1.8-SNAPSHOT -fabric_minecraft_version=1.21.4 -fabric_loader_version=0.16.9 -fabric_yarn_mappings=1.21.4+build.2 -fabric_api_version=0.112.0+1.21.4 -fabric_permissions_api_version=0.3.3 -fabric_adventure_platform_version=6.1.0 -fabric_impactor_api_version=5.2.4-SNAPSHOT -fabric_placeholder_api_version=2.5.1+1.21.3 \ No newline at end of file +fabric_loom_version=1.9-SNAPSHOT \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9355b415..cea7a793 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.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf13..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30db..9d21a218 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/jitpack.yml b/jitpack.yml deleted file mode 100644 index 4668efae..00000000 --- a/jitpack.yml +++ /dev/null @@ -1,12 +0,0 @@ -# This file ensures jitpack builds HuskHomes correctly by setting the JDK to 17 -jdk: - - 'openjdk17' -before_install: - - 'git clone https://github.com/WiIIiam278/HuskHomes.git --recurse-submodules' - - 'chmod +x gradlew' - - 'chmod +x ./.scripts/ensure-java-17' - - 'bash ./.scripts/ensure-java-17 install' -install: - - 'if ! ./.scripts/ensure-java-17 use; then source ~/.sdkman/bin/sdkman-init.sh; fi' - - 'java -version' - - './gradlew publishToMavenLocal' \ No newline at end of file diff --git a/paper/build.gradle b/paper/build.gradle index 5ed0dc85..80ae71fe 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -48,7 +48,7 @@ tasks { minecraftVersion('1.21.4') downloadPlugins { - url("https://download.luckperms.net/1567/bukkit/loader/LuckPerms-Bukkit-5.4.150.jar") + url("https://download.luckperms.net/1569/bukkit/loader/LuckPerms-Bukkit-5.4.152.jar") } } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 9881f43e..0565f7d8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,6 +2,15 @@ pluginManagement { repositories { gradlePluginPortal() maven { url 'https://maven.fabricmc.net/' } + maven { url 'https://maven.architectury.dev/' } + maven { url 'https://maven.minecraftforge.net' } + maven { url 'https://repo.essential.gg/repository/maven-public' } + } + + plugins { + def egtVersion = "0.6.5" + id("gg.essential.defaults") version egtVersion + id("gg.essential.multi-version.root") version egtVersion } } @@ -12,7 +21,20 @@ include( // Paper/Spigot 'bukkit', 'paper', +) - // Fabric - 'fabric', -) \ No newline at end of file + +// Fabric +include("fabric") +project(":fabric").with { + projectDir = file("fabric/") + buildFileName = "root.gradle" +} + +file('fabric').listFiles((FileFilter) ((File file) -> file.isDirectory() && file.name ==~ /(\d+)\.(\d+)(\.(\d+))?/)).each { + include("fabric:$it.name") + project(":fabric:$it.name").with { + projectDir = file("fabric/${it.name}") + buildFileName = '../build.gradle' + } +} \ No newline at end of file