From a554b8f14911ce3b707954d1f35964d0dbaf02ea Mon Sep 17 00:00:00 2001 From: Aizistral Date: Sat, 18 Jun 2022 19:45:34 +0200 Subject: Configure publishing --- README.md | 9 --- build.gradle | 93 +++++++++++++++------- docs/README.md | 9 +++ docs/changelog.html | 6 ++ gradle.properties | 21 ++--- .../com/aizistral/nochatreports/NoChatReports.java | 4 +- .../nochatreports/NoChatReportsClient.java | 3 +- .../resources/assets/nochatreports/lang/en_us.json | 3 +- 8 files changed, 95 insertions(+), 53 deletions(-) delete mode 100644 README.md create mode 100644 docs/README.md create mode 100644 docs/changelog.html diff --git a/README.md b/README.md deleted file mode 100644 index 92fe8f4..0000000 --- a/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# No Chat Reports - -**Current Version:** 1.19-v1.0.0 - -**Minecraft Version:** 1.19.x - -**Forge Version:** 41.0.0 or later. - -Strips cryptographic signatures from player messages, making it impossible to track and associate them with your Mojang/Microsoft account, as well as use Player Chat Reporting feature. \ No newline at end of file diff --git a/build.gradle b/build.gradle index b027b04..e2be0a7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ plugins { id 'fabric-loom' version '0.12-SNAPSHOT' id 'maven-publish' + id "com.modrinth.minotaur" version "2.+" + id "com.matthewprenger.cursegradle" version "1.+" } sourceCompatibility = JavaVersion.VERSION_17 @@ -11,26 +13,14 @@ version = project.mod_version group = project.maven_group 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. + // So far none... } dependencies { - // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - - // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - - // Uncomment the following line to enable the deprecated Fabric API modules. - // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. - - // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" } processResources { @@ -42,36 +32,79 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 17 } java { - // 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() } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + // NO-OP } } -// configure the maven publication -publishing { - publications { - mavenJava(MavenPublication) { - from components.java +curseforge { + + project { + println("Pushing CurseGradle specifications for project ID: ${curse_id}") + + // Specified as cmd argument + apiKey = findProperty('curseKey') ?: 0 + + id = "${curse_id}" + releaseType = "${curse_release}" + changelogType = 'html' + changelog = file('docs/changelog.html') + mainArtifact(remapJar) + + addGameVersion '1.19' + addGameVersion 'Fabric' + addGameVersion 'Java 17' + + relations { + requiredLibrary 'fabric-api' + } + + afterEvaluate { + uploadTask.dependsOn(remapJar) } + + //debug = true + //addArtifact(sourcesJar) + //addArtifact(apiJar) + } + + options { + forgeGradleIntegration = false } +} - // 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. - } +modrinth { + token = findProperty('modrinthKey') ?: 0 + projectId = "qQyHxfxd" + versionNumber = project.mod_version + versionName = "No Chat Reports Fabric-" + project.mod_version + versionType = "release" + changelog = rootProject.file("docs/changelog.html").text + uploadFile = remapJar + gameVersions = ["1.19"] + loaders = ['fabric'] + + dependencies { + // The scope can be `required`, `optional`, or `incompatible` + required.project "P7dR8mSH" + } + + //syncBodyFrom = rootProject.file("docs/README.md").text } + +afterEvaluate { + upload.dependsOn(remapJar) +} + +task upload { + dependsOn('modrinth') + dependsOn('curseforge') +} \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..92fe8f4 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,9 @@ +# No Chat Reports + +**Current Version:** 1.19-v1.0.0 + +**Minecraft Version:** 1.19.x + +**Forge Version:** 41.0.0 or later. + +Strips cryptographic signatures from player messages, making it impossible to track and associate them with your Mojang/Microsoft account, as well as use Player Chat Reporting feature. \ No newline at end of file diff --git a/docs/changelog.html b/docs/changelog.html new file mode 100644 index 0000000..bd11633 --- /dev/null +++ b/docs/changelog.html @@ -0,0 +1,6 @@ +
+ - Initial release. +
diff --git a/gradle.properties b/gradle.properties index eb4ea09..43cd9ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,17 +2,20 @@ org.gradle.jvmargs=-Xmx2G org.gradle.daemon=false - # Fabric Properties - # check these on https://fabricmc.net/develop - minecraft_version=1.19 - yarn_mappings=1.19+build.4 - loader_version=0.14.8 +# check these on https://fabricmc.net/develop +minecraft_version=1.19 +yarn_mappings=1.19+build.4 +loader_version=0.14.8 # Mod Properties - mod_version=FABRIC-v1.0.0 - maven_group=com.aizistral.nochatreports - archives_base_name=NoChatReports +mod_version=1.19-v1.0.0 +maven_group=com.aizistral.nochatreports +archives_base_name=NoChatReports-FABRIC # Dependencies - fabric_version=0.56.0+1.19 +fabric_version=0.56.0+1.19 + +# Publishing +curse_id=634062 +curse_release=release \ No newline at end of file diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReports.java b/src/main/java/com/aizistral/nochatreports/NoChatReports.java index d45c5e8..dc4d17d 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReports.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReports.java @@ -33,8 +33,8 @@ public class NoChatReports implements ModInitializer { private void onPlayReady(ServerGamePacketListenerImpl handler, PacketSender sender, MinecraftServer server) { server.execute(() -> { - if (!ServerPlayNetworking.canSend(handler, CHANNEL)) { - handler.disconnect(Component.translatable("disconnect.nochatreports.server")); + if (NoReportsConfig.demandsOnClient() && !ServerPlayNetworking.canSend(handler, CHANNEL)) { + handler.disconnect(Component.literal("You do not have No Chat Reports, and this server is configured to require it on client!")); } }); } diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java index 3899a5c..075b460 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java @@ -1,5 +1,6 @@ package com.aizistral.nochatreports; +import com.aizistral.nochatreports.handlers.NoReportsConfig; import com.aizistral.nochatreports.network.ClientChannelHandler; import com.aizistral.nochatreports.network.ServerChannelHandler; @@ -26,7 +27,7 @@ public class NoChatReportsClient implements ClientModInitializer { private void onPlayReady(ClientPacketListener handler, PacketSender sender, Minecraft client) { client.execute(() -> { - if (!ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { + if (NoReportsConfig.demandsOnServer() && !ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { handler.getConnection().disconnect(Component.translatable("disconnect.nochatreports.client")); } }); diff --git a/src/main/resources/assets/nochatreports/lang/en_us.json b/src/main/resources/assets/nochatreports/lang/en_us.json index 19fed74..d1ff40d 100644 --- a/src/main/resources/assets/nochatreports/lang/en_us.json +++ b/src/main/resources/assets/nochatreports/lang/en_us.json @@ -1,5 +1,4 @@ { "gui.nochatreport.secureChat": "This option cannot work with No Chat Reports, since there are no signatures to verify.", - "disconnect.nochatreports.client": "This server does not have No Chat Reports, and you have it configured to require itself on server.", - "disconnect.nochatreports.server": "You do not have No Chat Reports, and this server is configured to require it on client!" + "disconnect.nochatreports.client": "This server does not have No Chat Reports, and you have it configured to require itself on server." } \ No newline at end of file -- cgit v1.2.3