From 5e88c660dc279a1c859930f8e234dbe68a183eb2 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Thu, 13 Aug 2026 01:58:02 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style:=20remove=20stale=20Veloci?= =?UTF-8?q?ty=20plugin=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/cafe/kirameki/minikuraVelocity/Main.kt | 1 - .../cafe/kirameki/minikuraVelocity/commands/EndCommand.kt | 3 +-- .../kirameki/minikuraVelocity/commands/ServerCommand.kt | 4 +--- .../minikuraVelocity/listeners/ProxyTransferHandler.kt | 5 +---- .../kirameki/minikuraVelocity/utils/ProxyTransferUtils.kt | 7 +++---- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/Main.kt b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/Main.kt index 25e6674..d094484 100644 --- a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/Main.kt +++ b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/Main.kt @@ -91,7 +91,6 @@ class Main @Inject constructor(private val logger: Logger, private val server: P .plugin(this) .build() - // TODO: Rework this command and support and arguments val migrateCommand = SimpleCommand { p -> val source = p.source() val args = p.arguments() diff --git a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/EndCommand.kt b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/EndCommand.kt index 47def7e..32a6cb6 100644 --- a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/EndCommand.kt +++ b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/EndCommand.kt @@ -19,7 +19,6 @@ import java.util.function.Consumer object EndCommand { fun createEndCommand(proxy: ProxyServer): BrigadierCommand { val serverNode = BrigadierCommand.literalArgumentBuilder("end") - //.requires { source: CommandSource? -> source is Player } .then(BrigadierCommand.requiredArgumentBuilder("forceEnd", StringArgumentType.word()) .suggests { context: CommandContext?, builder: SuggestionsBuilder -> builder.suggest("--force") @@ -40,4 +39,4 @@ object EndCommand { return BrigadierCommand(serverNode) } -} \ No newline at end of file +} diff --git a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/ServerCommand.kt b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/ServerCommand.kt index 8d4c07b..ce06b05 100644 --- a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/ServerCommand.kt +++ b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/commands/ServerCommand.kt @@ -18,10 +18,8 @@ import java.util.function.Consumer object ServerCommand { fun createServerCommand(proxy: ProxyServer): BrigadierCommand { val serverNode = BrigadierCommand.literalArgumentBuilder("server") - //.requires { source: CommandSource? -> source is Player } .then(BrigadierCommand.requiredArgumentBuilder("serverName", StringArgumentType.word()) .suggests { context: CommandContext?, builder: SuggestionsBuilder -> - // Add all available server names as suggestions proxy.allServers.forEach(Consumer { server: RegisteredServer -> builder.suggest( server.serverInfo.name @@ -112,4 +110,4 @@ object ServerCommand { return BrigadierCommand(serverNode) } -} \ No newline at end of file +} diff --git a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/listeners/ProxyTransferHandler.kt b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/listeners/ProxyTransferHandler.kt index 17f65f8..5d816cf 100644 --- a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/listeners/ProxyTransferHandler.kt +++ b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/listeners/ProxyTransferHandler.kt @@ -38,7 +38,6 @@ class ProxyTransferHandler( @Subscribe fun onCookieReceiveEvent(event: CookieReceiveEvent) { - // TODO: Fix don't pass the cookie to backend, it kicks with invalid packet for some reason if (event.originalKey == null || event.originalKey.toString() != "minikura:transfer_packet") { event.result = CookieReceiveEvent.ForwardResult.handled() return @@ -105,8 +104,6 @@ class ProxyTransferHandler( val future = CompletableFuture() cookieFutures[player.uniqueId.toString()] = future - // TODO: Check if player transferred with intent id of 3 (transfer) - // TODO: Can't seem to find a way to get the intent id from the event try { val serverName = future.get(3, TimeUnit.SECONDS) @@ -136,4 +133,4 @@ class ProxyTransferHandler( logger.warn("No available servers with valid join_priority for ${player.username}") } -} \ No newline at end of file +} diff --git a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/utils/ProxyTransferUtils.kt b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/utils/ProxyTransferUtils.kt index e67a336..641f971 100644 --- a/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/utils/ProxyTransferUtils.kt +++ b/plugins/MinikuraVelocity/src/main/kotlin/cafe/kirameki/minikuraVelocity/utils/ProxyTransferUtils.kt @@ -38,7 +38,7 @@ object ProxyTransferUtils { .toList() .filter { playerOnThisProxy.contains(it.uniqueId.toString()) } - val batchSize = (players.size * 0.05).coerceAtLeast(1.0).toInt() // 5% of players per batch to avoid overloading the server + val batchSize = (players.size * 0.05).coerceAtLeast(1.0).toInt() var currentIndex = 0 @@ -65,7 +65,7 @@ object ProxyTransferUtils { .withClaim("uuid", player.uniqueId.toString()) .withClaim("server", currentServer.serverInfo.name) .withClaim("origin", currentProxyName) - .withExpiresAt(Date(System.currentTimeMillis() + 60 * 5 * 1000)) // Token expires in 5 minutes + .withExpiresAt(Date(System.currentTimeMillis() + 60 * 5 * 1000)) .sign(jwtAlgorithm) player.storeCookie(Key.key("minikura", "transfer_packet"), token.toByteArray()) @@ -105,7 +105,6 @@ object ProxyTransferUtils { return } - // TODO: Load balance players across proxies val nextProxy = allProxies.first() val targetServer = ServerDataStore.getReverseProxyServer(nextProxy) if (targetServer != null) { @@ -124,4 +123,4 @@ object ProxyTransferUtils { }).repeat(5, TimeUnit.SECONDS).schedule() } } -} \ No newline at end of file +}