/** * Prevents the leash use * * @param e */ @EventHandler(priority = EventPriority.LOW) public void onLeashUse(final PlayerUnleashEntityEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (Util.inWorld(e.getEntity())) { if (e.getPlayer() != null) { Player player = e.getPlayer(); if (actionAllowed(player, e.getEntity().getLocation(),SettingsFlag.LEASH)) { return; } Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("island.protected")); e.setCancelled(true); } } }
@EventHandler public void onPlayerUnleashEntity(PlayerUnleashEntityEvent event) { List<String> denyRiding = Config.REGION_DENYRIDING.getStringList(); Player player = event.getPlayer(); Entity entity = event.getEntity(); NovaPlayer nPlayer = PlayerManager.getPlayer(player); if(denyRiding.contains(entity.getType().name())) { if(RegionManager.get(entity) != null && (!plugin.getRegionManager().canInteract(player, entity) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.MOB_LEASH))) && !(entity instanceof Vehicle) || !PlayerManager.getPlayer(player).isVehicleListed((Vehicle) event.getEntity())) { event.setCancelled(true); Message.CHAT_REGION_DENY_UNLEASH.send(player); } } }
/** * Prevents the leash use * * @param e */ @EventHandler(priority = EventPriority.LOW) public void onLeashUse(final PlayerUnleashEntityEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (inWorld(e.getEntity())) { if (e.getPlayer() != null) { Player player = e.getPlayer(); if (actionAllowed(player, e.getEntity().getLocation(),SettingsFlag.LEASH)) { return; } Util.sendMessage(player, ChatColor.RED + plugin.myLocale(player.getUniqueId()).islandProtected); e.setCancelled(true); e.getPlayer().updateInventory(); } } }
@EventHandler public void onPlayerUnLeashEntity(PlayerUnleashEntityEvent event) { forbidIfInProtectedTerritory(event.getPlayer(), event.getEntity(), event, UNLEASH); }
@EventHandler public void playerUnleashEntity(final PlayerUnleashEntityEvent event) { if (!this.frozenPlayers.isEmpty() && !event.isCancelled() && this.frozenPlayers.containsKey(event.getPlayer().getUniqueId())) { event.setCancelled(true); } }
@EventHandler public void onPlayerUnleashEntity(final PlayerUnleashEntityEvent event) { debug("onPlayerUnleashEntity() called!"); if (!this.canInteract(event.getEntity(), event.getPlayer())) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onPlayerUnleash(PlayerUnleashEntityEvent event) { removePlayerLeash(event.getPlayer().getUniqueId(), event.getEntity()); }