本文整理汇总了Java中org.bukkit.event.block.BlockPistonRetractEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPistonRetractEvent.isCancelled方法的具体用法?Java BlockPistonRetractEvent.isCancelled怎么用?Java BlockPistonRetractEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockPistonRetractEvent
的用法示例。
在下文中一共展示了BlockPistonRetractEvent.isCancelled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPistonRetract
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent event) {
if (!event.isCancelled()) {
FilterResult filterResult = evaluator.evaluate();
if (filterResult == FilterResult.DENY) {
for (Region region : regions) {
if (region.contains(event.getBlock().getLocation().clone().add(event.getDirection().getOppositeFace().getModX(), event.getDirection().getOppositeFace().getModY(), event.getDirection().getOppositeFace().getModZ()))) {
event.setCancelled(true);
return;
} else {
for (Block block : event.getBlocks()) {
if (region.contains(block.getLocation().clone().add(event.getDirection().getOppositeFace().getModX(), event.getDirection().getOppositeFace().getModY(), event.getDirection().getOppositeFace().getModZ()))) {
event.setCancelled(true);
return;
}
}
}
}
}
}
}
示例2: onBlockPistonRetract
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPistonRetract(final BlockPistonRetractEvent event) {
if (event.isCancelled())
return;
final Block block = event.getRetractLocation().getBlock();
// Ok so a block is pulled from a frame block
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord);
if (nearestGate != null) {
event.setCancelled(true);
return;
}
}
示例3: e
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
private void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING);
boolean flag = this.a(world, blockposition, enumdirection);
if (flag && !((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) {
world.playBlockAction(blockposition, this, 0, enumdirection.a());
}
} else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
// CraftBukkit start
if (!this.sticky) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
}
// PAIL: checkME - what happened to setTypeAndData?
// CraftBukkit end
world.playBlockAction(blockposition, this, 1, enumdirection.a());
}
}
示例4: onBlockPistonRetract
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if (event.isCancelled()) {
return;
}
BlockUpdate.Update(event.getBlock());
}
示例5: onPistonRetractEvent
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler (priority=EventPriority.HIGHEST)
public void onPistonRetractEvent(BlockPistonRetractEvent e) {
if (e.isCancelled()) {
Location loc = e.getBlock().getLocation();
if (loc.getWorld().getName().equals("Build")) {
String x1 = PlotManager.getPlotId(loc.clone().add(5, 0, 0));
String x2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 0));
String y1 = PlotManager.getPlotId(loc.clone().add(0, 0, 5));
String y2 = PlotManager.getPlotId(loc.clone().add(0, 0, -5));
boolean allowed = false;
if (getPlot(x1) != null && getPlot(x2) != null)
allowed = getPlot(x1).getOwner().equals(getPlot(x2).getOwner());
if (!allowed && getPlot(y1) != null && getPlot(y2) != null)
allowed = getPlot(y1).getOwner().equals(getPlot(y2).getOwner());
if (allowed) {
e.setCancelled(false);
return;
}
String cor1 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
String cor2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 5));
String cor3 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
String cor4 = PlotManager.getPlotId(loc.clone().add(-5, 0, -5));
if (getPlot(cor1) != null && getPlot(cor2) != null && getPlot(cor3) != null && getPlot(cor4) != null)
if (getPlot(cor1).getOwner().equals(getPlot(cor2).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor3).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor4).getOwner())) {
e.setCancelled(false);
}
}
}
}
示例6: onPistonRetract
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPistonRetract(BlockPistonRetractEvent event) {
if (!event.isCancelled()) {
for (Block block : event.getBlocks()) {
if (block.equals(place.getBlock()) || block.equals(place.getBlock().getRelative(event.getDirection().getOppositeFace()))) {
event.setCancelled(true);
}
}
}
}
示例7: onBlockPistonRetract
import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(final BlockPistonRetractEvent event) {
if (!event.isCancelled()) {
final Block block = event.getBlock().getRelative(event.getDirection().getOppositeFace(), 1);
BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
bukkitScheduler.scheduleSyncDelayedTask(SQTechBase.getPluginMain(), new Runnable() {
public void run() {
Block origBlock = event.getBlock().getRelative(event.getDirection().getOppositeFace(), 2);
if (block.getType().equals(Material.LAPIS_BLOCK)) {
for (Network network : SQTechBase.networks) {
for (GUIBlock guiBlock : network.getGUIBlocks()) {
if (origBlock.getLocation().equals(guiBlock.getLocation())) {
guiBlock.changeLocation(block.getLocation());
}
}
}
} else {
new Network(block, true);
new Network(origBlock.getRelative(1, 0, 0), true);
new Network(origBlock.getRelative(-1, 0, 0), true);
new Network(origBlock.getRelative(0, 1, 0), true);
new Network(origBlock.getRelative(0, -1, 0), true);
new Network(origBlock.getRelative(0, 0, 1), true);
new Network(origBlock.getRelative(0, 0, -1), true);
}
}
}, 4);
}
}