From 215f2d23d1b46b0fc6bc6d5c92c60c3976008714 Mon Sep 17 00:00:00 2001 From: FluxCapacitor2 <31071265+FluxCapacitor2@users.noreply.github.com> Date: Mon, 23 Dec 2024 02:02:38 -0500 Subject: [PATCH] Update RPC and send player UUIDs and max slots in RPC requests --- common/src/main/kotlin/com/bluedragonmc/server/Game.kt | 1 + gradle/libs.versions.toml | 2 +- .../com/bluedragonmc/server/impl/IncomingRPCHandlerImpl.kt | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/bluedragonmc/server/Game.kt b/common/src/main/kotlin/com/bluedragonmc/server/Game.kt index ab5a12d0..42b6112b 100644 --- a/common/src/main/kotlin/com/bluedragonmc/server/Game.kt +++ b/common/src/main/kotlin/com/bluedragonmc/server/Game.kt @@ -73,6 +73,7 @@ abstract class Game(val name: String, val mapName: String, val mode: String? = n gameState = state.mapToRpcState() openSlots = maxPlayers - players.size joinable = state.canPlayersJoin + maxSlots = maxPlayers } internal val players: MutableList = CopyOnWriteArrayList() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 33ff34a6..d2e81c9d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ okhttp = "4.10.0" serialization = "1.5.0-RC" tinylog = "2.6.2" # Auto-generated GRPC/Protobuf messaging code -rpc = "fb16ef4cc5" +rpc = "e06867b34a" # Agones SDK and its necessary runtime dependencies agones-kt = "0.1.2" grpc = "1.50.2" diff --git a/src/main/kotlin/com/bluedragonmc/server/impl/IncomingRPCHandlerImpl.kt b/src/main/kotlin/com/bluedragonmc/server/impl/IncomingRPCHandlerImpl.kt index 173e3777..81cc3a2f 100644 --- a/src/main/kotlin/com/bluedragonmc/server/impl/IncomingRPCHandlerImpl.kt +++ b/src/main/kotlin/com/bluedragonmc/server/impl/IncomingRPCHandlerImpl.kt @@ -83,6 +83,9 @@ class IncomingRPCHandlerImpl(serverPort: Int) : IncomingRPCHandler { this.gameState = game.rpcGameState this.instanceUuid = game.id this.gameType = game.gameType + game.getPlayers().forEach { player -> + this.playerUuids.add(player.uuid.toString()) + } } } }