Java 类org.bukkit.event.entity.PlayerLeashEntityEvent 实例源码

项目:bskyblock    文件:IslandGuard.java   
/**
 * Prevents the leash use
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW)
public void onLeashUse(final PlayerLeashEntityEvent 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);
        }
    }
}
项目:acidisland    文件:IslandGuard.java   
/**
 * Prevents the leash use
 *
 * @param e
 */
@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();
        }
    }
}
项目:askyblock    文件:IslandGuard.java   
/**
 * Prevents the leash use
 *
 * @param e
 */
@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();
        }
    }
}
项目:KingdomFactions    文件:PlayerLeashEventListener.java   
@EventHandler
public void onLeash(PlayerLeashEntityEvent e) {
    KingdomFactionsPlayer p =PlayerModule.getInstance().getPlayer(e.getPlayer());
    if(p.getSettingsProfile().hasAdminMode()) return;
    if(!p.canBuild(e.getEntity().getLocation())) {
        e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 200));
    } 
}
项目:beaconz    文件:PlayerMovementListener.java   
/**
 * Prevents use of leashes outside the game area
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onLeashUse(final PlayerLeashEntityEvent event) {
    if (event.getEntity().getWorld().equals(getBeaconzWorld())) {
        if (getGameMgr().getGame(event.getEntity().getLocation()) == null) {
            event.setCancelled(true);
            event.getPlayer().sendMessage(ChatColor.RED + Lang.errorYouCannotDoThat);
        }
    }
}
项目:NovaGuilds    文件:RegionInteractListener.java   
@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());
    }
}
项目:civcraft    文件:CustomItemManager.java   
@EventHandler(priority = EventPriority.LOW)
public void OnPlayerLeashEvent(PlayerLeashEntityEvent event) {
    LoreCraftableMaterial craftMat = LoreCraftableMaterial.getCraftMaterial(event.getPlayer().getItemInHand());
    if (craftMat == null) {
        return;
    }

    craftMat.onPlayerLeashEvent(event);
}
项目:civcraft    文件:MobListener.java   
@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;
        }
    }
}
项目:NucleusFramework    文件:InternalLeashTracker.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerLeash(PlayerLeashEntityEvent event) {

    UUID playerId = event.getPlayer().getUniqueId();
    Entity leashHolder = event.getLeashHolder();

    if (event.getPlayer().equals(leashHolder))
        addPlayerLeash(playerId, event.getEntity());
    else {
        removePlayerLeash(playerId, event.getEntity());
    }
}
项目:FactionsXL    文件:EntityProtectionListener.java   
@EventHandler
public void onPlayerLeashEntity(PlayerLeashEntityEvent event) {
    forbidIfInProtectedTerritory(event.getPlayer(), event.getEntity(), event, LEASH);
}
项目:BlockBall    文件:BallListener.java   
@EventHandler
public void entityLeashEvent(PlayerLeashEntityEvent event) {
    if (this.isBall(event.getEntity())) {
        event.setCancelled(true);
    }
}
项目:civcraft    文件:LoreCraftableMaterial.java   
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {
    for (ItemComponent comp : this.components.values()) {
        comp.onPlayerLeashEvent(event);
    }
}
项目:CraftoPlugin    文件:EntityProtectionBreakListener.java   
@EventHandler
public void onPlayerLeashEntity(final PlayerLeashEntityEvent event) {
    debug("onPlayerLeashEntity() called!");
    if (!this.canInteract(event.getEntity(), event.getPlayer())) { event.setCancelled(true); }
}
项目:civcraft    文件:NoRightClick.java   
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {

}
项目:civcraft    文件:ItemComponent.java   
public void onPlayerLeashEvent(PlayerLeashEntityEvent event) {}