@EventHandler public void onEntityDamage(EntityDamageEvent event) { if (event.isCancelled()) { return; } Entity entity = event.getEntity(); if (!(entity instanceof Player)) { return; } if (instance.getCitizensCommunicator().isNPC(entity, instance) || Utils.getInstance().isUnrestricted((Player) entity) || CombatTagComunicator.isNPC(entity)) { return; } Player player = (Player) entity; String name = player.getName().toLowerCase(); if (PlayerCache.getInstance().isAuthenticated(name)) { return; } if (!data.isAuthAvailable(name)) { if (!Settings.isForcedRegistrationEnabled) { return; } } player.setFireTicks(0); event.setCancelled(true); }
@EventHandler(priority = EventPriority.LOWEST) public void onLowestEntityInteract(EntityInteractEvent event) { if (event.isCancelled() || event == null) { return; } if (!(event.getEntity() instanceof Player)) { return; } Player player = (Player) event.getEntity(); String name = player.getName().toLowerCase(); if (instance.getCitizensCommunicator().isNPC(player, instance) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) { return; } if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { return; } if (!data.isAuthAvailable(name)) { if (!Settings.isForcedRegistrationEnabled) { return; } } event.setCancelled(true); }