當前位置: 首頁>>代碼示例>>Java>>正文


Java HangingPlaceEvent類代碼示例

本文整理匯總了Java中org.bukkit.event.hanging.HangingPlaceEvent的典型用法代碼示例。如果您正苦於以下問題:Java HangingPlaceEvent類的具體用法?Java HangingPlaceEvent怎麽用?Java HangingPlaceEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HangingPlaceEvent類屬於org.bukkit.event.hanging包,在下文中一共展示了HangingPlaceEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFramePlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
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);
        }
    }
 
開發者ID:Warvale,項目名稱:Scorch,代碼行數:19,代碼來源:RegionMapListener.java

示例2: onPlayerLeashHitch

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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);
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:21,代碼來源:IslandGuard.java

示例3: onPlayerLeashHitch

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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;
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:21,代碼來源:IslandGuard.java

示例4: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
 * 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);
		}
	}
}
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:26,代碼來源:PlayerListener.java

示例5: NoHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
     * 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);
//            }
//        }
    }
 
開發者ID:MutinyCraft,項目名稱:AntiBuild,代碼行數:30,代碼來源:HangingPlace.java

示例6: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-extra,代碼行數:26,代碼來源:ListenerHanging.java

示例7: onHangingPlaceEvent

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
 * 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());
        }
    }        
}
 
開發者ID:TheNut,項目名稱:HopperFilterSimplified,代碼行數:25,代碼來源:HfsBlockListener.java

示例8: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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();
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:12,代碼來源:EnvironmentManager.java

示例9: init

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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;
}
 
開發者ID:MundoSK,項目名稱:MundoSK,代碼行數:9,代碼來源:ExprHangedEntity.java

示例10: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
 * 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);
  }
}
 
開發者ID:CardinalDevelopment,項目名稱:Cardinal,代碼行數:12,代碼來源:InteractModule.java

示例11: onPaintingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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;
		}
	}
}
 
開發者ID:john01dav,項目名稱:GriefPreventionPlus,代碼行數:34,代碼來源:EntityEventHandler.java

示例12: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
    * 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);
}
 
開發者ID:stefvanschie,項目名稱:buildinggame,代碼行數:21,代碼來源:EntitySpawn.java

示例13: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
/**
 * 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);
        }
    }
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:14,代碼來源:PlayerMovementListener.java

示例14: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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;
                    }
                }
            }
        }
    }
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:39,代碼來源:PlayerEvents.java

示例15: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:9,代碼來源:LotsListener.java


注:本文中的org.bukkit.event.hanging.HangingPlaceEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。