Skip to content

Commit

Permalink
add bstats and add spotless to build-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
powercasgamer committed Nov 28, 2023
1 parent 9ba8541 commit 3ead2fa
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 7 deletions.
23 changes: 22 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import com.diffplug.gradle.spotless.FormatExtension

plugins {
`kotlin-dsl`
alias(libs.plugins.spotless)
}

repositories {
Expand Down Expand Up @@ -35,4 +38,22 @@ kotlin {
}
}
}
}
}

spotless {
fun FormatExtension.applyCommon() {
trimTrailingWhitespace()
endWithNewline()
encoding("UTF-8")
toggleOffOn()
target("*.gradle.kts")
}
kotlinGradle {
applyCommon()
ktlint("1.0.1")
}
kotlin {
applyCommon()
ktlint("1.0.1")
}
}
6 changes: 5 additions & 1 deletion build-logic/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import com.diffplug.gradle.spotless.FormatExtension
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import net.kyori.indra.licenser.spotless.HeaderFormat
import java.util.*
import java.util.Calendar
import java.util.Date

plugins {
id("base-conventions")
Expand Down Expand Up @@ -90,6 +91,9 @@ tasks {
archiveClassifier.set("")
mergeServiceFiles()
transform(Log4j2PluginsCacheFileTransformer::class.java)

relocate("xyz.jpenilla.gremlin", "dev.mizule.timetriggeredperms.lib.xyz.jpenilla.gremlin")
relocate("org.bstats", "dev.mizule.timetriggeredperms.lib.org.bstats")
}

withType<JavaCompile>().configureEach {
Expand Down
2 changes: 2 additions & 0 deletions build-logic/src/main/kotlin/ext.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint")

import net.kyori.indra.git.IndraGitExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
Expand Down
5 changes: 0 additions & 5 deletions build-logic/src/main/kotlin/paper-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ tasks {
named("clean", Delete::class) {
delete(project.projectDir.resolve("run"))
}


shadowJar {
relocate("xyz.jpenilla.gremlin", "dev.mizule.timetriggeredperms.lib.xyz.jpenilla.gremlin")
}
}

hangarPublish {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ hangar-publish = { module = "io.papermc:hangar-publish-plugin", version.ref = "h

[plugins]
gremlin-gradle = { id = "xyz.jpenilla.gremlin-gradle", version.ref = "gremlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }

[versions]
indra = "3.1.3"
Expand All @@ -26,3 +27,4 @@ gremlin = "0.0.3"
idea-gradle = "1.1.7"
run-task = "2.2.2"
hangar-publish = "0.1.0"
spotless = "6.23.0"
1 change: 1 addition & 0 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies {
runtimeDownloadOnlyApi(kotlin("reflect"))
runtimeDownloadOnlyApi("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT")
runtimeDownloadOnlyApi("org.spongepowered:configurate-extra-kotlin:4.2.0-SNAPSHOT")
implementation("org.bstats:bstats-bukkit:3.0.2")
}

applyJarMetadata("timetriggeredperms-paper")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import dev.mizule.timetriggeredperms.core.TTPPlugin
import dev.mizule.timetriggeredperms.core.config.Config
import dev.mizule.timetriggeredperms.paper.command.ReloadCommand
import dev.mizule.timetriggeredperms.paper.listener.LuckPermsListener
import org.bstats.bukkit.Metrics
import org.bukkit.Bukkit
import org.bukkit.plugin.java.JavaPlugin
import org.spongepowered.configurate.kotlin.extensions.get
Expand All @@ -38,6 +39,7 @@ import org.spongepowered.configurate.yaml.YamlConfigurationLoader
class TTP : JavaPlugin(), TTPPlugin<JavaPlugin> {

private val configPath = dataFolder.resolve("permissions.yml")
private val pluginId = 20404

val configLoader = YamlConfigurationLoader.builder()
.file(configPath)
Expand All @@ -61,6 +63,7 @@ class TTP : JavaPlugin(), TTPPlugin<JavaPlugin> {
configNode.set(config) // update the backing node to add defaults
configLoader.save(configNode)
}
Metrics(this, pluginId)
LuckPermsListener(this)

Bukkit.getCommandMap().register("timetriggeredperms", ReloadCommand(this))
Expand Down

0 comments on commit 3ead2fa

Please sign in to comment.