Java 类org.bukkit.event.hanging.HangingPlaceEvent 实例源码

项目:Scorch    文件:RegionMapListener.java   
public void onFramePlace(HangingPlaceEvent e) {

        Player p = e.getPlayer();

        Map cpl = RegionMapGen.getPlayerLocations();
        cpl.put(p.getUniqueId(), RegionMapGen.getMap()[(int)p.getLocation().getX()][(int)p.getLocation().getZ()]);
        RegionMapGen.setPlayerLocations(cpl);

        if (cpl.get(p.getUniqueId()).equals("lava")) {
            Broadcast.toPlayer(p.getPlayer(), Broadcast.BroadcastType.FAILURE, "You cannot place item frames in Warvale's territory.");
            e.setCancelled(true);
        } else if (cpl.get(p.getUniqueId()).equals(Main.get().getConfig().getString("Player-Data."+p.getUniqueId()+"Guild-Name"))) {
            e.setCancelled(false);
        } else {
            Broadcast.toPlayer(p, Broadcast.BroadcastType.FAILURE, "You cannot place item frames in "+cpl.get(p.getUniqueId())+"'s territory.");
            e.setCancelled(true);
        }
    }
项目:bskyblock    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowAutoActivator && e.getPlayer().getName().equals("[CoFH]")) {
        return;
    }
    // plugin.getLogger().info(e.getEventName());
    if (Util.inWorld(e.getPlayer())) {
        if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
            if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
                Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
                e.setCancelled(true);
            }
        }
    }
}
项目:acidisland    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowedFakePlayers.contains(e.getPlayer().getName())) return;

    // plugin.getLogger().info(e.getEventName());
    if (inWorld(e.getPlayer())) {
        if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
            if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
                Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                e.setCancelled(true);
                return;
            }
        }
    }
}
项目:Factoid    文件:PlayerListener.java   
/**
 * On hanging place.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {

    if (!playerConf.get(event.getPlayer()).isAdminMod()) {

        IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
                event.getEntity().getLocation());
        Player player = event.getPlayer();

        if ((land instanceof ILand && ((ILand) land).isBanned(player))
                || !checkPermission(land, player,
                        PermissionList.BUILD.getPermissionType())
                || !checkPermission(land, player,
                        PermissionList.BUILD_PLACE.getPermissionType())) {
            messagePermission(player);
            event.setCancelled(true);
        }
    }
}
项目:askyblock    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowedFakePlayers.contains(e.getPlayer().getName())) return;

    // plugin.getLogger().info(e.getEventName());
    if (inWorld(e.getPlayer())) {
        if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
            if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
                Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                e.setCancelled(true);
                return;
            }
        }
    }
}
项目:AntiBuild    文件:HangingPlace.java   
/**
     * Checks if a player has permission to hang paintings or item frames.
     *
     * @param event that triggers listener.
     */
    @EventHandler(priority = EventPriority.LOW)
    public void NoHangingPlace(HangingPlaceEvent event) {

        Player player = event.getPlayer();

        // Hanging place
        if (!player.hasPermission("antibuild.bypass")) {
            if (!player.hasPermission("antibuild.painting")) {
                event.setCancelled(true);
                PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoInteractMessage(), player);
            }
        }

//        // World lock check
//        if (!event.isCancelled() && plugin.isUsingLock()) {
//            if (plugin.isLockedWorld(player.getWorld().getName())
//                    && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
//                    "." + player.getWorld().getName())) {
//                event.setCancelled(true);
//                messageHandler(plugin.getLockedWorldMessage(), player);
//            }
//        }
    }
