Class WaitTimeForShipArrival
- java.lang.Object
-
- ch.sahits.game.openpatrician.event.handler.ShipArivalInPortEventListener
-
- ch.sahits.game.openpatrician.display.event.handler.impl.WaitTimeForShipArrival
-
- Direct Known Subclasses:
ShipArrivalForLoading
public abstract class WaitTimeForShipArrival extends ShipArivalInPortEventListener
Wait for until a defined time for the arrival of a ship in a city. If the time has passed this event listener unregisters itself from the queue.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Feb 20, 2013
-
-
Field Summary
Fields Modifier and Type Field Description private Date
date
private java.time.LocalDateTime
deadline
-
Fields inherited from class ch.sahits.game.openpatrician.event.handler.ShipArivalInPortEventListener
clientServerEventBus
-
-
Constructor Summary
Constructors Constructor Description WaitTimeForShipArrival(ICity city, IPlayer player, java.time.LocalDateTime deadline)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
getDate()
void
handleShipEntersPort(ShipEntersPortEvent event)
Handling the event when a ship enters the port.-
Methods inherited from class ch.sahits.game.openpatrician.event.handler.ShipArivalInPortEventListener
execute, getShip
-
-
-
-
Field Detail
-
deadline
private final java.time.LocalDateTime deadline
-
date
@Autowired private Date date
-
-
Method Detail
-
getDate
public Date getDate()
-
handleShipEntersPort
public void handleShipEntersPort(ShipEntersPortEvent event)
Description copied from class:ShipArivalInPortEventListener
Handling the event when a ship enters the port. Subclasses are intended to override this implementation by extension implement the correct logic. This base implementation provides two points:- if the player and city that triggered the event match with the ones listed to by this instance the ship is set on this instance
- Then the
ShipArivalInPortEventListener.execute()
method is called and if it returns true this instance is unregistered from the event bus. Otherwise the ship is set to null.
- Overrides:
handleShipEntersPort
in classShipArivalInPortEventListener
- Parameters:
event
- for the ship entering the port
-
-