Fixed npc not spawning and saving at all

This commit is contained in:
D3v1s0m 2023-06-23 11:24:39 +05:30
parent d91d86ca88
commit 9c96be96db
No known key found for this signature in database
GPG Key ID: 3B6EC35367B8D82E

@ -136,7 +136,7 @@ public class NpcRegistryImpl implements NpcRegistry {
if (npcIdLookupMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!"); if (npcIdLookupMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!");
NpcImpl npc = new NpcImpl(UUID.randomUUID(), configManager, textSerializer, world, type, location, packetFactory); NpcImpl npc = new NpcImpl(UUID.randomUUID(), configManager, textSerializer, world, type, location, packetFactory);
NpcEntryImpl entry = new NpcEntryImpl(id, npc); NpcEntryImpl entry = new NpcEntryImpl(id, npc);
npcIdLookupMap.put(id, entry); register(entry);
return entry; return entry;
} }
@ -144,7 +144,7 @@ public class NpcRegistryImpl implements NpcRegistry {
public void delete(String id) { public void delete(String id) {
id = id.toLowerCase(); id = id.toLowerCase();
if (!npcIdLookupMap.containsKey(id)) return; if (!npcIdLookupMap.containsKey(id)) return;
npcIdLookupMap.remove(id).getNpc().delete(); unregister(npcIdLookupMap.get(id));
} }
public void unload() { public void unload() {