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.FMLServerAboutToStartEvent;
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.network.NetworkRegistry;
@ -237,6 +238,12 @@ public final class AppEng
private void serverStopping( final FMLServerStoppingEvent event )
{
WorldData.instance().onServerStopping();
}
@EventHandler
private void serverStopped( final FMLServerStoppedEvent event )
{
WorldData.instance().onServerStoppped();
TickHandler.INSTANCE.shutdown();
}

View File

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

View File

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