From 1aeea1ef6ddd3da7e851e6dfe949ee9acc737d28 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 3 May 2016 21:32:51 +0200 Subject: [PATCH] Unload the fake player when leaving a world so that it doesn't persist and break stuff --- .../actuallyadditions/mod/event/WorldLoadingEvents.java | 2 ++ .../de/ellpeck/actuallyadditions/mod/util/FakePlayerUtil.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java index fe7e47fe2..00459099a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldLoadingEvents.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.event; import de.ellpeck.actuallyadditions.mod.misc.WorldData; +import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -24,6 +25,7 @@ public class WorldLoadingEvents{ @SubscribeEvent public void onUnload(WorldEvent.Unload event){ WorldData.makeDirty(); + FakePlayerUtil.unloadFakePlayer(); } @SubscribeEvent diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FakePlayerUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FakePlayerUtil.java index 234f21180..89eed29d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FakePlayerUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FakePlayerUtil.java @@ -39,4 +39,8 @@ public class FakePlayerUtil{ return null; } } + + public static void unloadFakePlayer(){ + theFakePlayer = null; + } }