Set running to TRUE while running start event

This commit is contained in:
ME1312 2021-02-24 17:09:25 -05:00
parent 59d3404abf
commit f90a54e636
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
9 changed files with 23 additions and 17 deletions

View File

@ -30,13 +30,13 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -30,14 +30,14 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -103,19 +103,22 @@ public class ExternalSubServer extends SubServerImpl {
lock = true;
SubStartEvent event = new SubStartEvent(player, this);
host.plugin.getPluginManager().callEvent(event);
lock = false;
if (!event.isCancelled()) {
Logger.get("SubServers").info("Now starting " + getName());
started(null);
host.queue(new PacketExEditServer(this, PacketExEditServer.UpdateType.START, logger.getExternalAddress().toString()));
return true;
} else return false;
} else {
lock = false;
return false;
}
} else return false;
}
void started(UUID address) {
if (!running) {
started = false;
running = true;
lock = false;
logger.start();
if (address != null) {
if (address != logger.getExternalAddress()) host.queue(new PacketExEditServer(this, PacketExEditServer.UpdateType.SET_LOGGING_ADDRESS, logger.getExternalAddress().toString()));
@ -500,7 +503,7 @@ public class ExternalSubServer extends SubServerImpl {
@Override
public boolean isRunning() {
return running;
return running || lock;
}
@Override

View File

@ -137,6 +137,7 @@ public class InternalSubServer extends SubServerImpl {
}
private void run() {
lock = false;
allowrestart = true;
started = false;
try {
@ -213,11 +214,13 @@ public class InternalSubServer extends SubServerImpl {
lock = true;
SubStartEvent event = new SubStartEvent(player, this);
host.plugin.getPluginManager().callEvent(event);
lock = false;
if (!event.isCancelled()) {
(thread = new Thread(this::run, "SubServers.Bungee::Internal_Server_Process_Handler(" + getName() + ')')).start();
return true;
} else return false;
} else {
lock = false;
return false;
}
} else return false;
}
@ -560,7 +563,7 @@ public class InternalSubServer extends SubServerImpl {
@Override
public boolean isRunning() {
return process != null && process.isAlive();
return (process != null && process.isAlive()) || lock;
}
@Override

View File

@ -48,7 +48,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

View File

@ -33,14 +33,14 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUI</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>

View File

@ -30,14 +30,14 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>21w08m</version>
<version>21w09e</version>
<scope>provided</scope>
</dependency>
<dependency>