Fix for the "npc" field in npc events/scripts.

This commit is contained in:
Luis C.M committed 2022-05-11 22:55:26 -05:00
1 parent b20babbb35
commit 02d225a269
2 files changed
+6 -2

No files matched your search

+5 -1
View File
@@ -15,6 +15,7 @@ import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.IScriptHandler;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.entity.ScriptNpc;
import noppes.npcs.scripted.event.ScriptEvent;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.constants.EntityType;
@@ -46,7 +47,10 @@ public class DataScript implements IScriptHandler {
}
this.npc = npc;
dummyNpc = (ICustomNpc) NpcAPI.Instance().getIEntity(npc);
if (npc.wrappedNPC == null) {
npc.wrappedNPC = new ScriptNpc(this.npc);
}
dummyNpc = npc.wrappedNPC;
if(npc.worldObj instanceof WorldServer)
dummyWorld = NpcAPI.Instance().getIWorld((WorldServer) npc.worldObj);//new ScriptWorld((WorldServer) npc.worldObj);