chore: Add method to delete npc using UUID
This commit is contained in:
parent
affa0f4c84
commit
c34a665692
2 changed files with 14 additions and 0 deletions
|
@ -65,6 +65,12 @@ public interface NpcRegistry {
|
|||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* Deletes an NPC entry by its UUID
|
||||
* @param uuid The UUID of the NPC entry
|
||||
*/
|
||||
void delete(UUID uuid);
|
||||
|
||||
/**
|
||||
* Register an NPC to this registry
|
||||
* NpcEntry instances can be obtained through the NpcSerializer classes
|
||||
|
|
|
@ -202,6 +202,14 @@ public class NpcRegistryImpl implements NpcRegistry {
|
|||
storage.deleteNpc(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(UUID uuid) {
|
||||
NpcEntryImpl entry = npcUuidLookupMap.get(uuid);
|
||||
if (entry == null) return;
|
||||
unregister(entry);
|
||||
storage.deleteNpc(entry);
|
||||
}
|
||||
|
||||
public void switchIds(String oldId, String newId) {
|
||||
NpcEntryImpl entry = getById(oldId);
|
||||
delete(oldId);
|
||||
|
|
Loading…
Reference in a new issue