Class ShipEntersPortEventListener
- java.lang.Object
-
- ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
-
- Direct Known Subclasses:
NextCourierPatrolStation
,NextPatrolStation
,PassengerLeavesShipOnArrival
,UnloadOnArrival
,WaitTimeForShipArrivalInCity
public abstract class ShipEntersPortEventListener extends java.lang.Object
Event listener that implements the event listening for theShipEntersPortEvent
for a specific city and ship and then executesexecute(ICity)
. This instance is added to the event queue.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Feb 19, 2013
-
-
Field Summary
Fields Modifier and Type Field Description private ICity
city
protected com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private IPlayer
player
private INavigableVessel
ship
-
Constructor Summary
Constructors Constructor Description ShipEntersPortEventListener(INavigableVessel ship, ICity city)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
execute(ICity city)
Execute an action.void
handleShipEntersPort(ShipEntersPortEvent event)
protected boolean
ignoreEventCity()
Check if the event city has to be ignored.
-
-
-
Field Detail
-
ship
private final INavigableVessel ship
-
city
private final ICity city
-
player
private final IPlayer player
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") protected com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
-
Constructor Detail
-
ShipEntersPortEventListener
public ShipEntersPortEventListener(INavigableVessel ship, ICity city)
-
-
Method Detail
-
handleShipEntersPort
public void handleShipEntersPort(ShipEntersPortEvent event)
-
execute
public abstract boolean execute(ICity city)
Execute an action.- Parameters:
city
- current city.- Returns:
- flag indicating if the execution was successful and therefor the event listener can be removed.
-
ignoreEventCity
protected boolean ignoreEventCity()
Check if the event city has to be ignored. This can be the case if the event is triggered after a deadline.- Returns:
- false.
-
-