Fixes #1983: WorldData cleared too early when still needed.

This commit is contained in:
yueh 2015-11-02 12:13:09 +01:00
parent e922bf02d4
commit 9fd183900a
3 changed files with 17 additions and 5 deletions

View file

@ -37,6 +37,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
@ -237,6 +238,12 @@ public final class AppEng
private void serverStopping( final FMLServerStoppingEvent event ) private void serverStopping( final FMLServerStoppingEvent event )
{ {
WorldData.instance().onServerStopping(); WorldData.instance().onServerStopping();
}
@EventHandler
private void serverStopped( final FMLServerStoppedEvent event )
{
WorldData.instance().onServerStoppped();
TickHandler.INSTANCE.shutdown(); TickHandler.INSTANCE.shutdown();
} }

View file

@ -24,13 +24,15 @@ import javax.annotation.Nonnull;
/** /**
* @author thatsIch * @author thatsIch
* @version rv3 - 30.05.2015 * @version rv3 - 02.11.2015
* @since rv3 30.05.2015 * @since rv3 30.05.2015
*/ */
public interface IWorldData public interface IWorldData
{ {
void onServerStopping(); void onServerStopping();
void onServerStoppped();
@Nonnull @Nonnull
IWorldGridStorageData storageData(); IWorldGridStorageData storageData();

View file

@ -45,7 +45,7 @@ import appeng.services.compass.CompassThreadFactory;
* different worlds. * different worlds.
* *
* @author thatsIch * @author thatsIch
* @version rv3 - 30.05.2015 * @version rv3 - 02.11.2015
* @since rv3 30.05.2015 * @since rv3 30.05.2015
*/ */
public final class WorldData implements IWorldData public final class WorldData implements IWorldData
@ -162,15 +162,18 @@ public final class WorldData implements IWorldData
@Override @Override
public void onServerStopping() public void onServerStopping()
{ {
Preconditions.checkNotNull( instance );
for( final IOnWorldStoppable stoppable : this.stoppables ) for( final IOnWorldStoppable stoppable : this.stoppables )
{ {
stoppable.onWorldStop(); stoppable.onWorldStop();
} }
}
@Override
public void onServerStoppped()
{
Preconditions.checkNotNull( instance );
this.stoppables.clear(); this.stoppables.clear();
instance = null; instance = null;
} }