Cleanup
This commit is contained in:
parent
bbfe4db3b1
commit
c5a72417d0
|
@ -25,8 +25,7 @@ public class CivilEngineering {
|
|||
public static CivilEngineering instance;
|
||||
|
||||
public static Logger logger;
|
||||
public static Thread incomingMessageThread = new Thread(new MessageHandler());
|
||||
//public static Thread outgoingMessageThread = new Thread(new OutgoingMessageHandler());
|
||||
public static Thread MessageNetworkThread = new Thread(new MessageHandler());
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
@ -48,13 +47,11 @@ public class CivilEngineering {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event){
|
||||
logger.info("Building chat bridge");
|
||||
FMLEventHandler.serverStarting(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
logger.info("Demolishing chat bridge.");
|
||||
FMLEventHandler.serverStopping(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class OutgoingMessageHandler implements Runnable {
|
|||
if (e instanceof InterruptedException) {
|
||||
CivilEngineering.logger.info("Sending connection closed.");
|
||||
} else if (e instanceof IOException) {
|
||||
CivilEngineering.incomingMessageThread.interrupt();
|
||||
CivilEngineering.MessageNetworkThread.interrupt();
|
||||
CivilEngineering.logger.error("Error connecting to bridge server!");
|
||||
CivilEngineering.logger.error(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ public class BridgeCommand extends CommandBase {
|
|||
}
|
||||
String cmd = args[0];
|
||||
if (cmd.toLowerCase().equals("connect")) {
|
||||
if(!CivilEngineering.incomingMessageThread.isAlive()) {
|
||||
CivilEngineering.incomingMessageThread = new Thread(new MessageHandler());
|
||||
CivilEngineering.incomingMessageThread.start();
|
||||
if(!CivilEngineering.MessageNetworkThread.isAlive()) {
|
||||
CivilEngineering.MessageNetworkThread = new Thread(new MessageHandler());
|
||||
CivilEngineering.MessageNetworkThread.start();
|
||||
}
|
||||
} else if (cmd.toLowerCase().equals("disconnect")) {
|
||||
CivilEngineering.incomingMessageThread.interrupt();
|
||||
CivilEngineering.MessageNetworkThread.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ public class FMLEventHandler {
|
|||
|
||||
public static void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new BridgeCommand());
|
||||
CivilEngineering.incomingMessageThread.start();
|
||||
CivilEngineering.MessageNetworkThread.start();
|
||||
}
|
||||
|
||||
public static void serverStopping(FMLServerStoppingEvent event) {
|
||||
CivilEngineering.incomingMessageThread.interrupt();
|
||||
CivilEngineering.MessageNetworkThread.interrupt();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue