lmfao i cant

This commit is contained in:
Minecon724 2022-01-29 17:53:44 +01:00
parent af323e9cf1
commit 589d006a2d

View file

@ -22,6 +22,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
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;
@ -119,7 +120,8 @@ public class Main extends JavaPlugin implements Listener {
@EventHandler
public void entityDamage(EntityDamageByEntityEvent e) {
LivingEntity damager = (LivingEntity) e.getDamager();
if (damager.getType() == EntityType.HUSK && damager.getCustomName() == "Giant") {
if (damager.hasMetadata("giant")) {
damager.setInvulnerable(false);
damager.setHealth(0);
e.setCancelled(true);
}
@ -137,6 +139,7 @@ public class Main extends JavaPlugin implements Listener {
passenger.setCustomNameVisible(false);
passenger.setInvulnerable(true);
passenger.setPersistent(true);
passenger.setMetadata("giant", new FixedMetadataValue(this, "y"));
entity.addPassenger(passenger);
}
for (Entry<PotionEffectType, Integer> t : effects.entrySet()) {