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


Java BlockFromToEvent.getBlock方法代码示例

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


在下文中一共展示了BlockFromToEvent.getBlock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onGeneratingThings

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
/**
 * Prevent gaming using water/lava generators.
 * 
 * Add other generators as you become aware.
 * 
 * Credit for basic generator detector to fireblast709 (https://bukkit.org/threads/blocking-cobblestone-generators.120924/)
 * 
 * @param event
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onGeneratingThings(BlockFromToEvent event) {
	Block root = event.getBlock();
	Block block = event.getToBlock();
	Material type = event.getBlock().getType();
	Material mirror1 = (Material.WATER == type || Material.STATIONARY_WATER == type) ? Material.LAVA : Material.WATER;
	Material mirror2 = (Material.WATER == type || Material.STATIONARY_WATER == type) ? Material.STATIONARY_LAVA : Material.STATIONARY_WATER;
	for (BlockFace face : faces) {
		Block check = block.getRelative(face, 1);
		Block check2 = root.getRelative(face, 1);
		if (mirror1 == check.getType() || mirror2 == check.getType() ||
				mirror1 == check2.getType() || mirror2 == check2.getType()) {
			plugin.getTracking().trackBreak(block.getLocation());
			plugin.getTracking().trackBreak(check.getLocation());
			plugin.getTracking().trackBreak(check2.getLocation());
			debug("Generating something at union of {0} and {1}/{2}", block, check, check2);
			return;
		}
	}
}
 
开发者ID:DevotedMC,项目名称:HiddenOre,代码行数:30,代码来源:ExploitListener.java

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

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

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

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

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

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

示例9: onLiquidFlow

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler
public void onLiquidFlow(BlockFromToEvent event){
    Block to = event.getToBlock();
    Block from = event.getBlock();

    if(GameManager.isPlotPart(from.getLocation())
            && !GameManager.isPlotPart(to.getLocation())){
        event.setCancelled(true);
    }
}
 
开发者ID:Superioz,项目名称:CastleRush,代码行数:11,代码来源:GamePlotListener.java

示例10: onChange

import org.bukkit.event.block.BlockFromToEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChange(BlockFromToEvent event) {
    Block from = event.getBlock();
    Block to = event.getToBlock();
    Location tLocation = BukkitUtil.getLocation(to.getLocation());
    PlotArea area = tLocation.getPlotArea();
    if (area == null) {
        return;
    }
    Plot plot = area.getOwnedPlot(tLocation);
    Location fLocation = BukkitUtil.getLocation(from.getLocation());
    if (plot != null) {
        if (Flags.DISABLE_PHYSICS.isFalse(plot)) {
            event.setCancelled(true);
            return;
        } else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
            event.setCancelled(true);
            return;
        }
        if (Flags.LIQUID_FLOW.isFalse(plot)) {
            switch (to.getType()) {
                case WATER:
                case STATIONARY_WATER:
                case LAVA:
                case STATIONARY_LAVA:
                    event.setCancelled(true);
            }
        }
    } else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
        event.setCancelled(true);
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:33,代码来源:PlayerEvents.java

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


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