/** * Add a new pirate activity with the current date. * @param pirateActivity to be added with the present date. */ public void add(PirateActivityEntry pirateActivity) { map.put(date.getCurrentDate(), pirateActivity); }
private EWeapon getSmallWeaponType() { int year = date.getCurrentDate().getYear(); if (year <= 1333) { return EWeapon.BALLISTA_SMALL; } else if (year <= 1367) { return EWeapon.TREBUCHET_SMALL; } else { return EWeapon.CANNON; } }
/** * If the deadline has passed, the passenger will leave the ship in the next port not the destination city. * @return true if the the current date is after the <code>deadline</code> */ @Override protected boolean ignoreEventCity() { return date.getCurrentDate().isAfter(deadline); }
@Override public String get() { return translations.toDisplayString(date.getCurrentDate()); } }
@Override protected String computeValue() { // FIXME: 5/15/16 this must go to the text.properties return modelTranslator.getStartOfWeek(date.getCurrentDate())+" to "+modelTranslator.getEndOfWeek(date.getCurrentDate()); } };
private EWeapon getBigWeaponType() { int year = date.getCurrentDate().getYear(); if (year <= 1333) { return EWeapon.BALLISTA_BIG; } else if (year <= 1367) { return EWeapon.TREBUCHET_BIG; } else { return EWeapon.BOMBARD; } } private EWeapon getSmallWeaponType() {
@Override public Integer get() { LocalDateTime now = date.getCurrentDate(); if (now.isAfter(end)) { return 0; } double percentagePassed = dateService.getPercentageBetweenDates(start, end); return (int)Math.rint(maxPremium * (1 - percentagePassed)); } }
@PostConstruct private void init() { setExecutionTime(date.getCurrentDate().plusDays(5)); } @Override
@PostConstruct private void initialize() { setExecutionTime(date.getCurrentDate().plusDays(20)); timedUpdatableTaskList.add(this); }
@PostConstruct private void initialize() { if (deadline == null) { setDeadline(date.getCurrentDate().plusDays(offeredTime)); } clientServerEventBus.register(this); } @PreDestroy
@Override public void handleShipEntersPort(ShipEntersPortEvent event) { if (date.getCurrentDate().isAfter(deadline)){ clientServerEventBus.unregister(this); } else { super.handleShipEntersPort(event); } }
@Subscribe public void checkDayChangeUpdates(ClockTickDayChange dayChange) { ICity town = city.getCity(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getAldermanElectionDate(); if (dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(this::resetContent); } } @Subscribe
@Subscribe public void checkDayChangeUpdates(ClockTickDayChange dayChange) { ICity town = city.getCity(); IPlayer player = city.getPlayer(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getElectionDate(); if (dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(() -> resetContent(town, player)); } } @Subscribe
@Subscribe public void checkPostDayChangeUpdates(ElectionWinnerNotification electionResult) { if (displayAtElectionDay && electionResult.getElectionType().equals(EElectionType.ALDERMAN) && electionResult.getCity().equals(city.getCity())) { ICity town = city.getCity(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getAldermanElectionDate(); if (!dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(this::resetContent); } } } private StyleableObjectProperty<Font> font;
@Override public void handleShipEntersPort(ShipEntersPortEvent event) { super.handleShipEntersPort(event); LocalDateTime now = date.getCurrentDate(); if (now.isAfter(deadline)) { clientEventBus.post(new DisplayMessage("ch.sahits.game.event.handler.impl.NextCourierPatrolStation.unreliable")); clientServerEventBus.unregister(this); clientServerEventBus.unregister(atackListener); } }
@Subscribe public void checkPostDayChangeUpdates(ElectionWinnerNotification electionResult) { if (displayAtElectionDay && electionResult.getElectionType().equals(EElectionType.MAYORAL) && electionResult.getCity().equals(city.getCity())) { ICity town = city.getCity(); IPlayer player = city.getPlayer(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getElectionDate(); if (!dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(() -> resetContent(town, player)); } } }
protected CelebrationState createCelebrationState(CelebrationSuccess success, int attendance) { return CelebrationState.builder() .date(date.getCurrentDate()) .amountGuests(attendance) .location(city.getName()) .success(success) .build(); }
@Override protected MarriageCelebrationState createCelebrationState(CelebrationSuccess success, int attendance) { return MarriageCelebrationState.builder() .date(date.getCurrentDate()) .amountGuests(attendance) .location(getCity().getName()) .success(success) .spouseData(spouseData) .build(); } }
@Override public boolean execute() { unregisterEventBus(); if (hasShipEnoughCapacity(getShip(), requiredAmount)) { IShip s = (IShip) getShip(); s.setOccupiedSpace(requiredAmount + s.getOccupiedSpace()); LocalDateTime waitTenDays = getDate().getCurrentDate().plusDays(10); eventHandlerFactory.getDeliverPackagesHandler(getCity(), s, waitTenDays, premium, requiredAmount); return true; } return false; }
private MarriageBrokerAnnouncementState createMarriageBrokerAnnouncementState(ShipEntersPortEvent event, INavigableVessel ship) { return MarriageBrokerAnnouncementState.builder() .date(date.getCurrentDate()) .location(event.getCity().getName()) .fromFirstName(maleFirstNameLoader.getRandomName()) .fromLastName(lastNameLoader.getRandomName()) .toLastName(ship.getOwner().getLastName()) .genderMale(((IPlayer) ship.getOwner()).getPersonalData().isMale()) .build(); }