mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Wait for response before marking a server as registered
This commit is contained in:
parent
6890b94b16
commit
9bf1bb0710
@ -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 {
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user