當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockPistonExtendEvent.isCancelled方法代碼示例

本文整理匯總了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;
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:22,代碼來源:BuildFilterType.java

示例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;
		}
	}
}
 
開發者ID:NoChanceSD,項目名稱:AncientGates,代碼行數:18,代碼來源:PluginBlockListener.java

示例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());
}
 
開發者ID:SamaGames,項目名稱:AntiCheat,代碼行數:9,代碼來源:OrebfuscatorBlockListener.java

示例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);
                }
            }
        }
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:15,代碼來源:WoolObjective.java

示例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;
								}
							}
					}
				}
			}
	}
}
 
開發者ID:Esaych,項目名稱:DDCustomPlugin,代碼行數:44,代碼來源:PlotMeOverride.java

示例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);
		
	}
	
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:52,代碼來源:GUIBlockEvents.java


注:本文中的org.bukkit.event.block.BlockPistonExtendEvent.isCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。