im so dumb

This commit is contained in:
Minecon724 2022-01-29 18:05:54 +01:00
parent c78dc34f73
commit 3e183bb48e

View file

@ -20,10 +20,9 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -118,12 +117,10 @@ public class Main extends JavaPlugin implements Listener {
}
@EventHandler
public void entityDamage(EntityDamageByEntityEvent e) {
LivingEntity damager = (LivingEntity) e.getDamager();
if (damager.hasMetadata("giant")) {
damager.setInvulnerable(false);
damager.setHealth(0);
e.setCancelled(true);
public void entityDeath(EntityDeathEvent e) {
Entity entity = e.getEntity();
if (entity.getType() == EntityType.GIANT) {
for (Entity p : entity.getPassengers()) ((LivingEntity) p).setHealth(0);
}
}