@EventHandler public void onEntityShootBow(EntityShootBowEvent event) { if (!ScrimMatchHandler.isRunning()) { event.setCancelled(true); return; } if (event.getEntity() instanceof Player) { if (ScrimTeamHandler.isObserver((Player) event.getEntity())) { event.setCancelled(true); } } }
@EventHandler public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (!ScrimMatchHandler.isRunning() || !Scrimmage.pvp) { event.setCancelled(true); return; } if (event.getDamager() instanceof Player) { Player damager = (Player) event.getDamager(); if (ScrimTeamHandler.isObserver(damager)) { event.setCancelled(true); return; } } else if (event.getDamager() instanceof Projectile) { Projectile proj = (Projectile) event.getDamager(); if (proj.getShooter() instanceof Player) { Player shooter = (Player) proj.getShooter(); if (ScrimTeamHandler.isObserver(shooter)) { event.setCancelled(true); return; } } } }
@EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) { if (!ScrimMatchHandler.isRunning() || event.getEntity() instanceof Monster) { event.setCancelled(true); } }
@EventHandler public void onEntityExplode(EntityExplodeEvent event) { if (!ScrimMatchHandler.isRunning()) { event.setCancelled(true); } }
@EventHandler public void onEntityBlockForm(EntityBlockFormEvent event) { if (!ScrimMatchHandler.isRunning()) { event.setCancelled(true); } }