Shift CommonAPI initialization forward to ServerAboutToStart

This commit is contained in:
Mike Primm 2022-03-30 22:55:49 -05:00
parent 7268db3ed2
commit 75789b29a6
7 changed files with 24 additions and 9 deletions

View File

@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.SidedProxy;
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.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
@ -108,7 +109,7 @@ public class DynmapMod
private MinecraftServer server;
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
public void serverStarting(FMLServerAboutToStartEvent event) {
server = event.getServer();
}

View File

@ -20,6 +20,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.FMLNetworkConstants;
@ -111,10 +112,14 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
public void onServerAboutToStartStarting(FMLServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);
}
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
plugin.onStarting(event.getCommandDispatcher());
}

View File

@ -21,6 +21,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.FMLNetworkConstants;
@ -112,10 +113,14 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);
}
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
plugin.onStarting(event.getCommandDispatcher());
}

View File

@ -20,6 +20,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.FMLNetworkConstants;
@ -111,7 +112,7 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
public void onServerStarting(FMLServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);

View File

@ -21,6 +21,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
import net.minecraftforge.fmlserverevents.FMLServerAboutToStartEvent;
import net.minecraftforge.fmlserverevents.FMLServerStartedEvent;
import net.minecraftforge.fmlserverevents.FMLServerStartingEvent;
import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent;
@ -113,7 +114,7 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
public void onServerStarting(FMLServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);

View File

@ -11,6 +11,7 @@ import org.dynmap.forge_1_18_2.DynmapPlugin.OurLog;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.server.ServerAboutToStartEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
@ -113,7 +114,7 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {
public void onServerStarting(ServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);

View File

@ -11,6 +11,7 @@ import org.dynmap.forge_1_18.DynmapPlugin.OurLog;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.server.ServerAboutToStartEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
@ -113,7 +114,7 @@ public class DynmapMod
private MinecraftServer server;
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {
public void onServerStarting(ServerAboutToStartEvent event) {
server = event.getServer();
if(plugin == null)
plugin = proxy.startServer(server);