Wait for response before marking a server as registered

This commit is contained in:
ME1312 2021-08-02 18:33:10 -04:00
parent 6890b94b16
commit 9bf1bb0710
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
2 changed files with 9 additions and 3 deletions

View File

@ -177,9 +177,9 @@ public class ExternalHost extends Host implements ClientHandler {
plugin.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
queue(new PacketExAddServer(((ExternalSubServer) server), (server.isRunning())?((ExternalSubLogger) server.getLogger()).getExternalAddress():null, data -> {
((ExternalSubServer) server).registered(true);
if (data.contains(0x0002)) ((ExternalSubServer) server).started(data.getUUID(0x0002));
}));
((ExternalSubServer) server).registered(true);
servers.put(server.getName().toLowerCase(), server);
return true;
} else {

View File

@ -220,8 +220,14 @@ public class ExternalSubCreator extends SubCreator {
}
host.addSubServer(subserver);
if (update == null && template.getBuildOptions().getBoolean("Run-On-Finish", true))
subserver.start();
if (update == null && template.getBuildOptions().getBoolean("Run-On-Finish", true)) {
while (!subserver.isAvailable() && host.isAvailable()) {
Thread.sleep(250);
}
if (subserver.isAvailable()) {
subserver.start();
}
}
}
host.plugin.getPluginManager().callEvent(new SubCreatedEvent(player, host, name, template, version, port, subserver, update != null, true));