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


Java HangingPlaceEvent.getPlayer方法代碼示例

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


在下文中一共展示了HangingPlaceEvent.getPlayer方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: onHangingPlace

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

示例7: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //導入方法依賴的package包/類
@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);
        }

    }
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:40,代碼來源:PlayerEvents.java

示例8: HangingPlace

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

示例9: onHangingPlaceEvent

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

示例10: onItemFramePlaced

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


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