项目:modules-extra    文件:ListenerHanging.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event)
{
    Hanging hanging = event.getEntity();
    HangingPlace action;
    if (hanging instanceof Painting)
    {
        action = this.newAction(PaintingPlace.class, hanging.getWorld());
        if (action != null)
        {
            ((PaintingPlace)action).art = ((Painting)hanging).getArt();
        }
    }
    else
    {
        action = this.newAction(HangingPlace.class, hanging.getWorld());
    }
    if (action != null)
    {
        action.setLocation(hanging.getLocation());
        action.setHanging(hanging);
        action.setPlayer(event.getPlayer());
        this.logAction(action);
    }
}
项目:HopperFilterSimplified    文件:HfsBlockListener.java   
/**
 * Event handler to watch whenever an itemframe is placed.
 * This will remove the cache of the hopper it was placed on.
 * 
 * @param event HangingPlaceEvent containing data about the item being hung. We care about an ItemFrame being placed.
 */
@EventHandler(ignoreCancelled=true)
public void onHangingPlaceEvent(HangingPlaceEvent event) {
    if (event.getEntity() instanceof ItemFrame) {
        if (event.getBlock().getType().equals(Material.HOPPER)) {
            Player player = event.getPlayer();
            if (!player.hasPermission("hopperfiltersimplified.build.place.itemframe")) {
                plugin.sendMessageInfo(player, "You do not have rights to place a hopper filter itemFrame.");
                event.setCancelled(true);
                return;
            }
            //debug if requested
            if (plugin.debugLevel_get() > 0) plugin.getLogger().info("ItemFrame placed at (" + event.getBlock().getLocation().toString() + ")");

            //Clear the cache from the hopper around the Hopper the itemFrame was placed on.
            plugin.knownHoppersCache_ClearAroundLocation(event.getBlock().getLocation());
        }
    }        
}
项目:ZentrelaRPG    文件:EnvironmentManager.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    PlayerDataRPG pd = plugin.getPD(event.getPlayer());
    if (pd == null)
        event.setCancelled(true);
    if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
        event.setCancelled(true);
    if (!canBuild(pd))
        event.setCancelled(true);
    event.getPlayer().updateInventory();
}
项目:MundoSK    文件:ExprHangedEntity.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (ScriptLoader.isCurrentEvent(HangingPlaceEvent.class) || ScriptLoader.isCurrentEvent(HangingBreakEvent.class)) {
        return true;
    }
    Skript.error("'hanged entity' can only be used in hang and unhang events!");
    return false;
}
项目:Cardinal    文件:InteractModule.java   
/**
 * Prevents a player that can't interact from placing a hanging entity.
 *
 * @param event The event.
 */
@EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
  if (!canInteract(event.getPlayer())) {
    event.setCancelled(true);
  }
}
项目:GriefPreventionPlus    文件:EntityEventHandler.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPaintingPlace(HangingPlaceEvent event)
{
    //don't track in worlds where claims are not enabled
       if(!GriefPrevention.instance.claimsEnabledForWorld(event.getBlock().getWorld())) return;

    //FEATURE: similar to above, placing a painting requires build permission in the claim

    //if the player doesn't have permission, don't allow the placement
    String noBuildReason = GriefPrevention.instance.allowBuild(event.getPlayer(), event.getEntity().getLocation(), Material.PAINTING);
       if(noBuildReason != null)
       {
        event.setCancelled(true);
        GriefPrevention.sendMessage(event.getPlayer(), TextMode.Err, noBuildReason);
        return;
       }

    //otherwise, apply entity-count limitations for creative worlds
    else if(GriefPrevention.instance.creativeRulesApply(event.getEntity().getLocation()))
    {
        PlayerData playerData = this.dataStore.getPlayerData(event.getPlayer().getUniqueId());
        Claim claim = this.dataStore.getClaimAt(event.getBlock().getLocation(), false, playerData.lastClaim);
        if(claim == null) return;

        String noEntitiesReason = claim.allowMoreEntities();
        if(noEntitiesReason != null)
        {
            GriefPrevention.sendMessage(event.getPlayer(), TextMode.Err, noEntitiesReason);
            event.setCancelled(true);
            return;
        }
    }
}
项目:buildinggame    文件:EntitySpawn.java   
/**
    * Handles hanging entity spawning
    *
    * @param e an event representing a hanging entity that has spawned
    * @see HangingPlaceEvent
    * @since 4.0.4
    */
@EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent e) {
    if (ArenaManager.getInstance().getArena(e.getPlayer()) == null)
        return;

    Entity entity = e.getEntity();
    Plot plot;
    if ((plot = Plot.getPlot(entity.getLocation())) != null) {
        if (!plot.addEntity(entity))
            e.setCancelled(true);
    } else
        e.setCancelled(true);
}
项目:beaconz    文件:PlayerMovementListener.java   
/**
 * Prevents hanging items outside the game area
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onHangingPlace(final HangingPlaceEvent event) {
    if (event.getEntity().getWorld().equals(getBeaconzWorld())) {
        if (getGameMgr().getGame(event.getEntity().getLocation()) == null) {
            event.setCancelled(true);
            event.getPlayer().sendMessage(ChatColor.RED + Lang.errorYouCannotDoThat);
        }
    }
}
项目:PlotSquared-Chinese    文件:PlayerEvents.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onHangingPlace(final HangingPlaceEvent e) {
    final Block b = e.getBlock();
    final Location loc = BukkitUtil.getLocation(b.getLocation());
    if (PlotSquared.isPlotWorld(loc.getWorld())) {
        final Player p = e.getPlayer();
        final PlotPlayer pp = BukkitUtil.getPlayer(p);
        Plot plot = MainUtil.getPlot(loc);
        if (plot == null) {
            if (MainUtil.isPlotAreaAbs(loc)) {
                if (!Permissions.hasPermission(pp, "plots.admin.build.road")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
                    e.setCancelled(true);
                    return;
                }
            }
        } else {
            if (!plot.hasOwner()) {
                if (!Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
                    e.setCancelled(true);
                    return;
                }
            } else if (!plot.isAdded(pp.getUUID())) {
                if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
                    return;
                }
                if (!Permissions.hasPermission(pp, "plots.admin.build.other")) {
                    if (MainUtil.isPlotArea(loc)) {
                        MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
                        e.setCancelled(true);
                        return;
                    }
                }
            }
        }
    }
}
项目:Peacecraft    文件:LotsListener.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    Lot lot = this.module.getLotManager().getLot(event.getEntity().getLocation());
    Town town = this.module.getLotManager().getTown(event.getEntity().getLocation());
    if(((lot != null && !lot.canBuild(event.getPlayer())) || (lot == null && town != null)) && !event.getPlayer().hasPermission(LotPermissions.BUILD_ANYWHERE)) {
        event.setCancelled(true);
    }
}
项目:NovaGuilds    文件:RegionInteractListener.java   
/**
 * Handles placing paintings, item frames, leashes
 *
 * @param event The event
 */
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    Player player = event.getPlayer();
    NovaPlayer nPlayer = PlayerManager.getPlayer(player);
    Location location = event.getEntity().getLocation();

    if(RegionManager.get(location) != null
            && (!plugin.getRegionManager().canInteract(player, location) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.BLOCK_PLACE)))) {
        event.setCancelled(true);
        Message.CHAT_REGION_DENY_INTERACT.send(player);
    }
}
项目:Almura-Server    文件:ItemLeash.java   
public static boolean a(EntityHuman entityhuman, World world, int i, int j, int k) {
    EntityLeash entityleash = EntityLeash.b(world, i, j, k);
    boolean flag = false;
    double d0 = 7.0D;
    List list = world.a(EntityInsentient.class, AxisAlignedBB.a().a((double) i - d0, (double) j - d0, (double) k - d0, (double) i + d0, (double) j + d0, (double) k + d0));

    if (list != null) {
        Iterator iterator = list.iterator();

        while (iterator.hasNext()) {
            EntityInsentient entityinsentient = (EntityInsentient) iterator.next();

            if (entityinsentient.bH() && entityinsentient.getLeashHolder() == entityhuman) {
                if (entityleash == null) {
                    entityleash = EntityLeash.a(world, i, j, k);

                    // CraftBukkit start
                    HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleash.getBukkitEntity(), entityhuman != null ? (org.bukkit.entity.Player) entityhuman.getBukkitEntity() : null, world.getWorld().getBlockAt(i, j, k), org.bukkit.block.BlockFace.SELF);
                    world.getServer().getPluginManager().callEvent(event);

                    if (event.isCancelled()) {
                        entityleash.die();
                        return false;
                    }
                    // CraftBukkit end
                }

                // CraftBukkit start
                if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, entityleash, entityhuman).isCancelled()) {
                    continue;
                }
                // CraftBukkit end
                entityinsentient.setLeashHolder(entityleash, true);
                flag = true;
            }
        }
    }

    return flag;
}
项目:PlotMe-Core    文件:BukkitPlotListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
    IPlayer player = plugin.wrapPlayer(event.getPlayer());
    Location location = BukkitUtil.adapt(event.getBlock().getLocation());

    if (manager.isPlotWorld(location.getWorld())) {
        if (player.hasPermission(PermissionNames.ADMIN_BUILDANYWHERE)) {
            return;
        }

        Plot plot = manager.getPlot(location);

        if (plot == null) {
            player.sendMessage(api.C("CannotBuild"));
            event.setCancelled(true);
        } else {
            if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) {
                return;
            }
            Optional<Plot.AccessLevel> member = plot.isMember(player.getUniqueId());
            if (member.isPresent()) {
                if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) {
                    player.sendMessage(api.C("CannotBuild"));
                    event.setCancelled(true);
                } else if (api.isPlotLocked(plot.getId())) {
                    player.sendMessage(api.C("PlotLocked"));
                    event.setCancelled(true);
                }
            } else {
                player.sendMessage(api.C("CannotBuild"));
                event.setCancelled(true);
            }
        }
    }

}
项目:PlotSquared    文件:PlayerEvents.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
    Block b = event.getBlock().getRelative(event.getBlockFace());
    Location location = BukkitUtil.getLocation(b.getLocation());
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Player p = event.getPlayer();
    PlotPlayer pp = BukkitUtil.getPlayer(p);
    Plot plot = area.getPlot(location);
    if (plot == null) {
        if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
            MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
            event.setCancelled(true);
        }
    } else {
        if (!plot.hasOwner()) {
            if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
                MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
                event.setCancelled(true);
            }
            return;
        }
        if (!plot.isAdded(pp.getUUID())) {
            if (!plot.getFlag(Flags.HANGING_PLACE,false)) {
                if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
                    event.setCancelled(true);
                }
                return;
            }
        }
        if (checkEntity(event.getEntity(), plot)) {
            event.setCancelled(true);
        }

    }
}
项目:CrazyLogin    文件:DynamicPlayerListener_1_4_2.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void HangingPlace(final HangingPlaceEvent event)
{
    final Player player = event.getPlayer();
    if (plugin.isLoggedIn(player))
        return;
    event.setCancelled(true);
    plugin.sendAuthReminderMessage(player);
}
项目:SpigotSource    文件:ItemHanging.java   
public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
    BlockPosition blockposition1 = blockposition.shift(enumdirection);

    if (enumdirection != EnumDirection.DOWN && enumdirection != EnumDirection.UP && entityhuman.a(blockposition1, enumdirection, itemstack)) {
        EntityHanging entityhanging = this.a(world, blockposition1, enumdirection);

        if (entityhanging != null && entityhanging.survives()) {
            if (!world.isClientSide) {
                // CraftBukkit start - fire HangingPlaceEvent
                Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
                org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
                org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection);

                HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityhanging.getBukkitEntity(), who, blockClicked, blockFace);
                world.getServer().getPluginManager().callEvent(event);

                if (event.isCancelled()) {
                    return EnumInteractionResult.FAIL;
                }
                // CraftBukkit end
                entityhanging.o();
                world.addEntity(entityhanging);
            }

            --itemstack.count;
        }

        return EnumInteractionResult.SUCCESS;
    } else {
        return EnumInteractionResult.FAIL;
    }
}
项目:NPlugins    文件:BuildFlagListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingPlace(final HangingPlaceEvent event) {
    final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getEntity().getLocation());
    if (region != null && region.getFlag(Flag.BUILD) && !region.isUser(event.getPlayer())) {
        event.setCancelled(true);
    }
}
项目:Bits    文件:ConfigurationManager.java   
private static HashMap<String, Class> getEventClassAssociations()
    {
        HashMap<String, Class> classHashMap = new HashMap<String, Class>();
        classHashMap.put("block-break", BlockBreakEvent.class);
        classHashMap.put("block-place", BlockPlaceEvent.class);

//      classHashMap.put("entity-leash", PlayerLeashEntityEvent.class);
        classHashMap.put("entity-kill", EntityDeathEvent.class);
        classHashMap.put("entity-shear", PlayerShearEntityEvent.class);

        classHashMap.put("item-brew", BrewEvent.class);
        classHashMap.put("item-enchant", EnchantItemEvent.class);
        classHashMap.put("item-furnace", FurnaceExtractEvent.class);

        classHashMap.put("painting-create", HangingPlaceEvent.class);

        classHashMap.put("player-regenerate", EntityRegainHealthEvent.class);
        classHashMap.put("player-shoot", EntityShootBowEvent.class);
        classHashMap.put("player-chat", AsyncPlayerChatEvent.class);
        classHashMap.put("player-death", PlayerDeathEvent.class);
        classHashMap.put("player-sleep", PlayerBedEnterEvent.class);
        classHashMap.put("player-author", PlayerEditBookEvent.class);
        classHashMap.put("player-egg", PlayerEggThrowEvent.class);
        classHashMap.put("player-fish", PlayerFishEvent.class);
        classHashMap.put("player-eat", PlayerItemConsumeEvent.class);
        classHashMap.put("player-join", PlayerJoinEvent.class);
        classHashMap.put("player-move", PlayerMoveEvent.class);

        classHashMap.put("portal-create", PortalCreateEvent.class);

        classHashMap.put("vehicle-move", VehicleMoveEvent.class);

        classHashMap.put("world-change", PlayerChangedWorldEvent.class);

        return classHashMap;
    }
