SG - Spectators can no longer punch fireballs from the world border
This commit is contained in:
Sam 2016-08-10 21:46:37 +01:00
parent a02699d84a
commit df646b0659

View File

@ -34,6 +34,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
@ -1262,7 +1263,7 @@ public abstract class SurvivalGames extends Game
if (!(event.getEntity() instanceof Fireball))
return;
Collection<Block> blocks = UtilBlock.getInRadius(
event.getEntity().getLocation(), 2.4).keySet();
@ -1284,6 +1285,15 @@ public abstract class SurvivalGames extends Game
return sides >= 3;
}
@EventHandler
public void borderSpecInteraction(EntityDamageByEntityEvent event)
{
if (event.getEntity() instanceof Fireball && UtilPlayer.isSpectator(event.getDamager()))
{
event.setCancelled(true);
}
}
@EventHandler
public void borderDamage(CustomDamageEvent event)