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


Java IgniteCause类代码示例

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


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

示例1: callBlockIgniteEvent

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的package包/类
public static BlockIgniteEvent callBlockIgniteEvent(net.minecraft.world.World world, int x, int y, int z, int igniterX, int igniterY, int igniterZ) {
    org.bukkit.World bukkitWorld = world.getWorld();
    Block igniter = bukkitWorld.getBlockAt(igniterX, igniterY, igniterZ);
    IgniteCause cause;
    switch (igniter.getType()) {
        case LAVA:
        case STATIONARY_LAVA:
            cause = IgniteCause.LAVA;
            break;
        case DISPENSER:
            cause = IgniteCause.FLINT_AND_STEEL;
            break;
        case FIRE: // Fire or any other unknown block counts as SPREAD.
        default:
            cause = IgniteCause.SPREAD;
    }

    BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, igniter);
    world.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:22,代码来源:CraftEventFactory.java

示例2: ignite

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的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

示例3: FireSpread

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的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

示例4: callBlockIgniteEvent

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的package包/类
public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, int igniterX, int igniterY, int igniterZ) {
    org.bukkit.World bukkitWorld = world.getWorld();
    Block igniter = bukkitWorld.getBlockAt(igniterX, igniterY, igniterZ);
    IgniteCause cause;
    switch (igniter.getType()) {
        case LAVA:
        case STATIONARY_LAVA:
            cause = IgniteCause.LAVA;
            break;
        case DISPENSER:
            cause = IgniteCause.FLINT_AND_STEEL;
            break;
        case FIRE: // Fire or any other unknown block counts as SPREAD.
        default:
            cause = IgniteCause.SPREAD;
    }

    BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, igniter);
    world.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:22,代码来源:CraftEventFactory.java

示例5: WhenFireLimitor

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的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

示例6: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的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

示例7: onPlayerIgnite

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的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

示例8: onBlockIgnite

import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onBlockIgnite(cn.nukkit.event.block.BlockIgniteEvent event) {
	if (canIgnore(BlockIgniteEvent.getHandlerList())) {
		return;
	}

	cn.nukkit.block.Block ignited = event.getBlock();
	IgniteCause cause = IgniteCause.FLINT_AND_STEEL;

	switch (event.getCause()) {
	case EXPLOSION:
		cause = IgniteCause.EXPLOSION;
		break;
	case FIREBALL:
		cause = IgniteCause.FIREBALL;
		break;
	case FLINT_AND_STEEL:
		cause = IgniteCause.FLINT_AND_STEEL;
		break;
	case LAVA:
		cause = IgniteCause.LAVA;
		break;
	case LIGHTNING:
		cause = IgniteCause.LIGHTNING;
		break;
	case SPREAD:
		cause = IgniteCause.SPREAD;
		break;
	default:
		cause = IgniteCause.FLINT_AND_STEEL; // Default to Flint and Steel
		break;
	}

	BlockIgniteEvent bukkitEvent = new BlockIgniteEvent(PokkitBlock.toBukkit(ignited), cause, PokkitEntity.toBukkit(event.getEntity()));
	callCancellable(event, bukkitEvent);
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:37,代码来源:PlayerBlockEvents.java


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