fixed damage transfer for mama pigglez kit
This commit is contained in:
parent
31ddeaac50
commit
8bd883cb26
@ -243,6 +243,15 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
_damagerPlayer = (Player)ent;
|
||||
}
|
||||
|
||||
public void setDamagee(LivingEntity ent)
|
||||
{
|
||||
_damageeEntity = ent;
|
||||
|
||||
_damageePlayer = null;
|
||||
if (ent instanceof Player)
|
||||
_damageePlayer = (Player)ent;
|
||||
}
|
||||
|
||||
public void changeReason(String initial, String reason)
|
||||
{
|
||||
for (DamageChange change : _damageMod)
|
||||
@ -307,4 +316,6 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
{
|
||||
SetCancelled("No reason given because SOMEONE IS AN IDIOT");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,17 @@ package nautilus.game.arcade.game.games.baconbrawl.kits;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguisePig;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
@ -69,4 +72,21 @@ public class KitMamaPig extends Kit
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void damageTransfer(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Pig))
|
||||
return;
|
||||
|
||||
Pig pig = (Pig)event.GetDamageeEntity();
|
||||
|
||||
if (pig.getVehicle() == null || !(pig.getPassenger() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
event.setDamagee((LivingEntity)pig.getVehicle());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user