diff --git a/build.gradle.kts b/build.gradle.kts index 3412fd1..d0aaa69 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,7 +41,7 @@ tasks { "io.leangen.geantyref", "org.bstats" ).forEach { - relocate(it, "me.adrianed.clientcatcher.libs.$it") + relocate(it, "io.github._4drian3d.clientcatcher.libs.$it") } } compileKotlin { @@ -52,7 +52,7 @@ tasks { } blossom { - replaceTokenIn("src/main/kotlin/me/adrianed/clientcatcher/Constants.kt") + replaceTokenIn("src/main/kotlin/io/github/_4drian3d/clientcatcher/Constants.kt") replaceToken("{version}", project.version) replaceToken("{configurate}", libs.versions.configurate.get()) replaceToken("{geantyref}", libs.versions.geantyref.get()) diff --git a/gradle.properties b/gradle.properties index 7d160ff..3ba5880 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -group = net.adrianed.clientcatcher -version = 3.0.0 +group = io.github._4drian3d +version = 3.1.0-SNAPSHOT description = A simple Velocity plugin to catch the client version \ No newline at end of file diff --git a/src/main/kotlin/me/adrianed/clientcatcher/ClientCatcher.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/ClientCatcher.kt similarity index 84% rename from src/main/kotlin/me/adrianed/clientcatcher/ClientCatcher.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/ClientCatcher.kt index b47e4e3..8965e43 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/ClientCatcher.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/ClientCatcher.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher +package io.github._4drian3d.clientcatcher import com.google.inject.Inject import com.velocitypowered.api.command.CommandManager @@ -11,12 +11,12 @@ import com.velocitypowered.api.plugin.PluginManager import com.velocitypowered.api.plugin.annotation.DataDirectory import com.velocitypowered.api.proxy.ProxyServer -import me.adrianed.clientcatcher.command.register -import me.adrianed.clientcatcher.configuration.Configuration -import me.adrianed.clientcatcher.configuration.Messages -import me.adrianed.clientcatcher.configuration.load -import me.adrianed.clientcatcher.listener.BrandListener -import me.adrianed.clientcatcher.listener.ModListener +import io.github._4drian3d.clientcatcher.command.register +import io.github._4drian3d.clientcatcher.configuration.Configuration +import io.github._4drian3d.clientcatcher.configuration.Messages +import io.github._4drian3d.clientcatcher.configuration.load +import io.github._4drian3d.clientcatcher.listener.BrandListener +import io.github._4drian3d.clientcatcher.listener.ModListener import org.bstats.velocity.Metrics import org.slf4j.Logger import java.nio.file.Path diff --git a/src/main/kotlin/me/adrianed/clientcatcher/Constants.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Constants.kt similarity index 81% rename from src/main/kotlin/me/adrianed/clientcatcher/Constants.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/Constants.kt index 3167186..3afc4a0 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/Constants.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Constants.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher +package io.github._4drian3d.clientcatcher class Constants { companion object { diff --git a/src/main/kotlin/me/adrianed/clientcatcher/Extensions.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Extensions.kt similarity index 90% rename from src/main/kotlin/me/adrianed/clientcatcher/Extensions.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/Extensions.kt index e546b96..9d5b619 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/Extensions.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Extensions.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher +package io.github._4drian3d.clientcatcher import net.kyori.adventure.text.minimessage.MiniMessage import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver diff --git a/src/main/kotlin/me/adrianed/clientcatcher/Libraries.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Libraries.kt similarity index 91% rename from src/main/kotlin/me/adrianed/clientcatcher/Libraries.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/Libraries.kt index c7c6017..f868f2c 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/Libraries.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Libraries.kt @@ -1,11 +1,11 @@ -package me.adrianed.clientcatcher +package io.github._4drian3d.clientcatcher import com.velocitypowered.api.plugin.PluginManager import net.byteflux.libby.Library -import org.slf4j.Logger -import java.nio.file.Path import net.byteflux.libby.VelocityLibraryManager import net.byteflux.libby.relocation.Relocation +import org.slf4j.Logger +import java.nio.file.Path fun loadDependencies( plugin: ClientCatcher, @@ -16,11 +16,11 @@ fun loadDependencies( val libraryManager = VelocityLibraryManager(logger, path, manager, plugin, "libs") val configurateRelocation = Relocation( "org{}spongepowered", - "me.adrianed.clientcatcher.libs.org{}spongepowered" + "io.github._4drian3d.clientcatcher.libs.org{}spongepowered" ) val geantyrefRelocation = Relocation( "io{}leangen{}geantyref", - "me.adrianed.clientcatcher.libs.io{}leangen{}geantyref" + "io.github._4drian3d.clientcatcher.libs.io{}leangen{}geantyref" ) val hocon = Library.builder() .groupId("org{}spongepowered") diff --git a/src/main/kotlin/me/adrianed/clientcatcher/Placeholder.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Placeholder.kt similarity index 93% rename from src/main/kotlin/me/adrianed/clientcatcher/Placeholder.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/Placeholder.kt index 2150354..c5df195 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/Placeholder.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/Placeholder.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher +package io.github._4drian3d.clientcatcher import com.velocitypowered.api.proxy.Player import com.velocitypowered.api.proxy.ProxyServer @@ -30,6 +30,6 @@ fun registerExpansion(proxyServer: ProxyServer) { }.register() } -fun ArgumentQueue.player(proxyServer: ProxyServer): Player? = +private fun ArgumentQueue.player(proxyServer: ProxyServer): Player? = proxyServer.getPlayer(popOr("You need to provide a Player Name").value()).getOrNull() diff --git a/src/main/kotlin/me/adrianed/clientcatcher/command/CatcherCommand.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/command/ClientCatcherCommand.kt similarity index 71% rename from src/main/kotlin/me/adrianed/clientcatcher/command/CatcherCommand.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/command/ClientCatcherCommand.kt index 17c4cad..916f9ba 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/command/CatcherCommand.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/command/ClientCatcherCommand.kt @@ -1,15 +1,17 @@ -package me.adrianed.clientcatcher.command +package io.github._4drian3d.clientcatcher.command import com.mojang.brigadier.Command -import com.mojang.brigadier.arguments.StringArgumentType.* +import com.mojang.brigadier.arguments.StringArgumentType.getString +import com.mojang.brigadier.arguments.StringArgumentType.word import com.mojang.brigadier.builder.LiteralArgumentBuilder.literal import com.mojang.brigadier.builder.RequiredArgumentBuilder.argument import com.velocitypowered.api.command.BrigadierCommand import com.velocitypowered.api.command.CommandManager import com.velocitypowered.api.command.CommandSource -import me.adrianed.clientcatcher.ClientCatcher -import me.adrianed.clientcatcher.asMiniMessage +import io.github._4drian3d.clientcatcher.ClientCatcher +import io.github._4drian3d.clientcatcher.asMiniMessage import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder +import kotlin.jvm.optionals.getOrNull fun register(manager: CommandManager, plugin: ClientCatcher) { val command = BrigadierCommand(literal("clientcatcher") @@ -67,31 +69,29 @@ fun register(manager: CommandManager, plugin: ClientCatcher) { playerArgument() .executes { ctx -> val name = getString(ctx, "player") - plugin.proxyServer.getPlayer(name) - .ifPresentOrElse({ player -> - ctx.source.sendMessage( - with(plugin.messages.command.mods) { - if (player.modInfo.isPresent) found.asMiniMessage( - Placeholder.unparsed("player", player.username), - Placeholder.unparsed("mods", - player.modInfo.get().mods.joinToString(", ") { "${it.id}:${it.version}" }) - ) - else notFound.asMiniMessage( - Placeholder.unparsed( - "player", - player.username - ) + plugin.proxyServer.getPlayer(name).getOrNull()?.let { player -> + ctx.source.sendMessage( + with(plugin.messages.command.mods) { + if (player.modInfo.isPresent) found.asMiniMessage( + Placeholder.unparsed("player", player.username), + Placeholder.unparsed("mods", + player.modInfo.get().mods.joinToString(", ") { "${it.id}:${it.version}" }) + ) + else notFound.asMiniMessage( + Placeholder.unparsed( + "player", + player.username ) - } - ) - - }, { - ctx.source.sendMessage( - plugin.messages.command.unknownPlayer.asMiniMessage( - Placeholder.unparsed("name", name) ) + } + ) + } ?: { + ctx.source.sendMessage( + plugin.messages.command.unknownPlayer.asMiniMessage( + Placeholder.unparsed("name", name) ) - }) + ) + } Command.SINGLE_SUCCESS } ) diff --git a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Configuration.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Configuration.kt similarity index 98% rename from src/main/kotlin/me/adrianed/clientcatcher/configuration/Configuration.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Configuration.kt index 304ba7b..7c21def 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Configuration.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Configuration.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.configuration +package io.github._4drian3d.clientcatcher.configuration import org.spongepowered.configurate.objectmapping.ConfigSerializable import org.spongepowered.configurate.objectmapping.meta.Comment diff --git a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Loader.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Loader.kt similarity index 94% rename from src/main/kotlin/me/adrianed/clientcatcher/configuration/Loader.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Loader.kt index 9a2d613..03d56c3 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Loader.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Loader.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.configuration +package io.github._4drian3d.clientcatcher.configuration import org.spongepowered.configurate.hocon.HoconConfigurationLoader import org.spongepowered.configurate.kotlin.dataClassFieldDiscoverer diff --git a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Messages.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Messages.kt similarity index 98% rename from src/main/kotlin/me/adrianed/clientcatcher/configuration/Messages.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Messages.kt index 61b43fe..6bb6a30 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/configuration/Messages.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/configuration/Messages.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.configuration +package io.github._4drian3d.clientcatcher.configuration import org.spongepowered.configurate.objectmapping.ConfigSerializable import org.spongepowered.configurate.objectmapping.meta.Comment diff --git a/src/main/kotlin/me/adrianed/clientcatcher/event/BlockedClientEvent.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedClientEvent.kt similarity index 70% rename from src/main/kotlin/me/adrianed/clientcatcher/event/BlockedClientEvent.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedClientEvent.kt index 2874a19..643f3bd 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/event/BlockedClientEvent.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedClientEvent.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.event +package io.github._4drian3d.clientcatcher.event import com.velocitypowered.api.proxy.Player diff --git a/src/main/kotlin/me/adrianed/clientcatcher/event/BlockedModEvent.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedModEvent.kt similarity index 76% rename from src/main/kotlin/me/adrianed/clientcatcher/event/BlockedModEvent.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedModEvent.kt index 25d939b..c05c1d9 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/event/BlockedModEvent.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/event/BlockedModEvent.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.event +package io.github._4drian3d.clientcatcher.event import com.velocitypowered.api.util.ModInfo import com.velocitypowered.api.proxy.Player diff --git a/src/main/kotlin/me/adrianed/clientcatcher/listener/BrandListener.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/BrandListener.kt similarity index 85% rename from src/main/kotlin/me/adrianed/clientcatcher/listener/BrandListener.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/BrandListener.kt index 7d5c130..ad92535 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/listener/BrandListener.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/BrandListener.kt @@ -1,12 +1,12 @@ -package me.adrianed.clientcatcher.listener +package io.github._4drian3d.clientcatcher.listener import com.velocitypowered.api.event.Continuation import com.velocitypowered.api.event.Subscribe import com.velocitypowered.api.event.player.PlayerClientBrandEvent -import me.adrianed.clientcatcher.ClientCatcher -import me.adrianed.clientcatcher.asMiniMessage -import me.adrianed.clientcatcher.event.BlockedClientEvent -import me.adrianed.clientcatcher.objects.CatcherCommandSource +import io.github._4drian3d.clientcatcher.ClientCatcher +import io.github._4drian3d.clientcatcher.asMiniMessage +import io.github._4drian3d.clientcatcher.event.BlockedClientEvent +import io.github._4drian3d.clientcatcher.objects.CatcherCommandSource import net.kyori.adventure.permission.PermissionChecker import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver diff --git a/src/main/kotlin/me/adrianed/clientcatcher/listener/ModListener.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/ModListener.kt similarity index 85% rename from src/main/kotlin/me/adrianed/clientcatcher/listener/ModListener.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/ModListener.kt index 2e56545..b979b76 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/listener/ModListener.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/listener/ModListener.kt @@ -1,12 +1,12 @@ -package me.adrianed.clientcatcher.listener +package io.github._4drian3d.clientcatcher.listener import com.velocitypowered.api.event.Continuation import com.velocitypowered.api.event.Subscribe import com.velocitypowered.api.event.player.PlayerModInfoEvent -import me.adrianed.clientcatcher.ClientCatcher -import me.adrianed.clientcatcher.asMiniMessage -import me.adrianed.clientcatcher.event.BlockedModEvent -import me.adrianed.clientcatcher.objects.CatcherCommandSource +import io.github._4drian3d.clientcatcher.ClientCatcher +import io.github._4drian3d.clientcatcher.asMiniMessage +import io.github._4drian3d.clientcatcher.event.BlockedModEvent +import io.github._4drian3d.clientcatcher.objects.CatcherCommandSource import net.kyori.adventure.permission.PermissionChecker import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver diff --git a/src/main/kotlin/me/adrianed/clientcatcher/objects/CatcherCommandSource.kt b/src/main/kotlin/io/github/_4drian3d/clientcatcher/objects/CatcherCommandSource.kt similarity index 81% rename from src/main/kotlin/me/adrianed/clientcatcher/objects/CatcherCommandSource.kt rename to src/main/kotlin/io/github/_4drian3d/clientcatcher/objects/CatcherCommandSource.kt index 4403219..267672c 100644 --- a/src/main/kotlin/me/adrianed/clientcatcher/objects/CatcherCommandSource.kt +++ b/src/main/kotlin/io/github/_4drian3d/clientcatcher/objects/CatcherCommandSource.kt @@ -1,4 +1,4 @@ -package me.adrianed.clientcatcher.objects +package io.github._4drian3d.clientcatcher.objects import com.velocitypowered.api.command.CommandSource import com.velocitypowered.api.permission.Tristate