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


Java IgniteCause.LIGHTNING属性代码示例

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


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

示例1: callBlockIgniteEvent

public static BlockIgniteEvent callBlockIgniteEvent(net.minecraft.world.World world, int x, int y, int z, net.minecraft.entity.Entity igniter) {
    org.bukkit.World bukkitWorld = world.getWorld();
    org.bukkit.entity.Entity bukkitIgniter = igniter.getBukkitEntity();
    IgniteCause cause;
    switch (bukkitIgniter.getType()) {
    case ENDER_CRYSTAL:
        cause = IgniteCause.ENDER_CRYSTAL;
        break;
    case LIGHTNING:
        cause = IgniteCause.LIGHTNING;
        break;
    case SMALL_FIREBALL:
    case FIREBALL:
        cause = IgniteCause.FIREBALL;
        break;
    default:
        cause = IgniteCause.FLINT_AND_STEEL;
    }

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

示例2: callBlockIgniteEvent

public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, Entity igniter) {
    org.bukkit.World bukkitWorld = world.getWorld();
    org.bukkit.entity.Entity bukkitIgniter = igniter.getBukkitEntity();
    IgniteCause cause;
    switch (bukkitIgniter.getType()) {
    case ENDER_CRYSTAL:
        cause = IgniteCause.ENDER_CRYSTAL;
        break;
    case LIGHTNING:
        cause = IgniteCause.LIGHTNING;
        break;
    case SMALL_FIREBALL:
    case FIREBALL:
        cause = IgniteCause.FIREBALL;
        break;
    default:
        cause = IgniteCause.FLINT_AND_STEEL;
    }

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

示例3: onBlockIgnite

@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,代码行数:36,代码来源:PlayerBlockEvents.java

示例4: onBlockIgnite

@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,代码行数:8,代码来源:BlockEventHandler.java

示例5: onIgnite

@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,代码行数:50,代码来源:BlockListener.java

示例6: onBlockIgnite

@EventHandler
public void onBlockIgnite(BlockIgniteEvent event) {
   if (event.getCause() == IgniteCause.LIGHTNING) {
      event.setCancelled(true);
   }
}
 
开发者ID:PaulBGD,项目名称:MiniMiniGames,代码行数:6,代码来源:WorldListener.java


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