public IGameInstance
@NotNull Player onPlayerJoined()
TooManyPlayersException
- when game is already fullvoid onPlayerLeft(@NotNull Player player, @Nullable ScoreCause cause)
void onAction(@NotNull Player fromPlayer, @NotNull ProtocolMessage data)
Called by the Server once an action was received.
fromPlayer
- The player who invoked this action.data
- ProtocolMessage with the actionGameLogicException
- if any invalid action is doneInvalidMoveException
- if the received move violates the rulesvoid addGameListener(@NotNull IGameListener listener)
void removeGameListener(@NotNull IGameListener listener)
void start()
Server or an administrator requests the game to start now.
void destroy()
Destroys the Game. Might be invoked by the server at any time. Any open handles should be removed. No events (GameOver etc) should be sent out after this method has been called.
void loadFromFile(@NotNull java.lang.String file)
The game is requested to load itself from a file. Similar to a replay but with actual clients.
file
- File the game should be loaded fromvoid loadFromFile(@NotNull java.lang.String file, int turn)
The game is requested to load itself from a file. Similar to a replay but with actual clients.
file
- File where the game should be loaded fromturn
- The turn to load from the replayvoid loadGameInfo(@NotNull java.lang.Object gameInfo)
The game is requested to load itself from a given game information object.
gameInfo
- the stored gameInformation@NotNull java.util.List<sc.framework.plugins.Player> getWinners()
Returns the players that have won the game, empty if the game has no winners, or null if the game has not yet finished.
@NotNull java.lang.String getPluginUUID()
Used for generating replay name.
@NotNull java.util.List<sc.framework.plugins.Player> getPlayers()
@NotNull java.util.List<sc.shared.PlayerScore> getPlayerScores()