@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); } } }
/** * Cancels firing a bow with a disabled weapon * * @param event event details */ @EventHandler public void onShoot(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { if (InventoryTask.cannotUse( SkillAPI.getPlayerData((Player) event.getEntity()), event.getBow())) { SkillAPI.getLanguage() .sendMessage(ErrorNodes.CANNOT_USE, event.getEntity(), FilterType.COLOR); event.setCancelled(true); } } }