mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-24 01:58:42 +01:00
Check whether Citizens is loaded for Kill Mobs, fixes #267
This commit is contained in:
parent
87c0316ce7
commit
e014697010
@ -479,8 +479,8 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if damager is blacklisted
|
* Checks if damager is blacklisted.
|
||||||
* Ensures damager is Player and not NPC
|
* Ensures damager is Player and not NPC.
|
||||||
* Kills target mob/NPC if objective exists
|
* Kills target mob/NPC if objective exists
|
||||||
*
|
*
|
||||||
* @param damager the attacking entity
|
* @param damager the attacking entity
|
||||||
@ -491,23 +491,22 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(damager.getUniqueId()) == true) {
|
if (plugin.checkQuester(damager.getUniqueId()) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Ensure damager is Player AND not an NPC
|
if (damager instanceof Player) {
|
||||||
if (damager instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(damager)) {
|
if (plugin.citizens != null) {
|
||||||
//If target is an NPC...
|
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||||
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
if (quester.hasObjective(quest, "killNPC")) {
|
||||||
if (quester.hasObjective(quest, "killNPC")) {
|
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||||
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//No? Must be a mob...
|
}
|
||||||
} else {
|
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
if (quester.hasObjective(quest, "killMob")) {
|
||||||
if (quester.hasObjective(quest, "killMob")) {
|
quester.killMob(quest, target.getLocation(), target.getType());
|
||||||
quester.killMob(quest, target.getLocation(), target.getType());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user