org.bukkit.event.player.PlayerUnleashEntityEvent Java Examples
The following examples show how to use
org.bukkit.event.player.PlayerUnleashEntityEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 6 votes |
@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); } } }
Example #2
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * Prevents the leash use * * @param e - event */ @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(); } } }
Example #3
Source File: CancellableChunkEvents.java From ClaimChunk with MIT License | 4 votes |
@EventHandler public void onLeadDestroy(PlayerUnleashEntityEvent e) { if (e != null) { ChunkEventHelper.handleEntityEvent(e.getPlayer(), e.getEntity(), e); } }