@Override public void run() { if (run) { if (auction instanceof IShipAuction) { if (auction.getOwner().isPresent()) { IShipAuction shipAuction = (IShipAuction) auction; clientServerEventBus.post(new ShipNotAuctioned(shipAuction.getAuctionedShip(), shipAuction.getOwner().get())); } } else { IBuildingAuction buildingAuction = (IBuildingAuction) auction; clientServerEventBus.post(new BuildingNotAuctioned(buildingAuction.getAuctionedBuilding(), buildingAuction.getOwner().get())); } } } };
private void addAuctionDescription(VBox box, IAuction nextAuction) { if (nextAuction instanceof IBuildingAuction) { IBuilding building = ((IBuildingAuction) nextAuction).getAuctionedBuilding(); IPlayer owner = nextAuction.getOwner().get(); String name = owner.getName()+" "+owner.getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.buildingAuction", new Object[]{modelTranslations.getLocalDisplayName(building), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("buildingAuction"); box.getChildren().add(dt); } else { IShip ship = ((IShipAuction)nextAuction).getAuctionedShip(); String name = ship.getOwner().getName()+" "+ship.getOwner().getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.shipAuction", new Object[]{ship.getName(), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("shipAuction"); box.getChildren().add(dt); } box.getChildren().add(dialogHelper.createVerticalSpacer(20)); }
} else { IBuildingAuction buildingAuction = (IBuildingAuction) auction; clientServerEventBus.post(new BuildingAuctionFinished(buildingAuction.getAuctionedBuilding(), newOwner));