mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-01 07:03:55 +01:00
Check for Citizens prior to player death, fixes #886
This commit is contained in:
parent
b1a42e4426
commit
1e29ad1436
@ -3280,11 +3280,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player can use Quests
|
||||
*
|
||||
* @param uuid the entity UUID to be checked
|
||||
* @return {@code true} if entity is a Player that has permission
|
||||
*/
|
||||
public boolean canUseQuests(UUID uuid) {
|
||||
return !checkQuester(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player CANNOT use Quests
|
||||
*
|
||||
* @param uuid the entity UUID to be checked
|
||||
* @return {@code true} if entity has no permission or is not a player
|
||||
* @deprecated Use #canUseQuests
|
||||
*/
|
||||
public boolean checkQuester(UUID uuid) {
|
||||
if (!(Bukkit.getPlayer(uuid) instanceof Player)) {
|
||||
|
@ -703,7 +703,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if damager is blacklisted. Ensures damager is Player and not NPC. Kills target Player if objective exists
|
||||
* Checks if damager is blacklisted. Ensures damager and target are Player and not NPC. Kills target Player if objective exists
|
||||
*
|
||||
* @param damager the attacking entity
|
||||
* @param target the entity being attacked
|
||||
@ -713,10 +713,12 @@ public class PlayerListener implements Listener {
|
||||
if (plugin.checkQuester(damager.getUniqueId()) == true) {
|
||||
return;
|
||||
}
|
||||
//Ensure damager is player AND not an NPC
|
||||
if (damager instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(damager)) {
|
||||
//If target is player AND not an NPC...
|
||||
if (target instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||
if (damager instanceof Player && target instanceof Player) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(damager) && CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "killPlayer")) {
|
||||
@ -725,7 +727,6 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerFish(PlayerFishEvent evt) {
|
||||
|
Loading…
Reference in New Issue
Block a user