update world in EMDNUpdater on reinit app
This commit is contained in:
@@ -15,9 +15,11 @@ import java.util.function.Consumer;
|
||||
public class EMDNUpdater {
|
||||
private final static Logger LOG = LoggerFactory.getLogger(EMDNUpdater.class);
|
||||
private static EMDN emdn;
|
||||
private static MarketUpdater updater;
|
||||
|
||||
static void init(){
|
||||
emdn = new EMDN(Main.SETTINGS.getEMDNSub(), new MarketUpdater(MainController.getWorld()));
|
||||
updater = new MarketUpdater(MainController.getWorld());
|
||||
emdn = new EMDN(Main.SETTINGS.getEMDNSub(), updater);
|
||||
setActivate(Main.SETTINGS.getEMDNActive());
|
||||
}
|
||||
|
||||
@@ -37,16 +39,27 @@ public class EMDNUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setWorld(MarketModel world){
|
||||
if (updater != null){
|
||||
updater.setWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class MarketUpdater implements Consumer<Message> {
|
||||
private final StationUpdater updater;
|
||||
private final MarketModel world;
|
||||
private StationUpdater updater;
|
||||
private MarketModel world;
|
||||
|
||||
public MarketUpdater(MarketModel world) {
|
||||
this.world = world;
|
||||
this.updater = new StationUpdater(world);
|
||||
}
|
||||
|
||||
public void setWorld(MarketModel world){
|
||||
this.updater = new StationUpdater(world);
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(Message message) {
|
||||
if (world == null || message == null) return;
|
||||
|
||||
@@ -11,6 +11,7 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Pair;
|
||||
import ru.trader.EMDNUpdater;
|
||||
import ru.trader.core.Engine;
|
||||
import ru.trader.core.MarketFilter;
|
||||
import ru.trader.core.VendorFilter;
|
||||
@@ -368,6 +369,7 @@ public class Screeners {
|
||||
filterController.init();
|
||||
vFilterController.init();
|
||||
dbEditorController.init();
|
||||
EMDNUpdater.setWorld(MainController.getWorld());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user