Class BattleAdaptor
- java.lang.Object
-
- robocode.control.events.BattleAdaptor
-
- All Implemented Interfaces:
IBattleListener
public abstract class BattleAdaptor extends java.lang.Object implements IBattleListener
An abstract adapter class for receiving battle events by implementing theIBattleListener. The methods in this class are empty. This class exists as convenience for creating listener objects.This is handy class to use when implementing the IBattleListener. It saves you from implementing empty handlers for battle events you are not interested in handling.
Example:
private class BattleObserver extends BattleAdaptor { boolean isReplay; public void onBattleStarted(BattleStartedEvent event) { isReplay = event.isReplay(); } public void onBattleCompleted(BattleCompletedEvent event) { if (!isReplay) { printResultsData(event); } }- Since:
- 1.6.2
- Author:
- Flemming N. Larsen (original)
- See Also:
IBattleListener
-
-
Constructor Summary
Constructors Constructor Description BattleAdaptor()Creates a BattleAdaptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonBattleCompleted(BattleCompletedEvent event)This method is called when the battle has completed successfully and results are available.voidonBattleError(BattleErrorEvent event)This method is called when the game has sent an error message.voidonBattleFinished(BattleFinishedEvent event)This method is called when the battle has finished.voidonBattleMessage(BattleMessageEvent event)This method is called when the game has sent a new information message.voidonBattlePaused(BattlePausedEvent event)This method is called when the battle has been paused, either by the user or the game.voidonBattleResumed(BattleResumedEvent event)This method is called when the battle has been resumed (after having been paused).voidonBattleStarted(BattleStartedEvent event)This method is called when a new battle has started.voidonRoundEnded(RoundEndedEvent event)This method is called when the current round of a battle has ended.voidonRoundStarted(RoundStartedEvent event)This method is called when a new round in a battle has started.voidonTurnEnded(TurnEndedEvent event)This method is called when the current turn in a battle round is ended.voidonTurnStarted(TurnStartedEvent event)This method is called when a new turn in a battle round has started.
-
-
-
Method Detail
-
onBattleStarted
public void onBattleStarted(BattleStartedEvent event)
This method is called when a new battle has started.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleStartedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleStartedEvent,IBattleListener.onBattleCompleted(BattleCompletedEvent),IBattleListener.onBattleFinished(BattleFinishedEvent)
-
onBattleFinished
public void onBattleFinished(BattleFinishedEvent event)
This method is called when the battle has finished. This event is always sent as the last battle event, both when the battle is completed successfully, terminated due to an error, or aborted by the user. Hence, this events is well-suited for cleanup after the battle.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleFinishedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleFinishedEvent,IBattleListener.onBattleStarted(BattleStartedEvent),IBattleListener.onBattleCompleted(BattleCompletedEvent)
-
onBattleCompleted
public void onBattleCompleted(BattleCompletedEvent event)
This method is called when the battle has completed successfully and results are available. This event will not occur if the battle is terminated or aborted by the user before the battle is completed.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleCompletedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleCompletedEvent,IBattleListener.onBattleStarted(BattleStartedEvent),IBattleListener.onBattleFinished(BattleFinishedEvent)
-
onBattlePaused
public void onBattlePaused(BattlePausedEvent event)
This method is called when the battle has been paused, either by the user or the game.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattlePausedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattlePausedEvent,IBattleListener.onBattleResumed(BattleResumedEvent)
-
onBattleResumed
public void onBattleResumed(BattleResumedEvent event)
This method is called when the battle has been resumed (after having been paused).You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleResumedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleResumedEvent,IBattleListener.onBattlePaused(BattlePausedEvent)
-
onRoundStarted
public void onRoundStarted(RoundStartedEvent event)
This method is called when a new round in a battle has started.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onRoundStartedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
RoundEndedEvent,IBattleListener.onRoundEnded(RoundEndedEvent)
-
onRoundEnded
public void onRoundEnded(RoundEndedEvent event)
This method is called when the current round of a battle has ended.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onRoundEndedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
RoundEndedEvent,IBattleListener.onRoundStarted(RoundStartedEvent)
-
onTurnStarted
public void onTurnStarted(TurnStartedEvent event)
This method is called when a new turn in a battle round has started.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onTurnStartedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
TurnStartedEvent,IBattleListener.onTurnEnded(TurnEndedEvent)
-
onTurnEnded
public void onTurnEnded(TurnEndedEvent event)
This method is called when the current turn in a battle round is ended.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onTurnEndedin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
TurnEndedEvent,IBattleListener.onTurnStarted(TurnStartedEvent)
-
onBattleMessage
public void onBattleMessage(BattleMessageEvent event)
This method is called when the game has sent a new information message.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleMessagein interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleMessageEvent,IBattleListener.onBattleError(BattleErrorEvent)
-
onBattleError
public void onBattleError(BattleErrorEvent event)
This method is called when the game has sent an error message.You must override this method in order to get informed about this event and receive the event details.
- Specified by:
onBattleErrorin interfaceIBattleListener- Parameters:
event- the event details.- See Also:
BattleErrorEvent,IBattleListener.onBattleMessage(BattleMessageEvent)
-
-