Damager and target cannot be the same for kill objectives, fixes #1128

This commit is contained in:
PikaMug 2020-03-20 03:32:45 -04:00
parent b5bb35b043
commit b73ba750fe

View File

@ -859,14 +859,16 @@ public class PlayerListener implements Listener {
/** /**
* Checks if damager is blacklisted. Ensures damager and target are Player and not NPC. * Checks if damager is blacklisted. Ensures damager and target are Player and not NPC.
* Kills target Player if objective exists * Kills target Player if objective exists<p>
*
* As of 3.8.9, damager and target must not be the same entity
* *
* @param damager the attacking entity * @param damager the attacking entity
* @param target the entity being attacked * @param target the entity being attacked
* @since 3.1.4 * @since 3.1.4
*/ */
public void preKillPlayer(Entity damager, Entity target) { public void preKillPlayer(Entity damager, Entity target) {
if (damager == null) { if (damager == null || target == null || damager.equals(target)) {
return; return;
} }
if (!plugin.canUseQuests(damager.getUniqueId())) { if (!plugin.canUseQuests(damager.getUniqueId())) {