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> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUtil</artifactId> <artifactId>GalaxiUtil</artifactId>
<version>21w08m</version> <version>21w09e</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId> <artifactId>GalaxiEngine</artifactId>
<version>21w08m</version> <version>21w09e</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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