项目:RahmenTests    文件:RahmenListener.java   
@EventHandler(priority=EventPriority.NORMAL )
   public void onHangingPlaceEvent(HangingPlaceEvent event) 
{
    System.out.println(" plugin:  onHangingPlace Event  ");
       if (event.getEntity() instanceof ItemFrame) 
       {
        Player player = event.getPlayer();
        System.out.println(" player:  "+player.getDisplayName() );
        System.out.println(" event.getBlock().getType()  "+event.getBlock().getType() );  // auf was
        plugin.itemFrame1 = (ItemFrame)event.getEntity();
       }
       System.out.println("  ");
}
项目:bskyblock    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerBlockPlace(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowAutoActivator && e.getPlayer().getName().equals("[CoFH]")) {
        return;
    }
    // plugin.getLogger().info(e.getEventName());
    if (Util.inWorld(e.getPlayer())) {
        // This permission bypasses protection
        if (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        Island island = plugin.getIslands().getProtectedIslandAt(e.getBlock().getLocation());
        // Outside of island protection zone
        if (island == null) {
            if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
                Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
                e.setCancelled(true);
            }
            return;
        }
        if (island.getFlag(SettingsFlag.PLACE_BLOCKS) || island.getMembers().contains(e.getPlayer().getUniqueId()))  {
            // Check how many placed
            String type = e.getEntity().getType().toString();
            if (e.getEntity().getType().equals(EntityType.ITEM_FRAME) || e.getEntity().getType().equals(EntityType.PAINTING)) {
                // tile entity placed
                if (Settings.limitedBlocks.containsKey(type) && Settings.limitedBlocks.get(type) > -1) {
                    // Convert from EntityType to Material via string - ugh
                    int count = island.getTileEntityCount(Material.valueOf(type),e.getEntity().getWorld());
                    if (Settings.limitedBlocks.get(type) <= count) {
                        Util.sendMessage(e.getPlayer(), (plugin.getLocale(e.getPlayer().getUniqueId()).get("moblimits.entity").replace("[entity]",
                                Util.prettifyText(type))).replace("[number]", String.valueOf(Settings.limitedBlocks.get(type))));
                        e.setCancelled(true);
                    }
                }
            }
        } else {
            // Visitor
            Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
            e.setCancelled(true);
        }
    }
}
项目:ProjectAres    文件:EventRuleMatchModule.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void checkHangingPlace(final HangingPlaceEvent event) {
    this.handleHangingPlace(event, getHangingBlockState(event.getEntity()), event.getPlayer());
}
项目:FactionsXL    文件:EntityProtectionListener.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    forbidIfInProtectedTerritory(event.getPlayer(), event.getEntity(), event, BUILD);
}
项目:HCFCore    文件:CoreListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onHangingPlace(final HangingPlaceEvent event) {
    if (!attemptBuild((Entity)event.getPlayer(), event.getEntity().getLocation(), ChatColor.GRAY + "You may not build in the territory of %1$s" + ChatColor.GRAY + '.')) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:ProtectionListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onHangingPlace(HangingPlaceEvent event) {
    if (!attemptBuild(event.getPlayer(), event.getEntity().getLocation(), ChatColor.YELLOW + "You may not build in the territory of %1$s" + ChatColor.YELLOW + '.')) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:CoreListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onHangingPlace(final HangingPlaceEvent event) {
    if (!attemptBuild((Entity)event.getPlayer(), event.getEntity().getLocation(), ChatColor.GRAY + "You may not build in the territory of %1$s" + ChatColor.GRAY + '.')) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:ProtectionListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onHangingPlace(HangingPlaceEvent event) {
    if (!attemptBuild(event.getPlayer(), event.getEntity().getLocation(), ChatColor.YELLOW + "You may not build in the territory of %1$s" + ChatColor.YELLOW + '.')) {
        event.setCancelled(true);
    }
}
项目:ClaimChunk    文件:CancellableChunkEvents.java   
@EventHandler
public void onItemFramePlaced(HangingPlaceEvent e) {
    if (e != null && e.getEntity().getType().equals(EntityType.ITEM_FRAME) && e.getPlayer() != null) {
        ChunkHelper.cancelEventIfNotOwned(e.getPlayer(), e.getEntity().getLocation().getChunk(), e);
    }
}
项目:GamePlate    文件:ObserverModule.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    if (isObserver(event.getPlayer())) {
        event.setCancelled(true);
    }
}
项目:AbilityAPI    文件:SequenceListener.java   
@EventHandler
public void onHangingEntityPlace(HangingPlaceEvent event) {
    this.manager.invoke(event.getPlayer(), event);
}
项目:Arcade2    文件:ObserverListeners.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
    if (this.isObserving(event.getPlayer())) {
        event.setCancelled(true);
    }
}
项目:Steel    文件:RollbackEntityListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) {
    handleEntityEvent(event.getEntity(), true, event);
}
项目:RpgPlus    文件:ScriptEventManager.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    callHandlers("hanging.place", event);
}
项目:Cardinal-Plus    文件:BlockEventRegion.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    if (region.contains(event.getEntity().getLocation().toVector()) && filter.evaluate(event.getEntity(), event).equals(FilterState.DENY)) {
        event.setCancelled(true);
    }
}
项目:Cardinal-Plus    文件:ObserverModule.java   
@EventHandler
public void onHangingPlace(HangingPlaceEvent event) {
    if (!match.isRunning() || TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver()) {
        event.setCancelled(true);
    }
}