本文整理汇总了Java中org.bukkit.event.block.BlockPistonExtendEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPistonExtendEvent.isCancelled方法的具体用法?Java BlockPistonExtendEvent.isCancelled怎么用?Java BlockPistonExtendEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockPistonExtendEvent
的用法示例。
在下文中一共展示了BlockPistonExtendEvent.isCancelled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPistonExtend
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler
public void onPistonExtend(BlockPistonExtendEvent 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().getModX(), event.getDirection().getModY(), event.getDirection().getModZ()))) {
event.setCancelled(true);
return;
} else {
for (Block block : event.getBlocks()) {
if (region.contains(event.getBlock().getLocation().clone().add(event.getDirection().getModX(), event.getDirection().getModY(), event.getDirection().getModZ())) || region.contains(block.getLocation().clone().add(event.getDirection().getModX(), event.getDirection().getModY(), event.getDirection().getModZ()))) {
event.setCancelled(true);
return;
}
}
}
}
}
}
}
示例2: onBlockPistonExtend
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
if (event.isCancelled())
return;
for (final Block block : event.getBlocks()) {
// Ok so a block is pushed into 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: onBlockPistonExtend
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (event.isCancelled()) {
return;
}
BlockUpdate.Update(event.getBlocks());
}
示例4: onPistonPush
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPistonPush(BlockPistonExtendEvent event) {
if (!event.isCancelled()) {
if (event.getBlock().getRelative(event.getDirection()).equals(place.getBlock())) {
event.setCancelled(true);
} else {
for (Block block : event.getBlocks()) {
if (block.equals(place.getBlock()) || block.equals(place.getBlock().getRelative(event.getDirection().getOppositeFace()))) {
event.setCancelled(true);
}
}
}
}
}
示例5: onPistonExtendEvent
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler (priority=EventPriority.HIGHEST)
public void onPistonExtendEvent(BlockPistonExtendEvent e) {
if (e.isCancelled()) {
List<Block> blocks = e.getBlocks();
if (blocks.size() > 0 && blocks.get(0).getLocation().getWorld().getName().equals("Build"))
for (int blocknum = 0; blocknum < blocks.size(); blocknum++) {
Location loc = blocks.get(blocknum).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) {
if (blocknum+1 != blocks.size()) {
continue;
} else {
e.setCancelled(false);
return;
}
} else {
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())) {
if (blocknum != blocks.size()) {
continue;
} else {
e.setCancelled(false);
return;
}
}
}
}
}
}
}
示例6: onBlockPistonExtend
import org.bukkit.event.block.BlockPistonExtendEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
if (!event.isCancelled()) {
final Block block = event.getBlock().getRelative(event.getDirection(), 2);
BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
bukkitScheduler.scheduleSyncDelayedTask(SQTechBase.getPluginMain(), new Runnable() {
public void run() {
Block origBlock = event.getBlock().getRelative(event.getDirection(), 1);
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);
}
}