summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt2
-rw-r--r--backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt10
2 files changed, 2 insertions, 10 deletions
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt
index 8498ce85..08249193 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt
@@ -12,7 +12,7 @@ class Lobby(
val id: Long,
val name: String,
var owner: Player,
- @field:Transient private val gameDefinition: GameDefinition
+ private val gameDefinition: GameDefinition
) {
private val players: MutableList<Player> = ArrayList(gameDefinition.maxPlayers)
diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
index 4f70468f..d6e9b344 100644
--- a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
+++ b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt
@@ -1,6 +1,5 @@
package org.luxons.sevenwonders.lobby
-import com.fasterxml.jackson.annotation.JsonIgnore
import org.luxons.sevenwonders.errors.ApiMisuseException
import org.luxons.sevenwonders.game.Game
@@ -21,21 +20,16 @@ class Player(
val isInGame: Boolean
get() = _game != null
- @Transient
private var _lobby: Lobby? = null
- @get:JsonIgnore
val lobby: Lobby
get() = _lobby ?: throw PlayerNotInLobbyException(username)
- @get:JsonIgnore
val ownedLobby: Lobby
get() = if (isGameOwner) lobby else throw PlayerIsNotOwnerException(username)
- @Transient
private var _game: Game? = null
- @get:JsonIgnore
val game: Game
get() = _game ?: throw PlayerNotInGameException(username)
@@ -54,9 +48,7 @@ class Player(
index = -1
}
- override fun toString(): String {
- return "'$displayName' ($username)"
- }
+ override fun toString(): String = "'$displayName' ($username)"
}
internal class PlayerNotInLobbyException(username: String) :
bgstack15