im so dumb

This commit is contained in:
Minecon724 2022-01-29 18:05:54 +01:00
parent c78dc34f73
commit 3e183bb48e
1 changed files with 5 additions and 8 deletions

View File

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