lmfao i cant
This commit is contained in:
parent
af323e9cf1
commit
589d006a2d
1 changed files with 4 additions and 1 deletions
|
@ -22,6 +22,7 @@ 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.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
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;
|
||||||
|
@ -119,7 +120,8 @@ public class Main extends JavaPlugin implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void entityDamage(EntityDamageByEntityEvent e) {
|
public void entityDamage(EntityDamageByEntityEvent e) {
|
||||||
LivingEntity damager = (LivingEntity) e.getDamager();
|
LivingEntity damager = (LivingEntity) e.getDamager();
|
||||||
if (damager.getType() == EntityType.HUSK && damager.getCustomName() == "Giant") {
|
if (damager.hasMetadata("giant")) {
|
||||||
|
damager.setInvulnerable(false);
|
||||||
damager.setHealth(0);
|
damager.setHealth(0);
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -137,6 +139,7 @@ public class Main extends JavaPlugin implements Listener {
|
||||||
passenger.setCustomNameVisible(false);
|
passenger.setCustomNameVisible(false);
|
||||||
passenger.setInvulnerable(true);
|
passenger.setInvulnerable(true);
|
||||||
passenger.setPersistent(true);
|
passenger.setPersistent(true);
|
||||||
|
passenger.setMetadata("giant", new FixedMetadataValue(this, "y"));
|
||||||
entity.addPassenger(passenger);
|
entity.addPassenger(passenger);
|
||||||
}
|
}
|
||||||
for (Entry<PotionEffectType, Integer> t : effects.entrySet()) {
|
for (Entry<PotionEffectType, Integer> t : effects.entrySet()) {
|
||||||
|
|
Loading…
Reference in a new issue