mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 13:15:33 +01:00
Implement new method
This commit is contained in:
parent
cc68593afe
commit
74f6c0c543
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user