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


Java BlockIgniteEvent.getCause方法代碼示例

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


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

示例1: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventWrapper
public void onBlockIgnite(final BlockIgniteEvent event) {
    // Flint & steel generates a BlockPlaceEvent
    if(event.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) return;

    BlockState oldState = event.getBlock().getState();
    BlockState newState = BlockStateUtils.cloneWithMaterial(event.getBlock(), Material.FIRE);
    ParticipantState igniter = null;

    if(event.getIgnitingEntity() != null) {
        // The player themselves using flint & steel, or any of
        // several types of owned entity starting or spreading a fire.
        igniter = entityResolver.getOwner(event.getIgnitingEntity());
    } else if(event.getIgnitingBlock() != null) {
        // Fire, lava, or flint & steel in a dispenser
        igniter = blockResolver.getOwner(event.getIgnitingBlock());
    }

    callEvent(event, oldState, newState, igniter);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:21,代碼來源:BlockTransformListener.java

示例2: FireSpread

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void FireSpread(BlockIgniteEvent e) {
	if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.BlockIgnite-FireSpread.Enable")) {
		if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.BlockIgnite-FireSpread.World.All_World")) {
			if (WorldUtils.getWFS().contains(e.getBlock().getWorld().getName())) {
				if (e.getCause() == IgniteCause.SPREAD) {
					e.setCancelled(true);
				}
			}
		} else {
			if (e.getCause() == IgniteCause.SPREAD) {
	e.setCancelled(true);
}
		}
    }
}
 
開發者ID:DianoxDragon,項目名稱:UltimateSpawn,代碼行數:17,代碼來源:BasicFeatures.java

