mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-14 06:14:52 +00:00
Drop the shutdown flush that does not compile
The FMLServerStoppingEvent handler added in 1.11.2-beta1 calls
PlayerData.flushEffects() and PlayerData.save(boolean), and neither method
exists -- so the mod has not compiled since that commit.
Removed along with the four imports the same commit added for it:
FMLServerStoppingEvent, EntityPlayer, PlayerData and ArrayList. Nothing else in
the class used them, so CustomNpcs.java now differs from 8612d444 only by the
version bump.
The problem it was written for is real -- effects live in memory, and logout is
not guaranteed to fire during shutdown -- but the flush needs methods that have
to be written first.
This commit is contained in:
1 parent
5403060ee5
commit
517ccb09c3
1 file changed
-29
@@ -11,7 +11,6 @@ import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -50,7 +49,6 @@ import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -91,7 +89,6 @@ import noppes.npcs.controllers.ServerTagMapController;
|
||||
import noppes.npcs.controllers.SpawnController;
|
||||
import noppes.npcs.controllers.TagController;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.enchants.EnchantInterface;
|
||||
import noppes.npcs.entity.EntityChairMount;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
@@ -124,7 +121,6 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
import somehussar.janino.AdvancedClassFilter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
@@ -430,31 +426,6 @@ public class CustomNpcs {
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void stopping(FMLServerStoppingEvent event) {
|
||||
// Fired while everyone is still connected. Custom effects (and any other
|
||||
// player data changed since the last save) only live in memory, and the
|
||||
// logout event is not guaranteed to be delivered during shutdown, so flush
|
||||
// every online player synchronously here.
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
if (server == null || server.getConfigurationManager() == null)
|
||||
return;
|
||||
|
||||
for (Object obj : new ArrayList<Object>(server.getConfigurationManager().playerEntityList)) {
|
||||
if (!(obj instanceof EntityPlayer))
|
||||
continue;
|
||||
try {
|
||||
PlayerData data = PlayerData.get((EntityPlayer) obj);
|
||||
if (data != null) {
|
||||
data.flushEffects();
|
||||
data.save(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void stopped(FMLServerStoppedEvent event) {
|
||||
ServerCloneController.Instance = null;
|
||||
|
||||
Reference in new issue
Block a user