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


Java BlockIgniteEvent.isCancelled方法代碼示例

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


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

示例1: ignite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public boolean ignite(Player igniter, Location loc, IgniteCause cause) {
    Random rand = new Random();

    loc.add(0.5, 0.5, 0.5);
    
    BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(), 
            cause, (org.bukkit.entity.Entity) igniter);
    Bukkit.getServer().getPluginManager().callEvent(igniteEvent);
    if (igniteEvent.isCancelled()) {
        return false;
    }
 
    BlockState blockState = loc.getBlock().getState();
 
    BlockPlaceEvent placeEvent = new BlockPlaceEvent(loc.getBlock(), 
            blockState, loc.getBlock(), igniter.getItemInHand(), igniter, true);
    Bukkit.getServer().getPluginManager().callEvent(placeEvent);
 
    if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
        placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
        return false;
    }

    loc.getWorld().playSound(loc, Sound.ITEM_FLINTANDSTEEL_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
    loc.getBlock().setType(Material.FIRE);
    
    return true;
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:30,代碼來源:FirestrikerClick.java

示例2: onBlockStartBurn

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
   public void onBlockStartBurn(BlockIgniteEvent e){
   	if (e.isCancelled()){
   		return;
   	}
   	
   	Block b = e.getBlock();
   	Block bignit = e.getIgnitingBlock(); 
   	if ( b == null || bignit == null){
   		return;
   	}
   	RedProtect.get().logger.debug("Is BlockIgniteEvent event from global-listener");
   	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
   	if (r != null){
   		return;
   	}
   	if ((bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-spread")){
		e.setCancelled(true);
       }
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:21,代碼來源:RPGlobalListener.java

示例3: onBlockIgnite

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

	final Block block = event.getBlock();

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

示例4: onBlockStartBurn

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
   public void onBlockStartBurn(BlockIgniteEvent e){
   	RedProtect.get().logger.debug("RPBlockListener - Is BlockIgniteEvent event");
   	if (e.isCancelled()){
   		return;
   	}
   	
   	Block b = e.getBlock();
   	Block bignit = e.getIgnitingBlock(); 
   	if (b == null){
   		return;
   	}
   	
   	RedProtect.get().logger.debug("Is BlockIgniteEvent event. Canceled? " + e.isCancelled());
   	
   	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
	if (r != null && !r.canFire()){
		if (e.getIgnitingEntity() != null){
			if (e.getIgnitingEntity() instanceof Player){
				Player p = (Player) e.getIgnitingEntity();
				if (!r.canBuild(p)){
					RPLang.sendMessage(p, "blocklistener.region.cantplace");
					e.setCancelled(true);
					return;
				}
			} else {
				e.setCancelled(true);
	    		return;
			}
		}
		
		if (bignit != null && (bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA"))){
			e.setCancelled(true);
    		return;
		} 
		if (e.getCause().equals(IgniteCause.LIGHTNING) || e.getCause().equals(IgniteCause.EXPLOSION) || e.getCause().equals(IgniteCause.FIREBALL)){
			e.setCancelled(true);
           }
	}
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:41,代碼來源:RPBlockListener.java

示例5: ignite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public boolean ignite(Player igniter, Location loc, IgniteCause cause) {
    Random rand = new Random();

    loc.add(0.5, 0.5, 0.5);
    
    BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(), 
            cause, (org.bukkit.entity.Entity) igniter);
    Bukkit.getServer().getPluginManager().callEvent(igniteEvent);
    if (igniteEvent.isCancelled()) {
        return false;
    }
    
    List<Location> locations = new ArrayList<Location>();
    
    for(double x = loc.getX() - 2;x <= loc.getX() + 2;x++)
    {
    	for(double y = loc.getY() - 1;y <= loc.getY() + 1;y++)
    	{
    		for(double z = loc.getZ() - 2;z <= loc.getZ() + 2;z++)
    		{
    			locations.add(new Location(loc.getWorld(),x,y,z));
    		}
    	}
    }
    
    for(Location l : locations)
    {
	    BlockIgniteEvent igniteEvent2 = new BlockIgniteEvent(l.getBlock(), 
	            cause, (org.bukkit.entity.Entity) igniter);
	    Bukkit.getServer().getPluginManager().callEvent(igniteEvent2);
	    if (igniteEvent2.isCancelled()) {
	        continue;
	    }
	    
	    BlockState blockState = l.getBlock().getState();
	    
	    BlockPlaceEvent placeEvent = new BlockPlaceEvent(l.getBlock(), 
	            blockState, l.getBlock(), igniter.getItemInHand(), igniter, true);
	    Bukkit.getServer().getPluginManager().callEvent(placeEvent);
	    
	    if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
	        continue;
	    }
    	
    	if(l.getBlock() == null || l.getBlock().getType() == Material.AIR)
    		l.getBlock().setType(Material.FIRE);
    }

   	loc.getWorld().playSound(loc, Sound.ITEM_FIRECHARGE_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
    
    return true;
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:54,代碼來源:BlazeSword.java

示例6: captureIgniteEvent

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void captureIgniteEvent(BlockIgniteEvent event) {
    if (!event.isCancelled())
        logAndSend(getLoggableBlockEvent(BlockEventAction.IGNITE, event));
}
 
開發者ID:PowerSchill,項目名稱:LogToSplunk,代碼行數:6,代碼來源:BlockEventLogger.java

示例7: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockIgnite(BlockIgniteEvent event) {
	if(!event.isCancelled()) {
		logChunk(event.getBlock().getLocation());
	}
}
 
開發者ID:maker56,項目名稱:UltimateSurvivalGames,代碼行數:7,代碼來源:ResetListener.java

示例8: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockIgnite(BlockIgniteEvent event) {
  if (!event.isCancelled() && event.getPlayer() != null)
    tgym.afkTimer
        .put(event.getPlayer().getName(), System.currentTimeMillis());
}
 
開發者ID:Vild,項目名稱:TimeGivesYouMoney,代碼行數:7,代碼來源:PlayerListener.java


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