File tree Expand file tree Collapse file tree 3 files changed +4
-9
lines changed
plugin/src/server/sc/plugin2021
sdk/src/server-api/sc/api/plugins Expand file tree Collapse file tree 3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 1
1
package sc.plugin2021
2
2
3
3
import org.slf4j.LoggerFactory
4
+ import sc.api.plugins.exceptions.TooManyPlayersException
4
5
import sc.framework.plugins.AbstractGame
5
6
import sc.framework.plugins.ActionTimeout
6
7
import sc.framework.plugins.Player
@@ -22,7 +23,7 @@ class Game(override val currentState: GameState = GameState()): AbstractGame<Pla
22
23
private val availableTeams = mutableListOf (Team .ONE , Team .TWO )
23
24
override fun onPlayerJoined (): Player {
24
25
if (availableTeams.isEmpty())
25
- throw IllegalStateException ( " Too many players joined the game! " )
26
+ throw TooManyPlayersException ( )
26
27
val player = currentState.getPlayer(availableTeams.removeAt(0 ))
27
28
28
29
players.add(player)
Original file line number Diff line number Diff line change 1
1
package sc.api.plugins
2
2
3
3
import sc.api.plugins.exceptions.GameLogicException
4
- import sc.api.plugins.exceptions.TooManyPlayersException
5
4
import sc.api.plugins.host.IGameListener
6
5
import sc.framework.plugins.Player
7
6
import sc.protocol.room.RoomMessage
@@ -11,12 +10,7 @@ import sc.shared.ScoreCause
11
10
import kotlin.jvm.Throws
12
11
13
12
interface IGameInstance {
14
- /* *
15
- * @return the player that joined
16
- *
17
- * @throws TooManyPlayersException when game is already full
18
- */
19
- @Throws(TooManyPlayersException ::class )
13
+ /* * @return the player that joined. */
20
14
fun onPlayerJoined (): Player
21
15
fun onPlayerLeft (player : Player , cause : ScoreCause ? = null)
22
16
Original file line number Diff line number Diff line change 1
1
package sc.api.plugins.exceptions
2
2
3
- class TooManyPlayersException : GameRoomException ( " This game is full already. " )
3
+ class TooManyPlayersException : IllegalStateException ( " Attempted to join an already full game " )
You can’t perform that action at this time.
0 commit comments