Class NextPatrolStation
- java.lang.Object
-
- ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
-
- ch.sahits.game.openpatrician.display.event.handler.impl.NextPatrolStation
-
class NextPatrolStation extends ShipEntersPortEventListener
- Author:
- Andi Hotz, (c) Sahits GmbH, 2014 Created on Feb 21, 2014
-
-
Field Summary
Fields Modifier and Type Field Description private AttackListeneratackListenerprivate Datedateprivate java.time.LocalDateTimedeadlineprivate EventHandlerFactoryeventHandlerFactoryprivate IPlayerplayerprivate java.util.Randomrndprivate PatrolInternalStatestateNext station may be null if it is the lastprivate ClientTaskFactorytaskFactory-
Fields inherited from class ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
clientServerEventBus
-
-
Constructor Summary
Constructors Constructor Description NextPatrolStation(INavigableVessel ship, ICity city, PatrolInternalState state, IPlayer player, java.time.LocalDateTime deadline, AttackListener atackListener)Create the next patrol station listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexecute(ICity city)Execute an action.voidhandleShipEntersPort(ShipEntersPortEvent event)private voidinitEventBus()private voidunregisterEventBus()-
Methods inherited from class ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
ignoreEventCity
-
-
-
-
Field Detail
-
state
private final PatrolInternalState state
Next station may be null if it is the last
-
player
private final IPlayer player
-
deadline
private final java.time.LocalDateTime deadline
-
atackListener
private final AttackListener atackListener
-
date
@Autowired private Date date
-
rnd
@Autowired private java.util.Random rnd
-
taskFactory
@Autowired private ClientTaskFactory taskFactory
-
eventHandlerFactory
@Autowired private EventHandlerFactory eventHandlerFactory
-
-
Constructor Detail
-
NextPatrolStation
public NextPatrolStation(INavigableVessel ship, ICity city, PatrolInternalState state, IPlayer player, java.time.LocalDateTime deadline, AttackListener atackListener)
Create the next patrol station listener. This listener adds itself to the event queue and removes the first city from the patrol state.- Parameters:
ship- on patrolcity- next citystate- patrol stateplayer- current player (ship owner)deadline- until the ship has to arriveatackListener- attack listener
-
-
Method Detail
-
initEventBus
@PostConstruct private void initEventBus()
-
unregisterEventBus
@PreDestroy private void unregisterEventBus()
-
handleShipEntersPort
public void handleShipEntersPort(ShipEntersPortEvent event)
- Overrides:
handleShipEntersPortin classShipEntersPortEventListener
-
execute
public boolean execute(ICity city)
Description copied from class:ShipEntersPortEventListenerExecute an action.- Specified by:
executein classShipEntersPortEventListener- Parameters:
city- current city.- Returns:
- flag indicating if the execution was successful and therefor the event listener can be removed.
-
-