Implement new method

This commit is contained in:
fullwall 2014-01-12 22:27:25 +08:00
parent cc68593afe
commit 74f6c0c543
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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<MetadataValue> 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