• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BlockBreakEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler (ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event){
	Player player = event.getPlayer();
	Block block = event.getBlock();
	
	Land land;
	if((land = this.provider.findLand(block)) != null){
		if(!(land.hasPermission(player) || player.hasPermission("economyland.admin.modify"))){
			player.sendMessage(this.getMessage("modify-forbidden", new Object[]{
					land.getId(), land.getOwner()
			}));
			
			event.setCancelled(true);
		}
	}else if(this.getConfig().getStringList("white-world-protection").contains(block.level.getFolderName()) && !player.hasPermission("economyland.admin.modify")){
		if(this.getConfig().getBoolean("show-white-world-message", true)){
			player.sendMessage(this.getMessage("modify-whiteland"));
		}
		
		event.setCancelled();
	}
}
 
开发者ID:EconomyS,项目名称:EconomyLand,代码行数:23,代码来源:EconomyLand.java


示例2: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBlockBreak(BlockBreakEvent 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


示例3: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
    Player p = e.getPlayer();
    Block b = e.getBlock();
    if (this.isSelector(p)) {
        Selection set = selectors.get(p.getName().toLowerCase());

        if (set.pos1 == null) {
            e.setCancelled();
            set.pos1 = b.clone();
            p.sendMessage(TextFormat.GREEN + "Selected the first position at " + TextFormat.BLUE + b.x + TextFormat.GREEN + ", " + TextFormat.BLUE + b.y + TextFormat.GREEN + ", " + TextFormat.BLUE + b.z + TextFormat.GREEN);
        } else if (set.pos2 == null) {
            e.setCancelled();
            set.pos2 = b.clone();
            p.sendMessage(TextFormat.GREEN + "Selected the second position at " + TextFormat.BLUE + b.x + TextFormat.GREEN + ", " + TextFormat.BLUE + b.y + TextFormat.GREEN + ", " + TextFormat.BLUE + b.z + TextFormat.GREEN);
        }
    }
}
 
开发者ID:Creeperface01,项目名称:WorldFixer,代码行数:19,代码来源:WorldFixer.java


示例4: onBlockBreakEvent

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBlockBreakEvent(final BlockBreakEvent 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 break this block");
    }
}
 
开发者ID:MamoeTech,项目名称:Nukkit-WorldProtect,代码行数:8,代码来源:EventListener.java


示例5: onBlockBreakEvent

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBlockBreakEvent(BlockBreakEvent e) {
    if (plugin.getMainConfig().isUseSigns()) {
        if (e.getPlayer().hasPermission("minecraftmarket.signs")) {
            if (plugin.getSignsConfig().getDonorSignFor(e.getBlock()) != null) {
                if (plugin.getSignsConfig().removeDonorSign(e.getBlock())) {
                    e.getPlayer().sendMessage(Colors.color(I18n.tl("prefix") + " " + I18n.tl("sign_removed")));
                    plugin.getSignsTask().updateSigns();
                }
            }
        }
    }
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:14,代码来源:SignsListener.java


示例6: onBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onBreak(BlockBreakEvent event) {
	if (db.isMine(event.getBlock())) {
		
		Block block = db.mineing(event.getBlock());
		block.setLevel(event.getBlock().getLevel());
		block.position(event.getBlock());
		event.getPlayer().getInventory().addItem(event.getDrops());
		event.setDrops(new Item[]{});
		this.getServer().getScheduler().scheduleDelayedTask(
				new BlockPlaceTask(this, Block.get(block.getId(), block.getDamage(), block)), 5);
	}
}
 
开发者ID:angelless,项目名称:MineLess,代码行数:14,代码来源:Main.java


示例7: dnb

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void dnb(BlockBreakEvent 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);
	}
	if(str == 80){//雪
		event.getPlayer().getInventory().addItem(Item.get(80,1,1));
		event.getPlayer().getInventory().sendContents(event.getPlayer());
	}
}
 
开发者ID:haniokasai,项目名称:NuclearGunWars-plugin,代码行数:12,代码来源:events.java


示例8: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event) {
	Player player = event.getPlayer();
	Double become = Double.valueOf(((Double) this.hunger.get(player)).doubleValue() - 10.0D);
	if (become.doubleValue() < 0.0D) {
		become = Double.valueOf(0.0D);
		event.setCancelled(true);
	}

	this.hunger.put(player, become);
}
 
开发者ID:organization,项目名称:RealHunger,代码行数:12,代码来源:RealHunger.java


示例9: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event){
	Player player = event.getPlayer();
	if(player.isSurvival() && !(event.getInstaBreak() && event.isFastBreak()) && !ItemOwnership.getInstance().getData().containsKey(player.getName().toLowerCase()) && Utils.toBoolean(ItemOwnership.getInstance().getSetting().get("Enable").toString())){
		Block block = event.getBlock();
		Arrays.asList(event.getDrops()).forEach(item->new EntityOwnedItem(block.level.getChunk((int) block.getX() >> 4, (int) block.getZ() >> 4, true), new CompoundTag(){
			{
				putList(new ListTag<DoubleTag>("Pos"){
					{
						add(new DoubleTag("", block.getX() + 0.5));
						add(new DoubleTag("", block.getY() + 0.5));
						add(new DoubleTag("", block.getZ() + 0.5));
					}
				});
				putList(new ListTag<DoubleTag>("Motion"){
					{
						add(new DoubleTag("", new Random().nextDouble() * 0.2 - 0.1));
						add(new DoubleTag("", 0.2));
						add(new DoubleTag("", new Random().nextDouble() * 0.2 - 0.1));
					}
				});
				putList(new ListTag<FloatTag>("Rotation"){
					{
						add(new FloatTag("", new Random().nextFloat() * 360));
						add(new FloatTag("", 0));
					}
				});
				putShort("Health", 5);
				putCompound("Item", (CompoundTag) NBTIO.putItemHelper(item).setName("Item"));
				putShort("PickupDelay", 10);
			}
		}, player).spawnToAll());
		event.setDrops(new Item[0]);
	}
}
 
开发者ID:if-Team,项目名称:Nukkit-Plugins,代码行数:36,代码来源:ItemEventListener.java


示例10: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBlockBreak(BlockBreakEvent 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


示例11: onBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBreak(BlockBreakEvent event) {
	Player player = event.getPlayer();
	if (!player.hasPermission("floatingtext.remove"))
		return;
	Position pos = event.getBlock();
	if (FloatingTextManager.getInstance().exist(pos)) {
		FloatingTextManager.getInstance().removeFloatingText(pos);
		plugin.getDB().message(player, "Remove floatingtext success!");
	}
}
 
开发者ID:MCFT-Server,项目名称:FloatingText,代码行数:12,代码来源:EventListener.java


示例12: onBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBreak(BlockBreakEvent event){
	if(!this.manager.isAuthenticated(event.getPlayer())){
		event.setCancelled();

		if(this.getConfig().get("message.send-login", true)){
			this.sendLoginMessage(event.getPlayer());
		}
	}
}
 
开发者ID:onebone,项目名称:GateKeeper,代码行数:11,代码来源:GateKeeper.java


示例13: onBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
public void onBreak(BlockBreakEvent event) {
	Position pos = event.getBlock();
	String key = pos.x + ":" + pos.y + ":" + pos.z + ":" + pos.level.getFolderName();

	if(this.sells.containsKey(key)){
		if(!event.getPlayer().hasPermission("economysell.break")) {
			event.getPlayer().sendMessage(this.getMessage("sell-breaking-forbidden"));
			event.setCancelled();
			return;
		}
		
		if(this.getConfig().getBoolean("destroy.break", true)){
			Sell shop = this.sells.get(key);
			
			if(shop.getDisplayer() != null){
				if(this.displayers.containsKey(pos.level)){
					this.displayers.get(pos.level).remove(shop.getDisplayer());
				}
			}
			this.sells.remove(key);
			this.provider.removeSell(pos);
			
			event.getPlayer().sendMessage(this.getMessage("sell-removed"));
		}
	}
}
 
开发者ID:EconomyS,项目名称:EconomySell,代码行数:28,代码来源:EconomySell.java


示例14: onBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler
  public void onBreak(BlockBreakEvent event) {
  	Position pos = event.getBlock();
  	String key = pos.x + ":" + pos.y + ":" + pos.z + ":" + pos.level.getFolderName();

if(this.shops.containsKey(key)){
	if(!event.getPlayer().hasPermission("economyshop.break")) {
		event.getPlayer().sendMessage(this.getMessage("shop-breaking-forbidden"));
		event.setCancelled();
		return;
	}
	
	if(this.getConfig().getBoolean("destroy.break", true)){
		Shop shop = this.shops.get(key);
		
		if(shop.getDisplayer() != null){
			if(this.displayers.containsKey(pos.level)){
				this.displayers.get(pos.level).remove(shop.getDisplayer());
			}
		}
		this.shops.remove(key);
		this.provider.removeShop(pos);
		
		event.getPlayer().sendMessage(this.getMessage("shop-removed"));
	}
}
  }
 
开发者ID:EconomyS,项目名称:EconomyShop,代码行数:28,代码来源:EconomyShop.java


示例15: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
    final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
    final World world = player.getWorld();
    final WorldEdit we = WorldEdit.getInstance();
    final Block clickedBlock = event.getBlock();
    final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
    if (we.handleBlockLeftClick(player, pos)) {
        event.setCancelled(true);
    }
    if (we.handleArmSwing(player)) {
        event.setCancelled(true);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:WorldEditListener.java


示例16: onPlayerBreakEvent

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


示例17: onBlockBreak

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if (!api.isDoTileDroPS(event.getBlock().getLevel())) {
        event.setDrops(new Item[]{});
    }
}
 
开发者ID:yescallop,项目名称:EssentialsNK,代码行数:7,代码来源:EventListener.java


示例18: blockDestroy

import cn.nukkit.event.block.BlockBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void blockDestroy(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Location location = NukkitUtil.getLocation(event.getBlock().getLocation());
        PlotArea area = location.getPlotArea();
        if (area == null) {
            return;
        }
        Plot plot = area.getPlotAbs(location);
        if (plot != null) {
            PlotPlayer plotPlayer = NukkitUtil.getPlayer(player);
            if (event.getBlock().getY() == 0) {
                if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
                    MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
                    event.setCancelled(true);
                    return;
                }
            }
            if (!plot.hasOwner()) {
                if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
                    return;
                }
                MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
                event.setCancelled(true);
                return;
            }
            if (!plot.isAdded(plotPlayer.getUUID())) {
                Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
                Block block = event.getBlock();
                if (destroy.isPresent() && destroy.get()
                        .contains(PlotBlock.get((short) block.getId(), block.getDamage()))) {
                    return;
                }
                if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
                    return;
                }
                MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
                event.setCancelled(true);
            } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
                if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
                    MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
                    event.setCancelled(true);
                    return;
                }
            }
            return;
        }
        PlotPlayer pp = NukkitUtil.getPlayer(player);
        if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
            return;
        }
        if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
            if (player.getInventory().getItemInHand().getId() == PS.get().worldedit.getConfiguration().wandItem) {
                return;
            }
        }
        MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
        event.setCancelled(true);
    }
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:60,代码来源:PlayerEvents.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ElasticSearchException类代码示例发布时间:2022-05-21
下一篇:
Java TopologyWebRoutable类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap