diff --git a/build-logic/src/main/kotlin/common-conventions.gradle.kts b/build-logic/src/main/kotlin/common-conventions.gradle.kts index b4e9759..ca32235 100644 --- a/build-logic/src/main/kotlin/common-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/common-conventions.gradle.kts @@ -99,7 +99,7 @@ tasks { } create("format") { - + dependsOn("spotlessApply") } withType().configureEach { diff --git a/build-logic/src/main/kotlin/task/ReleaseTask.kt b/build-logic/src/main/kotlin/task/ReleaseTask.kt deleted file mode 100644 index fb96efe..0000000 --- a/build-logic/src/main/kotlin/task/ReleaseTask.kt +++ /dev/null @@ -1,28 +0,0 @@ -import net.kyori.indra.git.IndraGitExtension -import net.kyori.indra.git.internal.IndraGitExtensionImpl -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.TaskAction - -open class ReleaseTask : DefaultTask() { - - @TaskAction - fun release() { - val git = project.extensions.findByType(IndraGitExtension::class.java)?.git()?: return - - val currentVersion = project.versionString() - - val projectName = project.providers.gradleProperty("projectName").orElse(project.nameString(false)) - - val versionNoSnapshot = currentVersion.replace("-SNAPSHOT", "", ignoreCase = true) - - // set version without snapshot in properties file - project.rootProject.file("gradle.properties").writeText( - project.rootProject.file("gradle.properties").readText().replaceFirst("-SNAPSHOT$", "") - ) - project.version = versionNoSnapshot - - git.add().addFilepattern("gradle.properties").call() - git.commit().setMessage("release: $versionNoSnapshot").call() - - } -} \ No newline at end of file diff --git a/core/src/main/kotlin/dev/mizule/timetriggeredperms/core/config/ConfigManager.kt b/core/src/main/kotlin/dev/mizule/timetriggeredperms/core/config/ConfigManager.kt index b9c6ce2..9061e63 100644 --- a/core/src/main/kotlin/dev/mizule/timetriggeredperms/core/config/ConfigManager.kt +++ b/core/src/main/kotlin/dev/mizule/timetriggeredperms/core/config/ConfigManager.kt @@ -1,3 +1,27 @@ +/* + * This file is part of TimeTriggeredPerms, licensed under the MIT License. + * + * Copyright (c) 2023 powercas_gamer + * Copyright (c) 2023 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package dev.mizule.timetriggeredperms.core.config import org.spongepowered.configurate.kotlin.extensions.get @@ -36,4 +60,4 @@ class ConfigManager { return config } } -} \ No newline at end of file +} diff --git a/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/TTP.kt b/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/TTP.kt index 3b48d6d..90248d2 100644 --- a/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/TTP.kt +++ b/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/TTP.kt @@ -1,30 +1,42 @@ +/* + * This file is part of TimeTriggeredPerms, licensed under the MIT License. + * + * Copyright (c) 2023 powercas_gamer + * Copyright (c) 2023 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package dev.mizule.timetriggeredperms.velocity import com.google.inject.Inject -import com.velocitypowered.api.event.PostOrder -import com.velocitypowered.api.event.Subscribe -import com.velocitypowered.api.event.proxy.ProxyInitializeEvent -import com.velocitypowered.api.plugin.Dependency -import com.velocitypowered.api.plugin.Plugin -import com.velocitypowered.api.plugin.annotation.DataDirectory import com.velocitypowered.api.proxy.ProxyServer import dev.mizule.timetriggeredperms.core.TTPPlugin import dev.mizule.timetriggeredperms.core.config.Config import dev.mizule.timetriggeredperms.core.config.ConfigManager import dev.mizule.timetriggeredperms.velocity.listener.LuckPermsListener -import org.bstats.velocity.Metrics import org.slf4j.Logger -import xyz.jpenilla.gremlin.runtime.DependencyCache -import xyz.jpenilla.gremlin.runtime.DependencyResolver -import xyz.jpenilla.gremlin.runtime.DependencySet -import xyz.jpenilla.gremlin.runtime.platformsupport.VelocityClasspathAppender import java.nio.file.Path - class TTP @Inject constructor( - logger: Logger, - val proxy: ProxyServer, - val dataPath: Path + private val logger: Logger, + private val proxy: ProxyServer, + private val dataPath: Path, ) : TTPPlugin { private val configPath = dataPath.resolve("permissions.yml") @@ -40,6 +52,6 @@ class TTP @Inject constructor( } override fun plugin(): PluginLoader { - return PluginLoader.instance; + return PluginLoader.instance } -} \ No newline at end of file +} diff --git a/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/listener/LuckPermsListener.kt b/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/listener/LuckPermsListener.kt index e60115a..e83ad3b 100644 --- a/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/listener/LuckPermsListener.kt +++ b/velocity/src/main/kotlin/dev/mizule/timetriggeredperms/velocity/listener/LuckPermsListener.kt @@ -44,15 +44,15 @@ class LuckPermsListener(private val plugin: TTPPlugin) : AbstractL val configNode = nodeConfig(permissionNode.permission) val isUser = event.isUser - configNode.commands.forEach { command -> - val name = event.target.friendlyName - val uuid = if (isUser) (event.target as User).uniqueId.toString() else "" - val formattedCommand = command - .replace("%name%", name) - .replace("%uuid%", uuid) - .replace("%permission%", permissionNode.permission) - - proxy.commandManager.executeAsync(proxy.consoleCommandSource, formattedCommand) + configNode.commands.forEach { command -> + val name = event.target.friendlyName + val uuid = if (isUser) (event.target as User).uniqueId.toString() else "" + val formattedCommand = command + .replace("%name%", name) + .replace("%uuid%", uuid) + .replace("%permission%", permissionNode.permission) + + proxy.commandManager.executeAsync(proxy.consoleCommandSource, formattedCommand) } }