下面列出了org.bukkit.Material#STATIONARY_LAVA 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void leakCheck(final BlockTransformEvent event) {
if (event.getWorld() != this.match.getWorld()) return;
if (event.getNewState().getType() == Material.STATIONARY_LAVA) {
Vector blockVector = BlockVectors.center(event.getNewState()).toVector();
for (Core core : this.cores) {
if (!core.hasLeaked() && core.getLeakRegion().contains(blockVector)) {
// core has leaked
core.markLeaked();
this.match.callEvent(new CoreLeakEvent(this.match, core, event.getNewState()));
this.match.callEvent(
new GoalCompleteEvent(
this.match, core, core.getOwner(), false, core.getContributions()));
}
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void leakCheck(final BlockTransformEvent event) {
if(event.getWorld() != this.match.getWorld()) return;
if(event.getNewState().getType() == Material.STATIONARY_LAVA) {
Vector blockVector = BlockUtils.center(event.getNewState()).toVector();
for(Core core : this.cores) {
if(!core.hasLeaked() && core.getLeakRegion().contains(blockVector)) {
// core has leaked
core.markLeaked();
this.match.getPluginManager().callEvent(new CoreLeakEvent(this.match, core, event.getNewState()));
this.match.getPluginManager().callEvent(new GoalCompleteEvent(core,
true,
c -> false,
c -> !c.equals(core.getOwner()),
core.getContributions()));
}
}
}
}
private boolean testLiquid(Set<Material> mats) {
for(Material mat : mats) {
if(mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA)
return true;
}
return false;
}
public boolean generatesCobble(Block block, Block toBlock){
Material mirrorID1 = (block.getType().equals(Material.WATER)) || (block.getType().equals(Material.STATIONARY_WATER)) ? Material.LAVA : Material.WATER;
Material mirrorID2 = (block.getType().equals(Material.WATER)) || (block.getType().equals(Material.STATIONARY_WATER)) ? Material.STATIONARY_LAVA : Material.STATIONARY_WATER;
for (BlockFace face: FACES) {
Block r = toBlock.getRelative(face);
if ((r.getType().equals(mirrorID1)) || (r.getType().equals(mirrorID2))) {
return true;
}
}
return false;
}
static boolean isLava(Material material) {
return material == Material.LAVA || material == Material.STATIONARY_LAVA;
}
public boolean isLiquid() {
return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}
public static boolean isLava(Material material) {
return material == Material.LAVA || material == Material.STATIONARY_LAVA;
}
public boolean isLiquid() {
return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}