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


Java BlockPistonRetractEvent.isCancelled方法代碼示例

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

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

示例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());
    }

}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:26,代碼來源:BlockPiston.java

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

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

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

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


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