Skip to content

Commit

Permalink
Add new gradle task system for a single source of truth for the versi…
Browse files Browse the repository at this point in the history
…on number

It's now located at `gradle.properties` and automatically creates a new fabric config for each version change
  • Loading branch information
yogwoggf committed Apr 22, 2024
1 parent f2672ce commit 6b6a962
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
Expand Down Expand Up @@ -36,12 +37,19 @@ dependencies {
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
}

processResources {
inputs.property "version", project.version
tasks.register('updateFabricConfigAction', Copy) {
group = "fabric"
description = "Generates a new fabric.mod.json with tokens substituted from the values in gradle.properties"
inputs.property("version", project.version)

filesMatching("fabric.mod.json") {
expand "version": project.version
}
from layout.projectDirectory.file("src/main/resources/fabric.mod.template.json")
expand version: project.version
into layout.projectDirectory.dir("src/main/resources")
rename { "fabric.mod.json" }
}

tasks.named('processResources') {
dependsOn(tasks.updateFabricConfigAction)
}

tasks.withType(JavaCompile).configureEach {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.20.1+build.10
loader_version=0.15.9
fabric_kotlin_version=1.10.19+kotlin.1.9.23
# Mod Properties
mod_version=0.2.3
mod_version=0.2.4
maven_group=com.puffy
archives_base_name=puffy-anti-exploit
# Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/puffy/PuffyAntiExploit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object PuffyAntiExploit : ModInitializer {

DetectionEventEmitter.addListener("kick-on-detect") { (source, player) ->
logger.warn(
"Player ${player.name.string} has been kicked for sending significant amounts of unusual client activity to the server. (source: $source)"
"Player ${player.name.string} was kicked for sending significant amounts of unusual client activity to the server. (source: $source)"
)

player.disconnectForExploit(source)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "puffy-anti-exploit",
"version": "0.2.3",
"version": "0.2.4",
"name": "puffy-anti-exploit",
"description": "A server-side anti exploit which aims to reduce the possible amount of advantages a player can obtain with a hacked client. This mod does not attempt to ban such players, it only aims to fix certain parts of the server and gently counter these players.",
"authors": [
Expand Down

0 comments on commit 6b6a962

Please sign in to comment.