当前位置: 首页>>代码示例>>Java>>正文


Java BlockFromToEvent.isCancelled方法代码示例

本文整理汇总了Java中org.bukkit.event.block.BlockFromToEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockFromToEvent.isCancelled方法的具体用法?Java BlockFromToEvent.isCancelled怎么用?Java BlockFromToEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.block.BlockFromToEvent的用法示例。


在下文中一共展示了BlockFromToEvent.isCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockFromTo(BlockFromToEvent event) {
    if (!event.isCancelled()) {
        Block to = event.getToBlock();
        Block from = event.getBlock();
        if (CoreObjective.getClosestCore(to.getX(), to.getY(), to.getZ()).equals(this)) {
            if ((from.getType().equals(Material.LAVA) || from.getType().equals(Material.STATIONARY_LAVA)) && to.getType().equals(Material.AIR)) {
                double minY = 256;
                for (Block block : getBlocks()) {
                    if (block.getY() < minY)
                        minY = block.getY();
                }
                if (minY - to.getY() >= leak && !this.complete) {
                    this.complete = true;
                    event.setCancelled(false);
                    if (this.show) ChatUtils.getGlobalChannel().sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.RED + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_LEAKED, team.getCompleteName() + ChatColor.RED, ChatColor.DARK_AQUA + name + ChatColor.RED)));
                    FireworkUtil.spawnFirework(event.getBlock().getLocation(), event.getBlock().getWorld(), MiscUtils.convertChatColorToColor(team.getColor()));
                    ObjectiveCompleteEvent compEvent = new ObjectiveCompleteEvent(this, null);
                    Bukkit.getServer().getPluginManager().callEvent(compEvent);
                }
            }
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:25,代码来源:CoreObjective.java

示例2: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockFromTo(final BlockFromToEvent event) {
	if (event.isCancelled())
		return;

	final Block block = event.getBlock();

	if (!block.getType().equals(Material.STATIONARY_WATER) && !block.getType().equals(Material.STATIONARY_LAVA))
		return;

	// Ok so water/lava starts flowing within a portal frame
	// Find the nearest gate!
	final WorldCoord blockCoord = new WorldCoord(block);
	final Gate nearestGate = Gates.gateFromPortal(blockCoord);

	if (nearestGate != null) {
		event.setCancelled(true);
	}
}
 
开发者ID:NoChanceSD,项目名称:AncientGates,代码行数:20,代码来源:PluginBlockListener.java

