Class DeliverPackages
- java.lang.Object
-
- ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
-
- ch.sahits.game.openpatrician.display.event.handler.impl.WaitTimeForShipArrivalInCity
-
- ch.sahits.game.openpatrician.display.event.handler.impl.DeliverPackages
-
class DeliverPackages extends WaitTimeForShipArrivalInCity
Event handler for delivering packages
-
-
Field Summary
Fields Modifier and Type Field Description private int
amount
private com.google.common.eventbus.AsyncEventBus
clientEventBus
private Locale
locale
private org.springframework.context.MessageSource
messageSource
private int
premium
private java.util.Random
rnd
-
Fields inherited from class ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
clientServerEventBus
-
-
Constructor Summary
Constructors Constructor Description DeliverPackages(ICity city, IShip ship, java.time.LocalDateTime deadline, int premium, int amount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Action that is taken when the time has run out.boolean
execute(ICity city)
Execute an action.private void
initializeEventBus()
private void
unregisterEventBus()
-
Methods inherited from class ch.sahits.game.openpatrician.display.event.handler.impl.WaitTimeForShipArrivalInCity
handleShipEntersPort
-
Methods inherited from class ch.sahits.game.openpatrician.event.handler.ShipEntersPortEventListener
ignoreEventCity
-
-
-
-
Field Detail
-
amount
private final int amount
-
premium
private final int premium
-
rnd
@Autowired private java.util.Random rnd
-
clientEventBus
@Autowired @Qualifier("clientEventBus") private com.google.common.eventbus.AsyncEventBus clientEventBus
-
locale
@Autowired private Locale locale
-
messageSource
@Autowired private org.springframework.context.MessageSource messageSource
-
-
Method Detail
-
initializeEventBus
@PostConstruct private void initializeEventBus()
-
unregisterEventBus
@PreDestroy private void unregisterEventBus()
-
execute
public boolean execute(ICity city)
Description copied from class:ShipEntersPortEventListener
Execute an action.- Specified by:
execute
in classShipEntersPortEventListener
- Parameters:
city
- current city.- Returns:
- flag indicating if the execution was successful and therefor the event listener can be removed.
-
destroy
public void destroy()
Description copied from class:WaitTimeForShipArrivalInCity
Action that is taken when the time has run out.- Overrides:
destroy
in classWaitTimeForShipArrivalInCity
-
-