org.bukkit.event.entity.PlayerLeashEntityEvent Java Examples

The following examples show how to use org.bukkit.event.entity.PlayerLeashEntityEvent. 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 vote down vote up
/**
 * 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 vote down vote up
@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: CustomItemManager.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void OnPlayerLeashEvent(PlayerLeashEntityEvent event) {
	LoreCraftableMaterial craftMat = LoreCraftableMaterial.getCraftMaterial(event.getPlayer().getItemInHand());
	if (craftMat == null) {
		return;
	}
	
	craftMat.onPlayerLeashEvent(event);
}
 
Example #4
Source File: MobListener.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
@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;
		}
	}
}
 
Example #5
Source File: CancellableChunkEvents.java    From ClaimChunk with MIT License 4 votes vote down vote up
@EventHandler
public void onLeadCreate(PlayerLeashEntityEvent e) {
    if (e != null) {
        ChunkEventHelper.handleEntityEvent(e.getPlayer(), e.getEntity(), e);
    }
}
 
Example #6
Source File: LoreCraftableMaterial.java    From civcraft with GNU General Public License v2.0 4 votes vote down vote up
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {
	for (ItemComponent comp : this.components.values()) {
		comp.onPlayerLeashEvent(event);
	}
}
 
Example #7
Source File: NoRightClick.java    From civcraft with GNU General Public License v2.0 2 votes vote down vote up
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {
	
}
 
Example #8
Source File: ItemComponent.java    From civcraft with GNU General Public License v2.0 votes vote down vote up
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {}