🐛 fix: don't allow migrating to current proxy

This commit is contained in:
2025-01-02 22:47:07 +07:00
parent bf439cf3f3
commit b3405cd6ad
2 changed files with 15 additions and 1 deletions

View File

@@ -31,7 +31,13 @@ object ProxyTransferUtils {
val targetAddress = InetSocketAddress(targetServer.address, targetServer.port)
val currentProxyName = redisBungeeApi.proxyId
val players = server.allPlayers.toList()
val playerOnThisProxy = redisBungeeApi.getPlayersOnProxy(currentProxyName)
.map { it.toString() }
val players = server.allPlayers
.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
var currentIndex = 0