示例3: NoSkullCrash

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void NoSkullCrash(BlockFromToEvent evt) {
    if (noSkullCrash) {
    	if(evt.isCancelled()) {
    		return;
    	}
        if (evt.getToBlock().getType() == Material.SKULL) {
            evt.setCancelled(true);
        }
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:12,代码来源:SkullCrashPatch.java

示例4: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockFromTo(final BlockFromToEvent event) {
	if (!event.isCancelled()) {
		final Block block = event.getToBlock();

		if ((block.getTypeId() == 75) || (block.getTypeId() == 76) || (block.getTypeId() == 65) || (block.getTypeId() == 69) || (block.getTypeId() == 77) || (block.getTypeId() == 70) || (block.getTypeId() == 72) || (block.getTypeId() == 68) || (block.getTypeId() == 63) || (block.getTypeId() == 143) || (block.getTypeId() == 55)) {
			if (Craft.getCraft(block.getX(), block.getY(), block.getZ()) != null) {
				// event.setCancelled(true);
				block.setTypeId(8);
			}
		}
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:14,代码来源:NavyCraft_BlockListener.java

示例5: onFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
   public void onFlow(BlockFromToEvent e){
	RedProtect.get().logger.debug("RPGlobalListener - Is BlockFromToEvent event");
	if (e.isCancelled()){
   		return;
   	}
	Block b = e.getToBlock();
   	Block bfrom = e.getBlock();
	RedProtect.get().logger.debug("RPGlobalListener - Is BlockFromToEvent event is to " + b.getType().name() + " from " + bfrom.getType().name());
   	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
   	if (r != null){
   		return;
   	}
   	if (bfrom.isLiquid() && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".liquid-flow")){
        	 e.setCancelled(true);   
        	 return;
   	}
   	
   	if ((bfrom.getType().equals(Material.WATER) || bfrom.getType().equals(Material.STATIONARY_WATER)) 
   			&& !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".allow-changes-of.water-flow")){
       	 e.setCancelled(true);   
       	 return;
   	}
   	
   	if ((bfrom.getType().equals(Material.LAVA) || bfrom.getType().equals(Material.STATIONARY_LAVA)) 
   			&& !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".allow-changes-of.lava-flow")){
       	 e.setCancelled(true);   
       	 return;
   	}
   	
   	if (!b.isEmpty() && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".allow-changes-of.flow-damage")){
       	 e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:35,代码来源:RPGlobalListener.java

示例6: onFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
  public void onFlow(BlockFromToEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is BlockFromToEvent event");
if (e.isCancelled()){
  		return;
  	}		
  	Block bto = e.getToBlock();
  	Block bfrom = e.getBlock();
RedProtect.get().logger.debug("RPBlockListener - Is BlockFromToEvent event is to " + bto.getType().name() + " from " + bfrom.getType().name());
  	Region rto = RedProtect.get().rm.getTopRegion(bto.getLocation());
  	if (rto != null && bfrom.isLiquid() && !rto.canFlow()){
        	 e.setCancelled(true);   
        	 return;
  	}
  	
  	if (rto != null && !bto.isEmpty() && !rto.FlowDamage()){
       	 e.setCancelled(true);      
       	return;
 	    }
  	
  	//deny blocks spread in/out regions
  	Region rfrom = RedProtect.get().rm.getTopRegion(bfrom.getLocation());
  	if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
	e.setCancelled(true);
	return;
}
if (rfrom == null && rto != null){
	e.setCancelled(true);
}
  }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:31,代码来源:RPBlockListener.java

示例7: onFromToEvent

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onFromToEvent(BlockFromToEvent event)  {
    if(!event.isCancelled()) {
    	logChunk(event.getToBlock().getLocation());
	    logChunk(event.getBlock().getLocation());
    }
}
 
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:8,代码来源:ResetListener.java

示例8: BlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler (priority=EventPriority.HIGHEST)
	public void BlockFromTo(BlockFromToEvent e) {
		if (e.isCancelled()) {
			Location loc = e.getToBlock().getLocation();
			if (loc.getWorld().getName().equals("Build")) {
//				String id = PlotManager.getPlotId(loc);
//				if (getPlot(id) != null)
//					return;
				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,代码行数:33,代码来源:PlotMeOverride.java

示例9: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
/**
 * Handle when water tries to flow from a portal.
 * @param event The BlockFromTo event we want to prevent. 
 */
@EventHandler
public void onBlockFromTo(BlockFromToEvent event) 
{
	if (event.isCancelled() || event.getFace() != BlockFace.DOWN)
		return;

	if ( event.getBlock().getType() != plugin.portaltype)
			return;
	
	if (plugin.getPortalStorage().getPortal(event.getBlock().getLocation()) != null)
		event.setCancelled(true);
}
 
开发者ID:cppchriscpp,项目名称:TravelPortals,代码行数:17,代码来源:TravelPortalsBlockListener.java

示例10: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockFromTo(BlockFromToEvent event) {
    if (lava.contains(event.getToBlock())){
        event.setCancelled(true);
    }
    if (!event.isCancelled()) {
        Block to = event.getToBlock();
        Block from = event.getBlock();
        if (CoreObjective.getClosestCore(to.getX(), to.getY(), to.getZ()).equals(this)) {
            if ((from.getType().equals(Material.LAVA) || from.getType().equals(Material.STATIONARY_LAVA)) && to.getType().equals(Material.AIR)) {
                double minY = 256;
                for (Block block : getCore()) {
                    if (block.getY() < minY)
                        minY = block.getY();
                }
                if (minY - to.getY() >= leak && !this.complete) {
                    this.complete = true;
                    event.setCancelled(false);
                    if (this.show)
                        ChatUtil.getGlobalChannel().sendLocalizedMessage(new UnlocalizedChatMessage(ChatColor.RED + "{0}", new LocalizedChatMessage(ChatConstant.UI_OBJECTIVE_LEAKED, team.getCompleteName() + ChatColor.RED, name)));
                    ObjectiveCompleteEvent compEvent = new ObjectiveCompleteEvent(this, null);
                    Bukkit.getServer().getPluginManager().callEvent(compEvent);
                }
            }
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:28,代码来源:CoreObjective.java

示例11: onBLiquidFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void onBLiquidFlow(BlockFromToEvent event) {
    if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getToBlock().getLocation().toVector())) && filter.evaluate(event.getToBlock(), event).equals(FilterState.DENY)) {
        event.setCancelled(true);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:7,代码来源:BlockPlaceRegion.java

示例12: m

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void m(World world, int i, int j, int k) {
    if (world.getType(i, j, k) == this) {
        for (int l = 0; l < 1000; ++l) {
            int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
            int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
            int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);

            if (world.getType(i1, j1, k1).material == Material.AIR) {
                // CraftBukkit start
                org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
                org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
                BlockFromToEvent event = new BlockFromToEvent(from, to);
                org.bukkit.Bukkit.getPluginManager().callEvent(event);

                if (event.isCancelled()) {
                    return;
                }

                i1 = event.getToBlock().getX();
                j1 = event.getToBlock().getY();
                k1 = event.getToBlock().getZ();
                // CraftBukkit end

                if (!world.isStatic) {
                    world.setTypeAndData(i1, j1, k1, this, world.getData(i, j, k), 2);
                    world.setAir(i, j, k);
                } else {
                    short short1 = 128;

                    for (int l1 = 0; l1 < short1; ++l1) {
                        double d0 = world.random.nextDouble();
                        float f = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f1 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f2 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        double d1 = (double) i1 + (double) (i - i1) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        double d2 = (double) j1 + (double) (j - j1) * d0 + world.random.nextDouble() * 1.0D - 0.5D;
                        double d3 = (double) k1 + (double) (k - k1) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;

                        world.addParticle("portal", d1, d2, d3, (double) f, (double) f1, (double) f2);
                    }
                }

                return;
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:48,代码来源:BlockDragonEgg.java

示例13: m

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void m(World world, int i, int j, int k) {
    if (world.getTypeId(i, j, k) == this.id) {
        for (int l = 0; l < 1000; ++l) {
            int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
            int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
            int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);

            if (world.getTypeId(i1, j1, k1) == 0) {
                // CraftBukkit start
                org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
                org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
                BlockFromToEvent event = new BlockFromToEvent(from, to);
                org.bukkit.Bukkit.getPluginManager().callEvent(event);

                if (event.isCancelled()) {
                    return;
                }

                i1 = event.getToBlock().getX();
                j1 = event.getToBlock().getY();
                k1 = event.getToBlock().getZ();
                // CraftBukkit end

                if (!world.isStatic) {
                    world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k), 2);
                    world.setAir(i, j, k);
                } else {
                    short short1 = 128;

                    for (int l1 = 0; l1 < short1; ++l1) {
                        double d0 = world.random.nextDouble();
                        float f = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f1 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f2 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        double d1 = (double) i1 + (double) (i - i1) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        double d2 = (double) j1 + (double) (j - j1) * d0 + world.random.nextDouble() * 1.0D - 0.5D;
                        double d3 = (double) k1 + (double) (k - k1) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;

                        world.addParticle("portal", d1, d2, d3, (double) f, (double) f1, (double) f2);
                    }
                }

                return;
            }
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:48,代码来源:BlockDragonEgg.java

示例14: func_150019_m

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void func_150019_m(World p_150019_1_, int p_150019_2_, int p_150019_3_, int p_150019_4_)
{
    if (p_150019_1_.getBlock(p_150019_2_, p_150019_3_, p_150019_4_) == this)
    {
        for (int l = 0; l < 1000; ++l)
        {
            int i1 = p_150019_2_ + p_150019_1_.rand.nextInt(16) - p_150019_1_.rand.nextInt(16);
            int j1 = p_150019_3_ + p_150019_1_.rand.nextInt(8) - p_150019_1_.rand.nextInt(8);
            int k1 = p_150019_4_ + p_150019_1_.rand.nextInt(16) - p_150019_1_.rand.nextInt(16);

            if (p_150019_1_.getBlock(i1, j1, k1).blockMaterial == Material.air)
            {
                // CraftBukkit start
                org.bukkit.block.Block from = p_150019_1_.getWorld().getBlockAt(p_150019_2_, p_150019_3_, p_150019_4_);
                org.bukkit.block.Block to = p_150019_1_.getWorld().getBlockAt(i1, j1, k1);
                BlockFromToEvent event = new BlockFromToEvent(from, to);
                org.bukkit.Bukkit.getPluginManager().callEvent(event);

                if (event.isCancelled())
                {
                    return;
                }

                i1 = event.getToBlock().getX();
                j1 = event.getToBlock().getY();
                k1 = event.getToBlock().getZ();
                // CraftBukkit end

                if (!p_150019_1_.isRemote)
                {
                    p_150019_1_.setBlock(i1, j1, k1, this, p_150019_1_.getBlockMetadata(p_150019_2_, p_150019_3_, p_150019_4_), 2);
                    p_150019_1_.setBlockToAir(p_150019_2_, p_150019_3_, p_150019_4_);
                }
                else
                {
                    short short1 = 128;

                    for (int l1 = 0; l1 < short1; ++l1)
                    {
                        double d0 = p_150019_1_.rand.nextDouble();
                        float f = (p_150019_1_.rand.nextFloat() - 0.5F) * 0.2F;
                        float f1 = (p_150019_1_.rand.nextFloat() - 0.5F) * 0.2F;
                        float f2 = (p_150019_1_.rand.nextFloat() - 0.5F) * 0.2F;
                        double d1 = (double)i1 + (double)(p_150019_2_ - i1) * d0 + (p_150019_1_.rand.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        double d2 = (double)j1 + (double)(p_150019_3_ - j1) * d0 + p_150019_1_.rand.nextDouble() * 1.0D - 0.5D;
                        double d3 = (double)k1 + (double)(p_150019_4_ - k1) * d0 + (p_150019_1_.rand.nextDouble() - 0.5D) * 1.0D + 0.5D;
                        p_150019_1_.spawnParticle("portal", d1, d2, d3, (double)f, (double)f1, (double)f2);
                    }
                }

                return;
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:56,代码来源:BlockDragonEgg.java

示例15: c

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
private void c(World world, BlockPosition blockposition) {
    IBlockData iblockdata = world.getType(blockposition);

    if (iblockdata.getBlock() == this) {
        for (int i = 0; i < 1000; ++i) {
            BlockPosition blockposition1 = blockposition.a(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));

            if (world.getType(blockposition1).getBlock().material == Material.AIR) {
                // CraftBukkit start
                org.bukkit.block.Block from = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
                org.bukkit.block.Block to = world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
                BlockFromToEvent event = new BlockFromToEvent(from, to);
                org.bukkit.Bukkit.getPluginManager().callEvent(event);

                if (event.isCancelled()) {
                    return;
                }

                blockposition1 = new BlockPosition(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ());
                // CraftBukkit end
                if (world.isClientSide) {
                    for (int j = 0; j < 128; ++j) {
                        double d0 = world.random.nextDouble();
                        float f = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f1 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        float f2 = (world.random.nextFloat() - 0.5F) * 0.2F;
                        double d1 = (double) blockposition1.getX() + (double) (blockposition.getX() - blockposition1.getX()) * d0 + (world.random.nextDouble() - 0.5D) + 0.5D;
                        double d2 = (double) blockposition1.getY() + (double) (blockposition.getY() - blockposition1.getY()) * d0 + world.random.nextDouble() - 0.5D;
                        double d3 = (double) blockposition1.getZ() + (double) (blockposition.getZ() - blockposition1.getZ()) * d0 + (world.random.nextDouble() - 0.5D) + 0.5D;

                        world.addParticle(EnumParticle.PORTAL, d1, d2, d3, (double) f, (double) f1, (double) f2, new int[0]);
                    }
                } else {
                    world.setTypeAndData(blockposition1, iblockdata, 2);
                    world.setAir(blockposition);
                }

                return;
            }
        }

    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:44,代码来源:BlockDragonEgg.java


注:本文中的org.bukkit.event.block.BlockFromToEvent.isCancelled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。