public abstract class AbstractGame extends Object implements Game
Modifier and Type | Field and Description |
---|---|
protected Arena |
arena |
protected DAC |
dac |
protected Listener |
listener |
protected PlayersRefSet |
spectators |
Constructor and Description |
---|
AbstractGame(DAC dac,
GameStartData data) |
Modifier and Type | Method and Description |
---|---|
void |
addSpectator(Player player) |
Arena |
getArena() |
Listener[] |
getListeners() |
abstract boolean |
isPlayerTurn(Player player)
Check if it's the given player turn.
|
boolean |
isSpectator(Player player) |
abstract void |
onJumpFail(Player player)
Callback called when a player failed.
|
abstract void |
onJumpSuccess(Player player)
Callback called when a player succeed.
|
void |
onNewTurn()
Callback called when a new turn starts.
|
void |
removeSpectator(Player player) |
protected void |
resetPoolOnEnd()
Resets the pool if configured to do so on game end.
|
protected void |
resetPoolOnStart()
Resets the pool if configured to do so on game start.
|
protected void |
send(String key,
Object... arguments)
Send a message which is recorded in the main PluginMessages instance.
|
protected void |
sendSpectators(String message)
Sends a message to this game's spectators by prefixing
the message with the arena's name as specified in the config.
|
protected void |
tpAfterJumpFail(GamePlayer player)
Teleport the player if configured to do so after player's failed jump.
|
protected void |
tpAfterJumpSuccess(GamePlayer player,
Column column)
Teleport the player if configured to do so after player's success.
|
protected void |
tpBeforeJump(GamePlayer player)
Teleport the player if configured to do so on player's turn.
|
protected final PlayersRefSet spectators
public AbstractGame(DAC dac, GameStartData data)
public Listener[] getListeners()
getListeners
in interface Stage
protected void send(String key, Object... arguments)
public boolean isSpectator(Player player)
isSpectator
in interface Stage
public void addSpectator(Player player)
addSpectator
in interface Stage
public void removeSpectator(Player player)
removeSpectator
in interface Stage
public void onNewTurn()
Game
public abstract boolean isPlayerTurn(Player player)
GameListener
to check if events need to be
processed. So this method should be optimized as much as possible
because some events (like PlayerMoveEvent
) are heavy.public abstract void onJumpSuccess(Player player)
public abstract void onJumpFail(Player player)
protected void sendSpectators(String message)
protected void resetPoolOnStart()
protected void resetPoolOnEnd()
protected void tpBeforeJump(GamePlayer player)
protected void tpAfterJumpSuccess(GamePlayer player, Column column)
protected void tpAfterJumpFail(GamePlayer player)
Copyright © 2012. All Rights Reserved.