diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..097f9f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d657f37 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +# 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: + runs-on: ubuntu-24.04 + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v4 + - name: setup jdk + uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'microsoft' + - name: make gradle wrapper executable + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: capture build artifacts + uses: actions/upload-artifact@v4 + with: + name: Artifacts + path: build/libs/ diff --git a/.gitignore b/.gitignore index 13b8dfd..c476faf 100644 --- a/.gitignore +++ b/.gitignore @@ -31,16 +31,6 @@ bin/ # fabric run/ -logs/ -crash-reports/ -world/ -server.properties -eula.txt -usercache.json -banned-ips.json -banned-players.json -ops.json -whitelist.json # java @@ -48,4 +38,3 @@ hs_err_*.log replay_*.log *.hprof *.jfr -*.log \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1625c17 --- /dev/null +++ b/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. \ No newline at end of file diff --git a/build.gradle b/build.gradle index d74800c..6b973b3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,69 +1,100 @@ plugins { - id 'net.fabricmc.fabric-loom-remap' version "${loom_version}" - id 'maven-publish' + id 'net.fabricmc.fabric-loom' version "${loom_version}" + id 'maven-publish' } version = project.mod_version group = project.maven_group base { - archivesName = project.archives_base_name + "-mc" + project.minecraft_version + archivesName = project.archives_base_name + "-mc" + project.minecraft_version } repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. } loom { - splitEnvironmentSourceSets() - - mods { - "simplefabriccustomskin" { - sourceSet sourceSets.main - sourceSet sourceSets.client - } - } + splitEnvironmentSourceSets() + + mods { + "simple-fabric-custom-skin" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + } fabricApi { - configureTests { - createSourceSet = true - modId = "simplefabriccustomskin-gametest" - enableGameTests = true - eula = true - clearRunDirectory = true - } + configureTests { + createSourceSet = true + modId = "simple-fabric-custom-skin-gametest" + enableGameTests = true + eula = true + clearRunDirectory = true + } } dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + + implementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Fabric API. This is technically optional, but you probably want it anyway. + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" + } processResources { - inputs.property "version", project.version + inputs.property "version", project.version - filesMatching("fabric.mod.json") { - expand "version": inputs.properties.version - } + filesMatching("fabric.mod.json") { + expand "version": inputs.properties.version + } } tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 25 } java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - repositories { - } +jar { + inputs.property "archivesName", project.base.archivesName + + from("LICENSE") { + rename { "${it}_${inputs.properties.archivesName}"} + } } + +// configure the maven publication +publishing { + publications { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index daba89c..9437ff3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,20 @@ +# Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true + +# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349 org.gradle.configuration-cache=false -minecraft_version=1.21.11 -loader_version=0.18.4 -loom_version=1.15.5 +# Fabric Properties +# check these on https://fabricmc.net/develop +minecraft_version=26.1 +loader_version=0.18.5 +loom_version=1.15-SNAPSHOT -mod_version=1.0.0 -maven_group=com.gmail.anthony17j -archives_base_name=SimpleFabricCustomSkin +# Mod Properties +mod_version=1.0.1 +maven_group=fr.jeanney +archives_base_name=simple-fabric-custom-skin -fabric_version=0.141.3+1.21.11 +# Dependencies +fabric_api_version=0.144.3+26.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f8e1ee3..61285a6 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 23449a2..19a6bde 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-9.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1b05573..adff685 100755 --- a/gradlew +++ b/gradlew @@ -245,4 +245,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" \ No newline at end of file +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 53e45d3..c4bdd3a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -90,4 +90,4 @@ exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal -:omega \ No newline at end of file +:omega diff --git a/settings.gradle b/settings.gradle index b02216b..75c4d72 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,10 @@ pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - mavenCentral() - gradlePluginPortal() - } -} + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} \ No newline at end of file diff --git a/src/gametest/java/com/gmail/anthony17j/simplefabriccustomskin/test/SkinCommandGameTest.java b/src/gametest/java/fr/jeanney/SkinCommandGameTest.java similarity index 97% rename from src/gametest/java/com/gmail/anthony17j/simplefabriccustomskin/test/SkinCommandGameTest.java rename to src/gametest/java/fr/jeanney/SkinCommandGameTest.java index 8c5124d..1696368 100644 --- a/src/gametest/java/com/gmail/anthony17j/simplefabriccustomskin/test/SkinCommandGameTest.java +++ b/src/gametest/java/fr/jeanney/SkinCommandGameTest.java @@ -1,7 +1,7 @@ -package com.gmail.anthony17j.simplefabriccustomskin.test; +package fr.jeanney; -import com.gmail.anthony17j.simplefabriccustomskin.mixin.PlayerAccessor; -import com.gmail.anthony17j.simplefabriccustomskin.skin.SkinManager; +import fr.jeanney.mixin.PlayerAccessor; +import fr.jeanney.skin.SkinManager; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import io.netty.channel.embedded.EmbeddedChannel; diff --git a/src/gametest/resources/fabric.mod.json b/src/gametest/resources/fabric.mod.json index 976e055..6f441c2 100644 --- a/src/gametest/resources/fabric.mod.json +++ b/src/gametest/resources/fabric.mod.json @@ -1,15 +1,15 @@ { "schemaVersion": 1, - "id": "simplefabriccustomskin-gametest", + "id": "simple-fabric-custom-skin-gametest", "version": "1.0.0", - "name": "SimpleFabricCustomSkin GameTest", + "name": "Simple Fabric Custom Skin GameTest", "environment": "*", "entrypoints": { "fabric-gametest": [ - "com.gmail.anthony17j.simplefabriccustomskin.test.SkinCommandGameTest" + "fr.jeanney.SkinCommandGameTest" ] }, "depends": { - "simplefabriccustomskin": "*" + "simple-fabric-custom-skin": "*" } } diff --git a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/SimpleFabricCustomSkin.java b/src/main/java/fr/jeanney/SimpleFabricCustomSkin.java similarity index 81% rename from src/main/java/com/gmail/anthony17j/simplefabriccustomskin/SimpleFabricCustomSkin.java rename to src/main/java/fr/jeanney/SimpleFabricCustomSkin.java index 62b4f4b..c390c6e 100644 --- a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/SimpleFabricCustomSkin.java +++ b/src/main/java/fr/jeanney/SimpleFabricCustomSkin.java @@ -1,7 +1,7 @@ -package com.gmail.anthony17j.simplefabriccustomskin; +package fr.jeanney; -import com.gmail.anthony17j.simplefabriccustomskin.command.SkinCommand; -import com.gmail.anthony17j.simplefabriccustomskin.skin.SkinManager; +import fr.jeanney.command.SkinCommand; +import fr.jeanney.skin.SkinManager; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; diff --git a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/command/SkinCommand.java b/src/main/java/fr/jeanney/command/SkinCommand.java similarity index 96% rename from src/main/java/com/gmail/anthony17j/simplefabriccustomskin/command/SkinCommand.java rename to src/main/java/fr/jeanney/command/SkinCommand.java index 7d41bb2..c20c610 100644 --- a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/command/SkinCommand.java +++ b/src/main/java/fr/jeanney/command/SkinCommand.java @@ -1,6 +1,6 @@ -package com.gmail.anthony17j.simplefabriccustomskin.command; +package fr.jeanney.command; -import com.gmail.anthony17j.simplefabriccustomskin.skin.SkinManager; +import fr.jeanney.skin.SkinManager; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import net.minecraft.commands.CommandBuildContext; diff --git a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/mixin/PlayerAccessor.java b/src/main/java/fr/jeanney/mixin/PlayerAccessor.java similarity index 87% rename from src/main/java/com/gmail/anthony17j/simplefabriccustomskin/mixin/PlayerAccessor.java rename to src/main/java/fr/jeanney/mixin/PlayerAccessor.java index fbb65e5..3ccc32c 100644 --- a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/mixin/PlayerAccessor.java +++ b/src/main/java/fr/jeanney/mixin/PlayerAccessor.java @@ -1,4 +1,4 @@ -package com.gmail.anthony17j.simplefabriccustomskin.mixin; +package fr.jeanney.mixin; import com.mojang.authlib.GameProfile; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/skin/SkinManager.java b/src/main/java/fr/jeanney/skin/SkinManager.java similarity index 98% rename from src/main/java/com/gmail/anthony17j/simplefabriccustomskin/skin/SkinManager.java rename to src/main/java/fr/jeanney/skin/SkinManager.java index 05e0842..28ab5f1 100644 --- a/src/main/java/com/gmail/anthony17j/simplefabriccustomskin/skin/SkinManager.java +++ b/src/main/java/fr/jeanney/skin/SkinManager.java @@ -1,7 +1,7 @@ -package com.gmail.anthony17j.simplefabriccustomskin.skin; +package fr.jeanney.skin; -import com.gmail.anthony17j.simplefabriccustomskin.SimpleFabricCustomSkin; -import com.gmail.anthony17j.simplefabriccustomskin.mixin.PlayerAccessor; +import fr.jeanney.SimpleFabricCustomSkin; +import fr.jeanney.mixin.PlayerAccessor; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.google.gson.Gson; @@ -29,7 +29,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Type; -import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.HttpURLConnection; @@ -37,7 +36,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Base64; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/src/main/resources/assets/simple-fabric-custom-skin/icon.png b/src/main/resources/assets/simple-fabric-custom-skin/icon.png new file mode 100644 index 0000000..c72ecc5 Binary files /dev/null and b/src/main/resources/assets/simple-fabric-custom-skin/icon.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8fcc77d..f37741d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,23 +1,31 @@ { - "schemaVersion": 1, - "id": "simplefabriccustomskin", - "version": "${version}", - "name": "SimpleFabricCustomSkin", - "description": "Simple server skin assignment from local skins folder.", - "authors": ["anthony17j"], - "environment": "server", - "entrypoints": { - "main": [ - "com.gmail.anthony17j.simplefabriccustomskin.SimpleFabricCustomSkin" - ] - }, - "mixins": [ - "simplefabriccustomskin.mixins.json" - ], - "depends": { - "fabricloader": ">=0.18.0", - "minecraft": "~1.21.11", - "java": ">=21", - "fabric-api": "*" - } -} + "schemaVersion": 1, + "id": "simple-fabric-custom-skin", + "version": "${version}", + "name": "Simple Fabric Custom Skin", + "description": "Simple server skin assignment from local skins folder", + "authors": [ + "Uxzylon" + ], + "contact": { + "homepage": "https://anthony.jeanney.fr/", + "sources": "https://github.com/Uxzylon/SimpleFabricCustomSkin" + }, + "license": "CC0-1.0", + "icon": "assets/simple-fabric-custom-skin/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "fr.jeanney.SimpleFabricCustomSkin" + ] + }, + "mixins": [ + "simple-fabric-custom-skin.mixins.json" + ], + "depends": { + "fabricloader": ">=0.18.5", + "minecraft": "~26.1", + "java": ">=25", + "fabric-api": "*" + } +} \ No newline at end of file diff --git a/src/main/resources/simple-fabric-custom-skin.mixins.json b/src/main/resources/simple-fabric-custom-skin.mixins.json new file mode 100644 index 0000000..decf904 --- /dev/null +++ b/src/main/resources/simple-fabric-custom-skin.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "package": "fr.jeanney.mixin", + "compatibilityLevel": "JAVA_25", + "mixins": [ + "PlayerAccessor" + ], + "injectors": { + "defaultRequire": 1 + }, + "overwrites": { + "requireAnnotations": true + } +} \ No newline at end of file diff --git a/src/main/resources/simplefabriccustomskin.mixins.json b/src/main/resources/simplefabriccustomskin.mixins.json deleted file mode 100644 index 92115f5..0000000 --- a/src/main/resources/simplefabriccustomskin.mixins.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "com.gmail.anthony17j.simplefabriccustomskin.mixin", - "compatibilityLevel": "JAVA_21", - "mixins": [ - "PlayerAccessor" - ], - "injectors": { - "defaultRequire": 1 - } -}