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


Java BlockBurnEvent.getBlock方法代碼示例

本文整理匯總了Java中org.bukkit.event.block.BlockBurnEvent.getBlock方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockBurnEvent.getBlock方法的具體用法?Java BlockBurnEvent.getBlock怎麽用?Java BlockBurnEvent.getBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.block.BlockBurnEvent的用法示例。


在下文中一共展示了BlockBurnEvent.getBlock方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
/**
 * So far specifically handles these cases:
 * 
 * 1) Block burnt is tracked
 * 2) Block burnt is under a tracked block (probably only mushrooms eligible)
 * 3) Block burnt was a jungle tree, checks for cocoa.
 * 4) Burnt block had mushroom on top and cocoa on the sides
 * 
 * @param e The event
 */
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBurn(BlockBurnEvent e) {
	Block block = e.getBlock();
	if (maybeSideTracked(block)) {
		trySideBreak(block, BreakType.FIRE, null);
	}
	if (maybeBelowTracked(block)) {
		block = block.getRelative(BlockFace.UP);
	}
	Location loc = block.getLocation();
	if (!pendingChecks.contains(loc)) {
		pendingChecks.add(loc);
		handleBreak(block, BreakType.FIRE, null, null);
	}
}
 
開發者ID:DevotedMC,項目名稱:CropControl,代碼行數:26,代碼來源:CropControlEventHandler.java

示例2: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockBurn(BlockBurnEvent event) throws InterruptedException {
    if (disabling) { return; }

    Block block = event.getBlock();

    if (plugin.needsCheck.contains(block)) {
        plugin.needsCheck.remove(block);
    }

    if (plugin.monitorBlocks.contains(block)) {
        while (plugin.isUpdatingChecks) {
            Thread.sleep(25);
        }
        plugin.monitorBlocks.remove(block);
    }
}
 
開發者ID:ArdiMaster,項目名稱:SunBurnsTrees,代碼行數:18,代碼來源:EventListener.java

示例3: onBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onBurn(BlockBurnEvent bbe) {
  Block block = bbe.getBlock();
  if (block == null) {
    return;
  }

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

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

  bbe.setCancelled(true);
}
 
開發者ID:BedwarsRel,項目名稱:BedwarsRel,代碼行數:19,代碼來源:BlockListener.java

示例4: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler
  public void onBlockBurn(BlockBurnEvent e){
  	RedProtect.get().logger.debug("RPBlockListener - Is BlockBurnEvent event");
  	if (e.isCancelled()){
  		return;
  	}
  	
  	Block b = e.getBlock();

  	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
  	if (r != null && !r.canFire()){
	e.setCancelled(true);
  		return;
}
  	
  	if (!cont.canWorldBreak(b)){
  		e.setCancelled(true);
}
  }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:20,代碼來源:RPBlockListener.java

示例5: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBurn(final BlockBurnEvent event) {
	if (event.isCancelled())
		return;

	final Block block = event.getBlock();

	// Ok so a frame block is burning
	// 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

示例6: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBurn(BlockBurnEvent event) {
    Block b = event.getBlock();
    Location location = BukkitUtil.getLocation(b.getLocation());

    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }

    Plot plot = location.getOwnedPlot();
    if (plot == null || !plot.getFlag(Flags.BLOCK_BURN, false)) {
        event.setCancelled(true);
        return;
    }

}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:18,代碼來源:PlayerEvents.java

示例7: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockBurn(BlockBurnEvent event) {
    Block block = event.getBlock();
    if (block.getRelative(BlockFace.UP).getType() == Material.FIRE) {
        block.getRelative(BlockFace.UP).setType(Material.AIR);
    }
   if (block.getRelative(BlockFace.NORTH).getType() == Material.FIRE) {
        block.getRelative(BlockFace.NORTH).setType(Material.AIR);
    }
   if (block.getRelative(BlockFace.SOUTH).getType() == Material.FIRE) {
        block.getRelative(BlockFace.SOUTH).setType(Material.AIR);
    }
   if (block.getRelative(BlockFace.WEST).getType() == Material.FIRE) {
        block.getRelative(BlockFace.WEST).setType(Material.AIR);
    }
   if (block.getRelative(BlockFace.EAST).getType() == Material.FIRE) {
        block.getRelative(BlockFace.EAST).setType(Material.AIR);
    }
   //rather than disabling fire spread, we make it burn itself out by targeting fire blocks and removing them
}
 
