🎨 style: remove stale Velocity plugin comments

This commit is contained in:
2026-08-13 02:19:25 +07:00
parent b58488c1b9
commit 5e88c660dc
5 changed files with 6 additions and 14 deletions
@@ -91,7 +91,6 @@ class Main @Inject constructor(private val logger: Logger, private val server: P
.plugin(this) .plugin(this)
.build() .build()
// TODO: Rework this command and support <origin> and <destination> arguments
val migrateCommand = SimpleCommand { p -> val migrateCommand = SimpleCommand { p ->
val source = p.source() val source = p.source()
val args = p.arguments() val args = p.arguments()
@@ -19,7 +19,6 @@ import java.util.function.Consumer
object EndCommand { object EndCommand {
fun createEndCommand(proxy: ProxyServer): BrigadierCommand { fun createEndCommand(proxy: ProxyServer): BrigadierCommand {
val serverNode = BrigadierCommand.literalArgumentBuilder("end") val serverNode = BrigadierCommand.literalArgumentBuilder("end")
//.requires { source: CommandSource? -> source is Player }
.then(BrigadierCommand.requiredArgumentBuilder("forceEnd", StringArgumentType.word()) .then(BrigadierCommand.requiredArgumentBuilder("forceEnd", StringArgumentType.word())
.suggests { context: CommandContext<CommandSource?>?, builder: SuggestionsBuilder -> .suggests { context: CommandContext<CommandSource?>?, builder: SuggestionsBuilder ->
builder.suggest("--force") builder.suggest("--force")
@@ -40,4 +39,4 @@ object EndCommand {
return BrigadierCommand(serverNode) return BrigadierCommand(serverNode)
} }
} }
@@ -18,10 +18,8 @@ import java.util.function.Consumer
object ServerCommand { object ServerCommand {
fun createServerCommand(proxy: ProxyServer): BrigadierCommand { fun createServerCommand(proxy: ProxyServer): BrigadierCommand {
val serverNode = BrigadierCommand.literalArgumentBuilder("server") val serverNode = BrigadierCommand.literalArgumentBuilder("server")
//.requires { source: CommandSource? -> source is Player }
.then(BrigadierCommand.requiredArgumentBuilder("serverName", StringArgumentType.word()) .then(BrigadierCommand.requiredArgumentBuilder("serverName", StringArgumentType.word())
.suggests { context: CommandContext<CommandSource?>?, builder: SuggestionsBuilder -> .suggests { context: CommandContext<CommandSource?>?, builder: SuggestionsBuilder ->
// Add all available server names as suggestions
proxy.allServers.forEach(Consumer { server: RegisteredServer -> proxy.allServers.forEach(Consumer { server: RegisteredServer ->
builder.suggest( builder.suggest(
server.serverInfo.name server.serverInfo.name
@@ -112,4 +110,4 @@ object ServerCommand {
return BrigadierCommand(serverNode) return BrigadierCommand(serverNode)
} }
} }
@@ -38,7 +38,6 @@ class ProxyTransferHandler(
@Subscribe @Subscribe
fun onCookieReceiveEvent(event: CookieReceiveEvent) { 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") { if (event.originalKey == null || event.originalKey.toString() != "minikura:transfer_packet") {
event.result = CookieReceiveEvent.ForwardResult.handled() event.result = CookieReceiveEvent.ForwardResult.handled()
return return
@@ -105,8 +104,6 @@ class ProxyTransferHandler(
val future = CompletableFuture<String>() val future = CompletableFuture<String>()
cookieFutures[player.uniqueId.toString()] = future 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 { try {
val serverName = future.get(3, TimeUnit.SECONDS) 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}") logger.warn("No available servers with valid join_priority for ${player.username}")
} }
} }
@@ -38,7 +38,7 @@ object ProxyTransferUtils {
.toList() .toList()
.filter { playerOnThisProxy.contains(it.uniqueId.toString()) } .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 var currentIndex = 0
@@ -65,7 +65,7 @@ object ProxyTransferUtils {
.withClaim("uuid", player.uniqueId.toString()) .withClaim("uuid", player.uniqueId.toString())
.withClaim("server", currentServer.serverInfo.name) .withClaim("server", currentServer.serverInfo.name)
.withClaim("origin", currentProxyName) .withClaim("origin", currentProxyName)
.withExpiresAt(Date(System.currentTimeMillis() + 60 * 5 * 1000)) // Token expires in 5 minutes .withExpiresAt(Date(System.currentTimeMillis() + 60 * 5 * 1000))
.sign(jwtAlgorithm) .sign(jwtAlgorithm)
player.storeCookie(Key.key("minikura", "transfer_packet"), token.toByteArray()) player.storeCookie(Key.key("minikura", "transfer_packet"), token.toByteArray())
@@ -105,7 +105,6 @@ object ProxyTransferUtils {
return return
} }
// TODO: Load balance players across proxies
val nextProxy = allProxies.first() val nextProxy = allProxies.first()
val targetServer = ServerDataStore.getReverseProxyServer(nextProxy) val targetServer = ServerDataStore.getReverseProxyServer(nextProxy)
if (targetServer != null) { if (targetServer != null) {
@@ -124,4 +123,4 @@ object ProxyTransferUtils {
}).repeat(5, TimeUnit.SECONDS).schedule() }).repeat(5, TimeUnit.SECONDS).schedule()
} }
} }
} }