mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Verify compatibility of ZNPCsPlus version
This commit is contained in:
parent
4a935b0346
commit
2e6ab6c038
@ -23,6 +23,7 @@ import io.github.znetworkw.znpcservers.npc.NPC;
|
|||||||
import lol.pyr.znpcsplus.ZNPCsPlus;
|
import lol.pyr.znpcsplus.ZNPCsPlus;
|
||||||
import me.pikamug.quests.BukkitQuestsPlugin;
|
import me.pikamug.quests.BukkitQuestsPlugin;
|
||||||
import me.pikamug.quests.listeners.BukkitCitizensListener;
|
import me.pikamug.quests.listeners.BukkitCitizensListener;
|
||||||
|
import me.pikamug.quests.listeners.BukkitZnpcsListener;
|
||||||
import me.pikamug.quests.player.Quester;
|
import me.pikamug.quests.player.Quester;
|
||||||
import me.pikamug.quests.dependencies.reflect.denizen.DenizenAPI;
|
import me.pikamug.quests.dependencies.reflect.denizen.DenizenAPI;
|
||||||
import me.pikamug.quests.dependencies.reflect.worldguard.WorldGuardAPI;
|
import me.pikamug.quests.dependencies.reflect.worldguard.WorldGuardAPI;
|
||||||
@ -195,12 +196,33 @@ public class BukkitDependencies implements Dependencies {
|
|||||||
|
|
||||||
public ZNPCsPlus getZnpcsPlus() {
|
public ZNPCsPlus getZnpcsPlus() {
|
||||||
if (znpcsPlus == null) {
|
if (znpcsPlus == null) {
|
||||||
znpcsPlus = (ZNPCsPlus) plugin.getServer().getPluginManager().getPlugin("ZNPCsPlus");
|
linkZnpcsPlus();
|
||||||
startNpcEffectThread();
|
|
||||||
}
|
}
|
||||||
return znpcsPlus;
|
return znpcsPlus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void linkZnpcsPlus() {
|
||||||
|
if (isPluginAvailable("ZNPCsPlus")) {
|
||||||
|
try {
|
||||||
|
znpcsPlus = (ZNPCsPlus) plugin.getServer().getPluginManager().getPlugin("ZNPCsPlus");
|
||||||
|
boolean found = false;
|
||||||
|
for (final RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) {
|
||||||
|
if (listener.getListener() instanceof BukkitZnpcsListener) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(plugin.getZnpcsListener(), plugin);
|
||||||
|
startNpcEffectThread();
|
||||||
|
plugin.getLogger().info("Successfully linked Quests with ZNPCsPlus "
|
||||||
|
+ znpcsPlus.getDescription().getVersion());
|
||||||
|
}
|
||||||
|
} catch (final Exception e) {
|
||||||
|
plugin.getLogger().warning("Incompatible version of ZNPCsPlus found. ZNPCsPlus in Quests not enabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Set<UUID> getZnpcsPlusUuids() {
|
public Set<UUID> getZnpcsPlusUuids() {
|
||||||
if (znpcsPlus != null && isPluginAvailable("ZNPCsPlus")) {
|
if (znpcsPlus != null && isPluginAvailable("ZNPCsPlus")) {
|
||||||
return io.github.znetworkw.znpcservers.npc.NPC.all().stream()
|
return io.github.znetworkw.znpcservers.npc.NPC.all().stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user