開發者ID:danieljohnson2,項目名稱:SnowballMadness,代碼行數:21,代碼來源:SnowballMadness.java

示例8: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler
  public void onBlockBurn(BlockBurnEvent e){
  	if (e.isCancelled()){
  		return;
  	}
  	Block b = e.getBlock();
  	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
  	if (r != null){
  		return;
  	}
  	
if (!RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-block-damage")){
	e.setCancelled(true);
}
  }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:16,代碼來源:RPGlobalListener.java

示例9: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
  public void onBlockBurn(BlockBurnEvent event)
  {
Block block = event.getBlock();
Chunk blockChunk = block.getChunk();
if (config.getClaimed(blockChunk))
{
	event.setCancelled(true);
}

  }
 
開發者ID:jediminer543,項目名稱:Plugin,代碼行數:12,代碼來源:ClaimListener.java

示例10: burnListener

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
/**
 * Called when a block burns
 * Nearly the same as blockBreakEvent
 */
@EventHandler
public void burnListener(BlockBurnEvent e)
{
	Block block = e.getBlock();
	if (factoryMan.factoryExistsAt(block.getLocation()))
	{
		if (factoryMan.factoryExistsAt(block.getLocation()))
		{
			destroyFactoryAt(block);
		}
	}
}
 
開發者ID:gmlaxfanatic,項目名稱:FactoryMod,代碼行數:17,代碼來源:FactoryModListener.java

示例11: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockBurn(BlockBurnEvent event) {
	Block b = event.getBlock();
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
	
	// Capture the block
	for(Arena a : am.getArenas())
		if(a.isArenaCuboidSet())
			if(a.getArenaCuboid().isInsideCuboid(b))
				if(a.getState().equals(ArenaState.PLAYING) || a.getState().equals(ArenaState.STARTING))
					a.getPlayerBlockManager().addBlock(b);
}
 
開發者ID:timvisee,項目名稱:simple-survival-games,代碼行數:13,代碼來源:SSGBlockListener.java

示例12: onBlockBurn

import org.bukkit.event.block.BlockBurnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBurn (BlockBurnEvent burnEvent)
{
	if(!GriefPrevention.instance.config_fireDestroys)
	{
		burnEvent.setCancelled(true);
		Block block = burnEvent.getBlock();
		Block [] adjacentBlocks = new Block []
		{
			block.getRelative(BlockFace.UP),
			block.getRelative(BlockFace.DOWN),
			block.getRelative(BlockFace.NORTH),
			block.getRelative(BlockFace.SOUTH),
			block.getRelative(BlockFace.EAST),
			block.getRelative(BlockFace.WEST)
		};
		
		//pro-actively put out any fires adjacent the burning block, to reduce future processing here
		for(int i = 0; i < adjacentBlocks.length; i++)
		{
			Block adjacentBlock = adjacentBlocks[i];
			if(adjacentBlock.getType() == Material.FIRE && adjacentBlock.getRelative(BlockFace.DOWN).getType() != Material.NETHERRACK)
			{
				adjacentBlock.setType(Material.AIR);
			}
		}
		
		Block aboveBlock = block.getRelative(BlockFace.UP);
		if(aboveBlock.getType() == Material.FIRE)
		{
			aboveBlock.setType(Material.AIR);
		}
		return;
	}
	
	//don't track in worlds where claims are not enabled
       if(!GriefPrevention.instance.claimsEnabledForWorld(burnEvent.getBlock().getWorld())) return;
	
	//never burn claimed blocks, regardless of settings
	if(this.dataStore.getClaimAt(burnEvent.getBlock().getLocation(), false, null) != null)
	{
		burnEvent.setCancelled(true);
	}
}
 
開發者ID:john01dav,項目名稱:GriefPreventionPlus,代碼行數:45,代碼來源:BlockEventHandler.java


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