示例3: WhenFireLimitor

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void WhenFireLimitor(BlockIgniteEvent event) {
    if (ConfigOptimize.FireLimitorenable == true) {
        if (event.getCause() == IgniteCause.FLINT_AND_STEEL) {
            return;
        }
        Block block = event.getBlock();
        if (CheckFast(block.getChunk())) {
            event.setCancelled(true);
        } else {
            ChunkChecked.put(block.getChunk(), System.currentTimeMillis());
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:15,代碼來源:FireLimitor.java

示例4: isManual

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
/**
 * Return true if the block transformation was performed "by hand".
 *
 * Handled:
 *  - place
 *  - mine
 *  - bucket fill/empty
 *  - flint & steel fire/tnt
 *
 * Not handled:
 *  - bonemeal
 *  - probably lots of other things
 */
public boolean isManual() {
    final Event event = getCause();

    if(Types.instanceOfAny(
        event,
        BlockPlaceEvent.class,
        BlockBreakEvent.class,
        PlayerBucketEmptyEvent.class,
        PlayerBucketFillEvent.class
    )) return true;

    if(event instanceof BlockIgniteEvent) {
        BlockIgniteEvent igniteEvent = (BlockIgniteEvent) event;
        if(igniteEvent.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && igniteEvent.getIgnitingEntity() != null) {
            return true;
        }
    }

    if(event instanceof ExplosionPrimeByEntityEvent && ((ExplosionPrimeByEntityEvent) event).getPrimer() instanceof Player) {
        return true;
    }

    return false;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:38,代碼來源:BlockTransformEvent.java

示例5: fireSpread

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void fireSpread(final BlockIgniteEvent e) {
	if (!cm.fireSpreadControllerEnabled) {
		return;
	}
	if (BlockIgniteEvent.IgniteCause.SPREAD == e.getCause()) {
		long now = System.currentTimeMillis();
		if (now > this.lastfireSpread + cm.fireSpreadInterval) {
			this.lastfireSpread = now;
		} else {
			e.setCancelled(true);
		}
	}
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:15,代碼來源:FireSpreadReducer.java

示例6: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event)
{   
	//logger.info("Cause: " + event.getCause().name());
	
	// Because we don't have any info about which player sent the fireball, disable block burning in World only (won't affect nether)
    if(event.getCause() == BlockIgniteEvent.IgniteCause.FIREBALL
    		&& event.getBlock().getWorld().getName().equalsIgnoreCase("World"))
    {
    	event.setCancelled(true);
    }
}
 
開發者ID:Allov,項目名稱:world-of-icerealm,代碼行數:13,代碼來源:FireStoper.java

示例7: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event)
{
	IgniteCause ic = event.getCause();
	if(ic != IgniteCause.FLINT_AND_STEEL)
		event.setCancelled(true);
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:8,代碼來源:PlayerInteractListener.java

示例8: onPlayerIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
/**
 * Prevents exiled players from breaking blocks
 * @param e The event
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerIgnite(BlockIgniteEvent e) {
	if (e.getCause() == IgniteCause.FLINT_AND_STEEL) {
		checkAndCancelRule(ExileRule.IGNITE, e, e.getPlayer());
	}
}
 
開發者ID:DevotedMC,項目名稱:ExilePearl,代碼行數:11,代碼來源:ExileListener.java

示例9: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockIgnite (BlockIgniteEvent igniteEvent)
{
	if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL &&  igniteEvent.getCause() != IgniteCause.LIGHTNING)
	{	
		igniteEvent.setCancelled(true);			
	}
}
 
開發者ID:john01dav,項目名稱:GriefPreventionPlus,代碼行數:9,代碼來源:BlockEventHandler.java

示例10: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockIgnite(BlockIgniteEvent event)
{
    if (event.getCause() == IgniteCause.FLINT_AND_STEEL)
    {
        logAction(WorldLogAction.USE, event.getPlayer(), event.getBlock(), event.isCancelled());
    }
}
 
開發者ID:Vanillacraft,項目名稱:vanillacraft,代碼行數:9,代碼來源:WorldLogListeners.java

示例11: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
/**
 * On block ignite.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockIgnite(BlockIgniteEvent event) {

    IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(event.getBlock().getLocation());

    if (((event.getCause() == IgniteCause.SPREAD || event.getCause() == IgniteCause.LAVA)
            && land.getFlagAndInherit(FlagList.FIRESPREAD.getFlagType()).getValueBoolean() == false)
            || land.getFlagAndInherit(FlagList.FIRE.getFlagType()).getValueBoolean() == false) {
        event.setCancelled(true);
    }
}
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:17,代碼來源:WorldListener.java

示例12: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockIgnite(final BlockIgniteEvent event) {
    if (event.getCause() != IgniteCause.FLINT_AND_STEEL) {
        final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getBlock().getLocation());
        if (region != null && region.getFlag(Flag.FIRE)) {
            event.setCancelled(true);
        }
    }
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:10,代碼來源:FireFlagListener.java

示例13: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBlockIgnite(BlockIgniteEvent event) {
    if (event.getCause() == BlockIgniteEvent.IgniteCause.SPREAD) {
        event.setCancelled(true);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:7,代碼來源:WorldListener.java

示例14: onIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onIgnite(BlockIgniteEvent ignite) {

  if (ignite.getIgnitingBlock() == null && ignite.getIgnitingEntity() == null) {
    return;
  }

  Game game = null;
  if (ignite.getIgnitingBlock() == null) {
    if (ignite.getIgnitingEntity() instanceof Player) {
      game = BedwarsRel.getInstance().getGameManager()
          .getGameOfPlayer((Player) ignite.getIgnitingEntity());
    } else {
      game = BedwarsRel.getInstance().getGameManager()
          .getGameByLocation(ignite.getIgnitingEntity().getLocation());
    }
  } else {
    game = BedwarsRel.getInstance().getGameManager()
        .getGameByLocation(ignite.getIgnitingBlock().getLocation());
  }

  if (game == null) {
    return;
  }

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

  if (ignite.getCause() == IgniteCause.ENDER_CRYSTAL || ignite.getCause() == IgniteCause.LIGHTNING
      || ignite.getCause() == IgniteCause.SPREAD) {
    ignite.setCancelled(true);
    return;
  }

  if (ignite.getIgnitingEntity() == null) {
    ignite.setCancelled(true);
    return;
  }

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

  if (!game.getRegion().isPlacedBlock(ignite.getIgnitingBlock())
      && ignite.getIgnitingBlock() != null) {
    game.getRegion().addPlacedBlock(ignite.getIgnitingBlock(),
        ignite.getIgnitingBlock().getState());
  }
}
 
開發者ID:BedwarsRel,項目名稱:BedwarsRel,代碼行數:51,代碼來源:BlockListener.java

示例15: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event) {
    if(event.getCause() == BlockIgniteEvent.IgniteCause.SPREAD || event.getCause() == BlockIgniteEvent.IgniteCause.LAVA) {
        event.setCancelled(true);
    }
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:7,代碼來源:RestrictionsListener.java


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