@Subscribe
public void handleBlockadeConvoyReturns(ShipEntersPortEvent event) {
INavigableVessel vessel = event.getShip();
if (vessel instanceof IConvoy) {
LocalDateTime now = date.getCurrentDate();
ICity aldermanCity = mapService.getAldermanCity();
for (Entry<ICity, IBlockade> blockadeEntry : blockadeState.entrySet()) {
IBlockade blockade = blockadeEntry.getValue();
if (blockade.getEndBlockade().isBefore(now)) {
IConvoy convoy = blockade.getBlockadeConvoy();
if (convoy.equals(vessel) && event.getCity().equals(aldermanCity)) {
final ICity blockadedCity = blockadeEntry.getKey();
dissolveConvoy(blockade, aldermanCity, blockadedCity);
blockadeState.finishBlockade(blockadedCity);
IGuild guild = guildList.findGuild(aldermanCity).get();
for (IShip ship : blockade.getShipsToAuction()) {
LocalDateTime auctionDate = now.plusDays(10);
auctionDate = guildService.cleanUpAuctionAndDetermineAuctionDate(auctionDate, guild);
IShipAuction auction = modelFactory.createAnonymousShipAuction(auctionDate, ship.getValue(), ship);
guild.getAuctions().add(auction);
}
return;
}
}
}
}
}