Java Code Examples for org.bukkit.event.entity.PlayerLeashEntityEvent#setCancelled()
The following examples show how to use
org.bukkit.event.entity.PlayerLeashEntityEvent#setCancelled() .
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: 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 PlayerLeashEntityEvent 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 2
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerLeashEntity(PlayerLeashEntityEvent 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()) && 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_LEASH.send(event.getPlayer()); } }
Example 3
Source File: MobListener.java From civcraft with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerLeash(PlayerLeashEntityEvent event) { if (event.getEntity() instanceof LivingEntity) { if (MobLib.isMobLibEntity((LivingEntity) event.getEntity())) { CivMessage.sendError(event.getPlayer(), "This beast cannot be tamed."); event.setCancelled(true); return; } } }