@Override public void hire(IAIPlayer player, IShip vessel, ICaptain captain, ICity city) { vessel.setCaptain(captain); captainsState.hireCaptain(captain, city); clientServerEventBus.post(new PersonLeavesTavernEvent(city, captain)); } }
/** * Update the notice board when a person leaves * @param event for a person leaving the tavern */ @Subscribe public void handlePersonLeaves(PersonLeavesTavernEvent event) { // last proxy might be null if the tavern dialog is not open, which is correct synchronized (noticeBoardMenu){ if (!noticeBoardMenu.isEmpty() && lastProxy.getCity().equals(event.getCity())) { ENoticeBoardType type = noticeBoardMenu.getLast().getType(); if (lastProxy != null && lastProxy instanceof ViewChangeCityPlayerProxyJFX && type == ENoticeBoardType.TAVERN) { if (mainGameView != null) { Dialog dialog = mainGameView.getDialog(); final EDialogType mappedDialogType = map(event.getPerson()); if (dialog != null && dialog.getDialogType() == mappedDialogType) { ((CloseButtonDialog)dialog).executeOnCloseButtonClicked(); } } updateNoticeBoard((ViewChangeCityPlayerProxyJFX) lastProxy, type); } } } }
currentShip.get().setCaptain(captain); captainsState.hireCaptain(captain, city.getCity()); clientServerEventBus.post(new PersonLeavesTavernEvent(city.getCity(), captain)); executeOnCloseButtonClicked(); } catch (RuntimeException e) {