From 0dc4ddca0fd5ae4933298fcc71541460be58a476 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 5 Jan 2018 19:45:51 -0500 Subject: [PATCH] Fixes de-syncing problem with Factory and their NPCs --- .../src/main/java/net/simon987/npcplugin/Factory.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/Factory.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/Factory.java index d77a572..91f4310 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/Factory.java +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/Factory.java @@ -54,9 +54,12 @@ public class Factory extends GameObject implements Updatable { for (Object id : tmpNpcArray) { NonPlayerCharacter npc = (NonPlayerCharacter) GameServer.INSTANCE.getGameUniverse().getObject((int) (long) id); - npc.setFactory(this); - npcs.add(npc); + if (npc != null) { + npc.setFactory(this); + npcs.add(npc); + } + } } else {