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


Java BlockSpreadEvent.getBlock方法代码示例

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


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

示例1: onBlockSpread

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

	final Block block = event.getBlock();

	// Ok so a frame block fire spreads
	// Find the nearest gate!
	final WorldCoord blockCoord = new WorldCoord(block);
	final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord);

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

示例2: onSpread

import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpread(BlockSpreadEvent event)
{
    if (event.getNewState().getType() == FIRE)
    {
        Block oldBlock = event.getBlock();
        IgniteSpread action = this.newAction(IgniteSpread.class, oldBlock.getWorld());
        if (action != null)
        {
            action.setOldBlock(oldBlock.getState());
            action.setNewBlock(event.getNewState());
            action.setLocation(oldBlock.getLocation());
            action.setSource(event.getSource().getLocation());
            this.logAction(action);
        }
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:18,代码来源:ListenerBlockIgnite.java

示例3: onBlockSpread

import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
	Block source = e.getSource();
	WorldChunk sourceChunk = CropControl.getDAO().getChunk(source.getChunk());
	int sourceX = source.getX();
	int sourceY = source.getY();
	int sourceZ = source.getZ();

	Block block = e.getBlock();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();

	if (!harvestableCrops.containsKey(source.getType()) && source.getType() != Material.CHORUS_FLOWER
			&& source.getType() != Material.CHORUS_PLANT && block.getType() != Material.CHORUS_FLOWER
			&& block.getType() != Material.CHORUS_PLANT)
		return;

	Crop sourceCrop = sourceChunk.getCrop(sourceX, sourceY, sourceZ);
	if (sourceCrop != null) {
		UUID placerUUID = sourceCrop.getPlacer();
		Crop.create(chunk, x, y, z, source.getType().toString(), null, placerUUID,
				System.currentTimeMillis(), true);
		return;
	} 
	
	TreeComponent treeComponent = sourceChunk.getTreeComponent(sourceX, sourceY, sourceZ);
	if (treeComponent != null) {
		treeComponent.setHarvestable(true);

		// TODO: should we differentiate between flower and plant here?
		TreeComponent.create(treeComponent.getTreeID(), chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				treeComponent.getPlacer(), true);
	}

}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:38,代码来源:CropControlEventHandler.java

示例4: onSpread

import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onSpread(BlockSpreadEvent spread) {

  if (spread.getBlock() == null) {
    return;
  }

  Game game =
      BedwarsRel.getInstance().getGameManager()
          .getGameByLocation(spread.getBlock().getLocation());
  if (game == null) {
    return;
  }

  if (game.getState() != GameState.RUNNING) {
    return;
  }

  if (spread.getNewState() == null || spread.getSource() == null) {
    return;
  }

  if (spread.getNewState().getType().equals(Material.FIRE)) {
    spread.setCancelled(true);
    return;
  }

  if (game.getRegion().isPlacedBlock(spread.getSource())) {
    game.getRegion().addPlacedBlock(spread.getBlock(), spread.getBlock().getState());
  } else {
    game.getRegion().addPlacedUnbreakableBlock(spread.getBlock(), spread.getBlock().getState());
  }
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:34,代码来源:BlockListener.java

示例5: onFireSpread

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

示例6: onBS

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

示例7: onBlockSpread

import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent event) {
    Block block = event.getBlock();
    Location location = BukkitUtil.getLocation(block.getLocation());
    if (location.isPlotRoad()) {
        event.setCancelled(true);
        return;
    }
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Plot plot = area.getOwnedPlot(location);
    if (plot == null) {
        return;
    }
    switch (event.getSource().getType()) {
        case GRASS:
            if (Flags.GRASS_GROW.isFalse(plot)) {
                event.setCancelled(true);
            }
            break;
        case MYCEL:
            if (Flags.MYCEL_GROW.isFalse(plot)) {
                event.setCancelled(true);
            }
            break;
        case VINE:
            if (Flags.VINE_GROW.isFalse(plot)) {
                event.setCancelled(true);
            }
            break;
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:35,代码来源:PlayerEvents.java

示例8: onBlockSpread

import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockSpread(BlockSpreadEvent event) {
	Block source = event.getSource();
	Block to = event.getBlock();
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
	
	// Block spreading out and into the arena
	for(Arena arena : am.getArenas())
		if(arena.isArenaCuboidSet())
			if((arena.getArenaCuboid().isInsideCuboid(source) &&
					!arena.getArenaCuboid().isInsideCuboid(to)) ||
					(arena.getArenaCuboid().isInsideCuboid(to) &&
					!arena.getArenaCuboid().isInsideCuboid(source)))
				event.setCancelled(true);
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:16,代码来源:SSGBlockListener.java


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