From 74f6c0c5431b5ec87a5d79a992fccde6b391a8ae Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 12 Jan 2014 22:27:25 +0800 Subject: [PATCH] Implement new method --- .../java/net/citizensnpcs/npc/CitizensNPCRegistry.java | 8 +++++++- src/main/java/net/citizensnpcs/npc/NPCSelector.java | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java b/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java index 282117ca5..182dd2533 100644 --- a/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java +++ b/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java @@ -95,7 +95,12 @@ public class CitizensNPCRegistry implements NPCRegistry { @Override public NPC getByUniqueId(UUID uuid) { - NPC npc = npcs.get(uuid); + return npcs.get(uuid); + } + + @Override + public NPC getByUniqueIdGlobal(UUID uuid) { + NPC npc = getByUniqueId(uuid); if (npc != null) return npc; for (NPCRegistry registry : CitizensAPI.getNPCRegistries()) { @@ -232,6 +237,7 @@ public class CitizensNPCRegistry implements NPCRegistry { return o1.getId() - o2.getId(); } }; + private static boolean TROVE_EXISTS = false; static { // allow trove dependency to be optional for debugging purposes diff --git a/src/main/java/net/citizensnpcs/npc/NPCSelector.java b/src/main/java/net/citizensnpcs/npc/NPCSelector.java index 69f0948d4..bddd5ecdd 100644 --- a/src/main/java/net/citizensnpcs/npc/NPCSelector.java +++ b/src/main/java/net/citizensnpcs/npc/NPCSelector.java @@ -48,7 +48,7 @@ public class NPCSelector implements Listener, net.citizensnpcs.api.npc.NPCSelect } else if (sender instanceof ConsoleCommandSender) { if (consoleSelectedNPC == null) return null; - return CitizensAPI.getNPCRegistry().getByUniqueId(consoleSelectedNPC); + return CitizensAPI.getNPCRegistry().getByUniqueIdGlobal(consoleSelectedNPC); } return null; } @@ -57,7 +57,7 @@ public class NPCSelector implements Listener, net.citizensnpcs.api.npc.NPCSelect List metadata = sender.getMetadata("selected"); if (metadata.size() == 0) return null; - return CitizensAPI.getNPCRegistry().getByUniqueId((UUID) metadata.get(0).value()); + return CitizensAPI.getNPCRegistry().getByUniqueIdGlobal((UUID) metadata.get(0).value()); } @EventHandler