当前位置: 首页>>代码示例>>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;未经允许,请勿转载。