Working on network handler
This commit is contained in:
parent
9ee1354874
commit
2c644deb5a
|
@ -1,6 +1,7 @@
|
|||
package arcanitor.civilengineering;
|
||||
|
||||
import arcanitor.civilengineering.eventhandlers.FMLEventHandler;
|
||||
import arcanitor.civilengineering.network.NetworkHandler;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -22,6 +23,7 @@ public class CivilEngineering {
|
|||
public static CivilEngineering instance;
|
||||
|
||||
public static Logger logger;
|
||||
public static Thread networkThread = new Thread(new NetworkHandler());
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
|
@ -47,4 +49,9 @@ public class CivilEngineering {
|
|||
FMLEventHandler.serverStarting(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
logger.info("Demolishing chat bridge.");
|
||||
FMLEventHandler.serverStopping(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraftforge.common.config.Configuration;
|
|||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -26,6 +27,9 @@ public class FMLEventHandler {
|
|||
}
|
||||
}
|
||||
public static void serverStarting(FMLServerStartingEvent event) {
|
||||
(new Thread(new NetworkHandler())).start();
|
||||
CivilEngineering.networkThread.start();
|
||||
}
|
||||
public static void serverStopping(FMLServerStoppingEvent event) {
|
||||
CivilEngineering.networkThread.interrupt();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue