本文整理汇总了Java中cn.nukkit.event.block.BlockBurnEvent类的典型用法代码示例。如果您正苦于以下问题:Java BlockBurnEvent类的具体用法?Java BlockBurnEvent怎么用?Java BlockBurnEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockBurnEvent类属于cn.nukkit.event.block包,在下文中一共展示了BlockBurnEvent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBlockBurn
import cn.nukkit.event.block.BlockBurnEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBurn(BlockBurnEvent event) {
Block b = event.getBlock();
Location location = NukkitUtil.getLocation(b.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = location.getOwnedPlot();
if (plot == null || !plot.getFlag(Flags.BLOCK_BURN, false)) {
event.setCancelled(true);
return;
}
}
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:18,代码来源:PlayerEvents.java
示例2: tryToCatchBlockOnFire
import cn.nukkit.event.block.BlockBurnEvent; //导入依赖的package包/类
private void tryToCatchBlockOnFire(Block block, int bound, int damage) {
int burnAbility = block.getBurnAbility();
Random random = this.getLevel().rand;
if (random.nextInt(bound) < burnAbility) {
if (random.nextInt(damage + 10) < 5) {
int meta = damage + random.nextInt(5) / 4;
if (meta > 15) {
meta = 15;
}
BlockIgniteEvent e = new BlockIgniteEvent(block, this, null, BlockIgniteEvent.BlockIgniteCause.SPREAD);
this.level.getServer().getPluginManager().callEvent(e);
if (!e.isCancelled()) {
this.getLevel().setBlock(block, new BlockFire(meta), true);
this.getLevel().scheduleUpdate(block, this.tickRate());
}
} else {
BlockBurnEvent ev = new BlockBurnEvent(block);
this.getLevel().getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
this.getLevel().setBlock(block, new BlockAir(), true);
}
}
if (block instanceof BlockTNT) {
((BlockTNT) block).prime();
}
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:36,代码来源:BlockFire.java
示例3: tryToCatchBlockOnFire
import cn.nukkit.event.block.BlockBurnEvent; //导入依赖的package包/类
private void tryToCatchBlockOnFire(Block block, int bound, int damage) {
int burnAbility = block.getBurnAbility();
Random random = this.getLevel().rand;
if (random.nextInt(bound) < burnAbility) {
if (random.nextInt(damage + 10) < 5) {
int meta = damage + random.nextInt(5) / 4;
if (meta > 15) {
meta = 15;
}
this.getLevel().setBlock(block, new BlockFire(meta), true);
this.getLevel().scheduleUpdate(block, this.tickRate());
} else {
BlockBurnEvent ev = new BlockBurnEvent(block);
this.getLevel().getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
this.getLevel().setBlock(block, new BlockAir(), true);
}
}
if (block instanceof BlockTNT) {
((BlockTNT) block).prime();
}
}
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:31,代码来源:BlockFire.java
注:本文中的cn.nukkit.event.block.BlockBurnEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论