当前位置: 首页>>代码示例>>Java>>正文


Java BlockPlaceEvent类代码示例

本文整理汇总了Java中cn.nukkit.event.block.BlockPlaceEvent的典型用法代码示例。如果您正苦于以下问题:Java BlockPlaceEvent类的具体用法?Java BlockPlaceEvent怎么用?Java BlockPlaceEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlockPlaceEvent类属于cn.nukkit.event.block包,在下文中一共展示了BlockPlaceEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockPlace

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent evt){
	if(SpawnProtect.enabled()){
		if(!evt.getPlayer().isOp()){
			if(evt.getPlayer().getLevel().equals(Spawn.getLoc().getLevel())){
				double d = evt.getBlock().getLocation().distance(Spawn.getLocAsV3());
				if(d < SpawnProtect.getRange()){
					if(SpawnProtect.warnBuild()){
						evt.getPlayer().sendMessage(msg.PNB_BLOCK_CANCEL.getContent());
					}
					evt.setCancelled(true);
				}
			}
		}
	}
}
 
开发者ID:berry64,项目名称:NukkitEssentials,代码行数:17,代码来源:PNB.java

示例2: onBlockPlaceEvent

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlaceEvent(final BlockPlaceEvent event){
    Player player = event.getPlayer();
    if(plugin.ifProtectToPlayer(player,player.getLevel().getFolderName())){
        player.sendTip(TextFormat.RED+"\n\n\n\nYou don't have permission to place this block");
    }
}
 
开发者ID:MamoeTech,项目名称:Nukkit-WorldProtect,代码行数:8,代码来源:EventListener.java

示例3: dnp

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void dnp(BlockPlaceEvent event){
	int str = event.getBlock().getId();
	if (str==174|str==79|str==58|str==57|str==56|str==30|str==287|str==26|str==16|str==15|str==14|str==13){
		event.setCancelled(true);
	}
}
 
开发者ID:haniokasai,项目名称:NuclearGunWars-plugin,代码行数:8,代码来源:events.java

示例4: onBlockPlace

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
	Player player = event.getPlayer();
	if (player.isOp())
		return;
	Skyblock skyblock = Skyblock.getSkyblockByPos(event.getBlock());
	if (!event.getBlock().getLevel().getName().startsWith("skyblock")) {
		return;
	}
	if (skyblock == null || (!skyblock.isOwner(player) && !skyblock.isShare(player))) {
		event.setCancelled();
	}
}
 
开发者ID:MCFT-Server,项目名称:Mskyblock,代码行数:14,代码来源:EventListener.java

示例5: onBlockPlace

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onBlockPlace(BlockPlaceEvent event){
	Player player = event.getPlayer();
	
	if(this.placeQueue.contains(player)){
		event.setCancelled();
		
		this.placeQueue.remove(player);
	}
}
 
开发者ID:EconomyS,项目名称:EconomyLand,代码行数:11,代码来源:EconomyLand.java

示例6: onPlace

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler
public void onPlace(BlockPlaceEvent event){
	if(!this.manager.isAuthenticated(event.getPlayer())){
		event.setCancelled();
		if(this.getConfig().get("message.send-login", true)){
			this.sendLoginMessage(event.getPlayer());
		}
	}
}
 
开发者ID:onebone,项目名称:GateKeeper,代码行数:10,代码来源:GateKeeper.java

示例7: blockCreate

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockCreate(BlockPlaceEvent event) {
    Location location = NukkitUtil.getLocation(event.getBlock().getLocation());
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Player player = event.getPlayer();
    PlotPlayer pp = NukkitUtil.getPlayer(player);
    Plot plot = area.getPlotAbs(location);
    if (plot != null) {
        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;
            }
        } else if (!plot.isAdded(pp.getUUID())) {
            Set<PlotBlock> place = plot.getFlag(Flags.PLACE, null);
            if (place != null) {
                Block block = event.getBlock();
                if (place.contains(PlotBlock.get((short) block.getId(), block.getDamage()))) {
                    return;
                }
            }
            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;
            }
        } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
            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 (location.getY() > area.MAX_BUILD_HEIGHT && location.getY() < area.MIN_BUILD_HEIGHT && !Permissions
                .hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
            event.setCancelled(true);
            MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
        }
    } else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
        MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
        event.setCancelled(true);
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:48,代码来源:PlayerEvents.java

示例8: onPlayerPlaceEvent

import cn.nukkit.event.block.BlockPlaceEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerPlaceEvent(BlockPlaceEvent e){
    if(!isLogged(e.getPlayer().getName().toLowerCase())){
        e.setCancelled();
    }
}
 
开发者ID:azon0320,项目名称:Nukkit-LoginFrame,代码行数:7,代码来源:Login.java


注:本文中的cn.nukkit.event.block.BlockPlaceEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。