diff --git a/src/main/java/arcanitor/civilengineering/CivilEngineering.java b/src/main/java/arcanitor/civilengineering/CivilEngineering.java index fd1c5fa..05fc6ed 100644 --- a/src/main/java/arcanitor/civilengineering/CivilEngineering.java +++ b/src/main/java/arcanitor/civilengineering/CivilEngineering.java @@ -2,9 +2,7 @@ package arcanitor.civilengineering; import arcanitor.civilengineering.eventhandlers.FMLEventHandler; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.*; import org.apache.logging.log4j.Logger; @Mod( @@ -40,9 +38,13 @@ public class CivilEngineering { @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { - logger.info("Bridge building post-init."); - FMLEventHandler.postInit(event); } + @Mod.EventHandler + public void serverStarting(FMLServerStartingEvent event){ + logger.info("Building chat bridge"); + FMLEventHandler.serverStarting(event); + } + } diff --git a/src/main/java/arcanitor/civilengineering/eventhandlers/FMLEventHandler.java b/src/main/java/arcanitor/civilengineering/eventhandlers/FMLEventHandler.java index 76a3eaf..2b8cc1b 100644 --- a/src/main/java/arcanitor/civilengineering/eventhandlers/FMLEventHandler.java +++ b/src/main/java/arcanitor/civilengineering/eventhandlers/FMLEventHandler.java @@ -3,9 +3,11 @@ package arcanitor.civilengineering.eventhandlers; import arcanitor.civilengineering.CivilEngineering; import arcanitor.civilengineering.Config; +import arcanitor.civilengineering.network.NetworkHandler; 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 java.io.File; @@ -23,4 +25,7 @@ public class FMLEventHandler { config.save(); } } + public static void serverStarting(FMLServerStartingEvent event) { + (new Thread(new NetworkHandler())).start(); + } } diff --git a/src/main/java/arcanitor/civilengineering/network/NetworkHandler.java b/src/main/java/arcanitor/civilengineering/network/NetworkHandler.java index 49dbe16..0585986 100644 --- a/src/main/java/arcanitor/civilengineering/network/NetworkHandler.java +++ b/src/main/java/arcanitor/civilengineering/network/NetworkHandler.java @@ -6,8 +6,4 @@ public class NetworkHandler implements Runnable { public void run() { CivilEngineering.logger.info("Network Thread"); } - - public static void Main(String[] args) { - (new Thread(new NetworkHandler())).start(); - } }