mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-29 04:18:07 +01:00
PetPay fix for mythicmobs plugin
This commit is contained in:
parent
6dd5ff0907
commit
3a2b60db89
@ -1,11 +1,18 @@
|
||||
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.MMKillInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
@ -35,6 +42,23 @@ public final class MythicMobs5Listener implements Listener {
|
||||
// Checking if killer is tamed animal
|
||||
else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
ent = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||
|
||||
if (ent instanceof Tameable) {
|
||||
Tameable tamed = (Tameable) ent;
|
||||
|
||||
if (tamed.getOwner() == null)
|
||||
return;
|
||||
|
||||
@NotNull
|
||||
UUID uuid = tamed.getOwner().getUniqueId();
|
||||
|
||||
@Nullable
|
||||
Player owner = Bukkit.getPlayer(uuid);
|
||||
|
||||
if (owner != null)
|
||||
pDamager = owner;
|
||||
|
||||
}
|
||||
} else
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user