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


Java BlockFromToEvent.setCancelled方法代码示例

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


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

示例1: WaterFowLimitor

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
  public void WaterFowLimitor(BlockFromToEvent event) {
if(ConfigOptimize.WaterFlowLimitorenable == true){
	Block block = event.getBlock();
	Chunk chunk = block.getChunk();
       if (block.getType() == Material.STATIONARY_WATER || block.getType() == Material.STATIONARY_LAVA) {
           if(CheckFast(block.getChunk())){
           	if(CheckedTimes.get(chunk) == null){
       			CheckedTimes.put(chunk, 0);
       		}
       		CheckedTimes.put(chunk, CheckedTimes.get(chunk) + 1);
       		if(CheckedTimes.get(chunk) > ConfigOptimize.WaterFlowLimitorPerChunkTimes){
       			event.setCancelled(true);
       		}
           }else{
               ChunkLastTime.put(block.getChunk(), System.currentTimeMillis());
           }
       }
}
  }
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:21,代码来源:WaterFlowLimitor.java

示例2: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onBlockFromTo(BlockFromToEvent e) {
	if (!cm.antiWaterfall) {
		return;
	}
	Block to = e.getToBlock();
	if (to == null) {
		return;
	}
	if (e.getToBlock().getLocation().getBlockY() <= 63) {
		return;
	}
	if (isAirBottom(to, cm.antiWaterfallHeight)) {
		e.setCancelled(true);
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:17,代码来源:NoHighFallWater.java

示例3: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockFromTo(BlockFromToEvent event)
{
    Location location = event.getBlock().getLocation();
    if(this.previousLocation != null && location.equals(this.previousLocation))
    {
        if(!this.previousWasCancelled) return;
        event.setCancelled(true);
        return;
    }
    
    Flag flag = this.GetFlagInstanceAtLocation(location, null);
    boolean cancel = (flag != null);
    
    this.previousLocation = location;
    this.previousWasCancelled = cancel;
    if(cancel)
    {
        event.setCancelled(true);
    }
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:22,代码来源:FlagDef_NoFluidFlow.java

示例4: onLiquidFlowOtherLand

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void onLiquidFlowOtherLand(final BlockFromToEvent event) {
    Chunk fromChunk = event.getBlock().getLocation().getChunk();
    Chunk toChunk = event.getToBlock().getLocation().getChunk();
    RegionData fromLand = CubitBukkitPlugin.inst().getRegionManager().praseRegionData(fromChunk.getWorld(),
            fromChunk.getX(), fromChunk.getZ());

    RegionData toLand = CubitBukkitPlugin.inst().getRegionManager().praseRegionData(toChunk.getWorld(),
            toChunk.getX(), toChunk.getZ());

    if (toLand.getLandType() == LandTypes.NOTYPE) {
        return;
    }

    if (fromLand.getLandType() == LandTypes.SERVER && toLand.getLandType() == LandTypes.SERVER) {
        return;
    }

    if (!CubitBukkitPlugin.inst().getRegionManager().hasLandPermission(toLand, fromLand.getOwnersUUID()[0])) {
        event.setCancelled(true);
    }
}
 
开发者ID:MineGaming,项目名称:cubit,代码行数:23,代码来源:AdditionalPhysicsListener.java

示例5: 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

示例6: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockFromTo (BlockFromToEvent spreadEvent)
{
    //always allow fluids to flow straight down
       if(spreadEvent.getFace() == BlockFace.DOWN) return;
       
    //don't track in worlds where claims are not enabled
	if(!GriefPrevention.instance.claimsEnabledForWorld(spreadEvent.getBlock().getWorld())) return;
	
	//where to?
       Block toBlock = spreadEvent.getToBlock();
       Location toLocation = toBlock.getLocation();
       Claim toClaim = this.dataStore.getClaimAt(toLocation, false, lastSpreadClaim);
       
       //if into a land claim, it must be from the same land claim
       if(toClaim != null)
       {
           this.lastSpreadClaim = toClaim;
           if(!toClaim.contains(spreadEvent.getBlock().getLocation(), false, false))
           {
               spreadEvent.setCancelled(true);
           }
       }
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:25,代码来源:BlockEventHandler.java

示例7: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
/**
    * Handles liquid flowing
    *
    * @param e an event indicating that a liquid has flown
    * @see BlockFromToEvent
    * @since 2.2.1
    */
@EventHandler
public void onBlockFromTo(BlockFromToEvent e) {
	Location from = e.getBlock().getLocation();
	Location to = e.getToBlock().getLocation();
	
	for (Arena arena : ArenaManager.getInstance().getArenas()) {
		for (Plot plot : arena.getPlots()) {
               Region boundary = plot.getBoundary();

               if (boundary == null)
				continue;
			
			if (boundary.isInside(from) != boundary.isInside(to))
				//checks if the source flows/goes out of the boundary and vice versa
				e.setCancelled(true);
		}
	}
}
 
开发者ID:stefvanschie,项目名称:buildinggame,代码行数:26,代码来源:LiquidFlow.java

示例8: 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

示例9: onLiquidFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
/**
 * Prevents liquid flowing over the beacon beam
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onLiquidFlow(final BlockFromToEvent event) {
    World world = event.getBlock().getWorld();
    if (!world.equals(getBeaconzWorld())) {
        return;
    }
    // Only bother with horizontal flows
    if (event.getToBlock().getX() != event.getBlock().getX() || event.getToBlock().getZ() != event.getBlock().getZ()) {
        BeaconObj beacon = getRegister().getBeaconAt(event.getToBlock().getX(),event.getToBlock().getZ());
        if (beacon != null && beacon.getY() < event.getToBlock().getY()) {
            event.setCancelled(true);
            return;
        }
        // Stop flows outside of the game area
        Game game = getGameMgr().getGame(event.getBlock().getLocation());
        if (game == null) {
            event.setCancelled(true);
            return;
        }
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:26,代码来源:BeaconProtectionListener.java

示例10: onChange

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onChange(final BlockFromToEvent e) {
    final Block b = e.getToBlock();
    final Location loc = BukkitUtil.getLocation(b.getLocation());
    if (PlotSquared.isPlotWorld(loc.getWorld())) {
        if (MainUtil.isPlotRoad(loc)) {
            e.setCancelled(true);
        }
        else {
            Plot plot = MainUtil.getPlot(loc);
            if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
                e.setCancelled(true);
            }
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:17,代码来源:PlayerEvents.java

示例11: blockFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void blockFlow(BlockFromToEvent event) {
	Location source = event.getBlock().getLocation();
	Tribe sourceGroup = TribeProtect.getBlockOwnership(source);
	Location spread = event.getToBlock().getLocation();
	Tribe spreadGroup = TribeProtect.getBlockOwnership(spread);
	
	//if spreadgroup == null, allow
	//if sourcegroup == null, do not allow where spreadgroup != null
	if (!sourceGroup.isValid()) {
		if (!spreadGroup.isValid()) return;
		else event.setCancelled(true);
	} else {
		if (!spreadGroup.isValid()) return;
		else {
			if (!sourceGroup.equals(spreadGroup))
				event.setCancelled(true);
		}
	}
}
 
开发者ID:monofuel,项目名称:MonoMods,代码行数:21,代码来源:TribeProtectListener.java

示例12: onBlockMove

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockMove(BlockFromToEvent event) {
    Block block = event.getBlock(), to = event.getToBlock();
    String world = block.getWorld().getUID().toString();
    Integer x = to.getLocation().getChunk().getX(), z = to.getLocation().getChunk().getZ();
    if (QuickChecks.isWorldChunkClaimed(serverdata.get("worldmap").get(world), x, z, "cla")) {
        if (((HashMap) ((HashMap) serverdata.get("worldmap").get(world).get(x)).get(z)).containsKey("str")) {
            if (block.getType().equals(WATER)) {
                block.setType(STATIONARY_WATER);
            } else if (block.getType().equals(LAVA)) {
                block.setType(STATIONARY_LAVA);
            }
            event.setCancelled(true);
        }
    }
}
 
开发者ID:N1T3SLAY3R,项目名称:Empirecraft,代码行数:17,代码来源:OnBlockMove.java

示例13: onLiquidFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void onLiquidFlow(BlockFromToEvent event){
	if(Minigame.getCurrentMinigame()!=null){
		switch(Minigame.getCurrentMinigame().getMap().getType()){
		case CIRCLE_OF_BOOM:
			event.setCancelled(true);
			break;
		case KEY_QUEST:
			break;
		case WATER_THE_MONUMENT:
			break;
		default:
			break;
		
		}
	}
}
 
开发者ID:tatanpoker09,项目名称:TCMinigames,代码行数:18,代码来源:BlockListener.java

示例14: onWaterPassThrough

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onWaterPassThrough(final BlockFromToEvent event) {
    Block block = event.getToBlock();
    Location location = block.getLocation();

    if (!reinforcementManager.isWorldActive(location.getWorld().getName())) {
        return;
    }

    if (!reinforcementManager.isReinforced(location)) {
        return;
    }

    // If the event is caused by a dragon egg moving to a new location, simply make sure it is not teleporting into a field.
    if (Material.DRAGON_EGG.equals(event.getBlock().getType())) {
        Bukkit.getServer().getPluginManager().callEvent(new BlockDeinforceEvent(block, "Environment", true));
        return;
    }

    if (!liquidsDestroyReinforcedBlocks) {
        event.setCancelled(true);
        return;
    }
}
 
开发者ID:MinerAp,项目名称:block-saver,代码行数:25,代码来源:GeneralListener.java

示例15: onBlockFromTo

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockFromTo(final BlockFromToEvent event)
{
	final ProtectHolder settings = prot.getSettings();
	final Block block = event.getBlock();
	if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
	{
		event.setCancelled(settings.getData().getPrevent().isWaterFlow());
		return;
	}

	if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA)
	{
		event.setCancelled(settings.getData().getPrevent().isLavaFlow());
	}
	// TODO: Test if this still works
		/*
	 * if (block.getType() == Material.AIR) {
	 * event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_water_bucket_flow)); return; }
	 */
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:22,代码来源:EssentialsProtectBlockListener.java


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