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


Java TNTPrimed.setFuseTicks方法代码示例

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


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

示例1: onBlockBreak

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
/**
 * Spawns a creeper or primed TNT when a player breaks an ore block, by chance.
 *
 * @param event The event
 */
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
  Block block = event.getBlock();
  if (ORES.contains(block.getType())) {
    double chance = Math.random();
    Location location = block.getLocation().add(0.5, 0.5, 0.5);
    if (0.05 > chance) {
      TNTPrimed tnt = location.getWorld().spawn(location, TNTPrimed.class);
      tnt.setFuseTicks(80);
    } else if (0.1 > chance) {
      Creeper creeper = location.getWorld().spawn(location, Creeper.class);
      creeper.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 2));
    }
  }
}
 
开发者ID:twizmwazin,项目名称:OpenUHC,代码行数:21,代码来源:BlastMining.java

示例2: remoteDetonation

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
/**
 * Detonate TNT for Blast Mining
 */
public void remoteDetonation() {
    Player player = getPlayer();
    Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);

    if (targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true) || !blastMiningCooldownOver()) {
        return;
    }

    TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);

    SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
    player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));

    tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
    tnt.setFuseTicks(0);
    targetBlock.setType(Material.AIR);

    mcMMOPlayer.setAbilityDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
    mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false);
    new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:25,代码来源:MiningManager.java

示例3: doOnLeftClick

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@Override
public void doOnLeftClick(Racer racer, Action action)
{
    // This will be performed in the event that you left-click with the item.
    if(EquestrianDash.plugin.getConfig().getBoolean("Powerups.TNT.ThrowDirections.ThrowAheadEnabled"))
    {
        Player p = racer.getPlayer();

        p.playSound(p.getLocation(), Sound.FUSE, 7, 1);
        TNTPrimed tnt = p.getWorld().spawn(p.getLocation(), TNTPrimed.class);
        tnt.setVelocity(p.getLocation().getDirection().normalize().multiply(EquestrianDash.plugin.getConfig().getDouble("Powerups.TNT.ThrowDirections.ThrowAheadMultiplier")));
        tnt.setFuseTicks(EquestrianDash.plugin.getConfig().getInt("Powerups.TNT.ThrowDirections.ThrowAheadTicks"));

        racer.getPlayer().getInventory().clear();
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:17,代码来源:TNTPowerup.java

示例4: run

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@Override
public boolean run(Player player, ConfigurationSection config) {
	Location loc = player.getTargetBlock(null, config.getInt("max_distence")).getLocation();
	final TNTPrimed tnt = player.getWorld().spawn(loc.add(0, 1, 0), TNTPrimed.class);
	tnt.setYield((float) config.getDouble("power"));
	tnt.setIsIncendiary(config.getBoolean("enable_fire"));
	tnt.setFuseTicks(0);
	bombSites.put(tnt, player.getName());
	Bukkit.getScheduler().scheduleSyncDelayedTask(RodsTwo.getInstance(), new Runnable(){
		@Override
		public void run() {
			bombSites.remove(tnt);
		}}, 10L);
	//player.getWorld().createExplosion(loc, (float) config.getDouble("power"), config.getBoolean("enable_fire"));
	return true; 
}
 
开发者ID:EvilKanoa,项目名称:RodsTwo,代码行数:17,代码来源:Explosion.java

示例5: handleInstantActivation

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void handleInstantActivation(BlockPlaceEvent event) {
    if(this.properties.instantIgnite && event.getBlock().getType() == Material.TNT) {
        World world = event.getBlock().getWorld();
        TNTPrimed tnt = world.spawn(BlockUtils.base(event.getBlock()), TNTPrimed.class);

        if(this.properties.fuse != null) {
            tnt.setFuseTicks(this.getFuseTicks());
        }

        if(this.properties.power != null) {
            tnt.setYield(this.properties.power); // Note: not related to EntityExplodeEvent.yield
        }

        if(callPrimeEvent(tnt, event.getPlayer(), true)) {
            // Only cancel the block placement if the prime event is NOT cancelled.
            // If priming is cancelled, the block is allowed to stay (unless some
            // other handler has already cancelled the place event).
            event.setCancelled(true);
            world.playSound(tnt.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1);

            ItemStack inHand = event.getItemInHand();
            if(inHand.getAmount() == 1) {
                inHand = null;
            } else {
                inHand.setAmount(inHand.getAmount() - 1);
            }
            event.getPlayer().getInventory().setItem(event.getHand(), inHand);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:32,代码来源:TNTMatchModule.java

示例6: setCustomProperties

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void setCustomProperties(ExplosionPrimeEvent event) {
    if(event.getEntity() instanceof TNTPrimed) {
        TNTPrimed tnt = (TNTPrimed) event.getEntity();

        if(this.properties.fuse != null) {
            tnt.setFuseTicks(this.getFuseTicks());
        }

        if(this.properties.power != null) {
            tnt.setYield(this.properties.power); // Note: not related to EntityExplodeEvent.yield
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:15,代码来源:TNTMatchModule.java

示例7: dispenserNukes

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void dispenserNukes(BlockTransformEvent event) {
    BlockState oldState = event.getOldState();
    if(oldState instanceof Dispenser &&
       this.properties.dispenserNukeLimit > 0 &&
       this.properties.dispenserNukeMultiplier > 0 &&
       event.getCause() instanceof EntityExplodeEvent) {

        EntityExplodeEvent explodeEvent = (EntityExplodeEvent) event.getCause();
        Dispenser dispenser = (Dispenser) oldState;
        int tntLimit = Math.round(this.properties.dispenserNukeLimit / this.properties.dispenserNukeMultiplier);
        int tntCount = 0;

        for(ItemStack stack : dispenser.getInventory().contents()) {
            if(stack != null && stack.getType() == Material.TNT) {
                int transfer = Math.min(stack.getAmount(), tntLimit - tntCount);
                if(transfer > 0) {
                    stack.setAmount(stack.getAmount() - transfer);
                    tntCount += transfer;
                }
            }
        }

        tntCount = (int) Math.ceil(tntCount * this.properties.dispenserNukeMultiplier);

        for(int i = 0; i < tntCount; i++) {
            TNTPrimed tnt = this.getMatch().getWorld().spawn(BlockUtils.base(dispenser), TNTPrimed.class);

            tnt.setFuseTicks(10 + this.getMatch().getRandom().nextInt(10)); // between 0.5 and 1.0 seconds, same as vanilla TNT chaining

            Random random = this.getMatch().getRandom();
            Vector velocity = new Vector(random.nextGaussian(), random.nextGaussian(), random.nextGaussian()); // uniform random direction
            velocity.normalize().multiply(0.5 + 0.5 * random.nextDouble());
            tnt.setVelocity(velocity);

            callPrimeEvent(tnt, explodeEvent.getEntity(), false);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:40,代码来源:TNTMatchModule.java

示例8: onThrowTNT

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler
public void onThrowTNT(PlayerInteractEvent event) {
	Player p = event.getPlayer();
	Gamer g = Gamer.get(p.getName());
	if (g.getVariable("spectator") != null)
		return;

	if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
		if (p.getItemInHand().getType() == Material.TNT) {
			// Frag Grenades
			TNTPrimed e = (TNTPrimed) event.getPlayer().getWorld().spawnEntity(p.getEyeLocation(),	EntityType.PRIMED_TNT);
			e.setFuseTicks(38);
			e.setYield(2.5F);
			e.setVelocity(event.getPlayer().getEyeLocation().getDirection());
			e.setMetadata("Player", new FixedMetadataValue(Nexus.getPlugin(), g.getPlayer().getName()));
			e.setMetadata("Cause", new FixedMetadataValue(Nexus.getPlugin(), CustomDamageCause.TNT_GRENADE.name()));
			
			event.setUseItemInHand(Event.Result.DENY);
			ItemStack stack = null;
			if (event.getItem().getAmount() > 1) {
				ItemStack s = event.getItem();
				s.setAmount(event.getItem().getAmount() - 1);
				stack = s;
			}
			p.getInventory().setItem(p.getInventory().getHeldItemSlot(), stack);
			event.setCancelled(true);
		}
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:30,代码来源:KitEvents.java

示例9: onPlayerInteract

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
	Gamer g = Gamer.get(event.getPlayer());
	
	if (event.getAction() != Action.PHYSICAL)
		return;
	
	Block b = event.getClickedBlock();
	if (!b.hasMetadata("Mine"))
		return;
	
	Mine mine = Mine.getList().get(b.getMetadata("Mine").get(0).asInt());
	
	Team playerTeam = Nexus.getRotary().getCurrentMap().getTeam(g);
	Team targetTeam = Nexus.getRotary().getCurrentMap().getTeam(mine.getGamer());
	
	if (playerTeam == targetTeam)
		return;
	
	mine.setIgnited(true);
	
	TNTPrimed e = (TNTPrimed) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getEyeLocation(), EntityType.PRIMED_TNT);
	e.setFuseTicks(10);
	e.setYield(2.7F);
	e.setMetadata("Player", new FixedMetadataValue(Nexus.getPlugin(), mine.getGamer().getName()));
	e.setMetadata("Cause", new FixedMetadataValue(Nexus.getPlugin(), CustomDamageCause.TNT_MINE.name()));
	event.getClickedBlock().setType(Material.AIR);
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:29,代码来源:KitEvents.java

示例10: onBlockPlace

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
/**
 * Fire the TNT's automatically
 *
 * @param event Event
 */
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
    if (this.game != null && this.game.isPvPActivated() && event.getBlock().getType() == Material.TNT)
    {
        event.getBlock().setType(Material.AIR);

        TNTPrimed tnt = event.getBlock().getWorld().spawn(event.getBlock().getLocation(), TNTPrimed.class);
        tnt.setFuseTicks(tnt.getFuseTicks() / 2);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:17,代码来源:AutomaticTNTModule.java

示例11: onBlockPlace

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
    public void onBlockPlace(BlockPlaceEvent ev) {
        Player p = ev.getPlayer();
//        BlockData block = plugin.getArenaManager().getBlock(location);
        Material type = ev.getBlock().getType();
        GameManager gameMan = plugin.getGameManager();
        ArenaManager arenaMan = plugin.getArenaManager();
        ArenaData aData = arenaMan.getCurrentArena();
        
        if(!arenaMan.isEditing(p.getName(), p.getWorld().getName())) {
            if(gameMan.isSpectator(p)) {
                ev.setCancelled(true);
            } else if(gameMan.getState() != SGGameState.GAME
                    && gameMan.getState() != SGGameState.DEATHMATCH) {
                ev.setCancelled(true);
            } else if(aData != null && !aData.placeWhitelist.contains(type)) {
                ev.setCancelled(true);
            }
        }
        if(!ev.isCancelled()) {
            // Allowed
            if(ev.getBlock().getType() == Material.TNT) {
                ev.getBlock().setType(Material.AIR);
                TNTPrimed tnt = (TNTPrimed) p.getWorld().spawnEntity(ev.getBlock().getLocation(), EntityType.PRIMED_TNT);
                tnt.setFuseTicks(plugin.getSettings().tntTicks);
                tnt.setMetadata("explode", new FixedMetadataValue(plugin, false));
            } 
//            else if (block == null 
//                    && !arenaMan.isEditing(p.getName(), p.getWorld().getName())) {
//                block = new BlockData();
//                block.location = location;
//                block.type = Material.AIR;
//                block.data = 0;
//                plugin.getDebug().normal("OnBlockPlace");
//                plugin.getArenaManager().setBlock(p.getName(), p.getWorld(), block);
//            }
        }
    }
 
开发者ID:ModernDayPlayer,项目名称:SurvivalGamesX,代码行数:39,代码来源:BlockListener.java

示例12: handleTraps

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
private void handleTraps() {
    Player player = getPlayer();

    if (Permissions.trapsBypass(player)) {
        return;
    }

    if (Misc.getRandom().nextBoolean()) {
        player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.Boom"));

        TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(fishingCatch.getLocation(), EntityType.PRIMED_TNT);
        fishingCatch.setPassenger(tnt);

        Vector velocity = fishingCatch.getVelocity();
        double magnitude = velocity.length();
        fishingCatch.setVelocity(velocity.multiply((magnitude + 1) / magnitude));

        tnt.setMetadata(mcMMO.tntsafeMetadataKey, mcMMO.metadataValue);
        tnt.setFuseTicks(3 * Misc.TICK_CONVERSION_FACTOR);
    }
    else {
        player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.Poison"));

        ThrownPotion thrownPotion = player.getWorld().spawn(fishingCatch.getLocation(), ThrownPotion.class);
        thrownPotion.setItem(new Potion(PotionType.POISON).splash().toItemStack(1));

        fishingCatch.setPassenger(thrownPotion);
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:30,代码来源:FishingManager.java

示例13: effect

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@Override
public void effect(Event e, ItemStack item, int level) {
	PlayerDeathEvent event = (PlayerDeathEvent) e;
	for(int i = level; i >= 0; i--) {
	TNTPrimed tnt = (TNTPrimed) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.PRIMED_TNT);
	tnt.setFuseTicks(delay);
	tnt.setVelocity(new Vector(Tools.random.nextDouble()*1.5 - 1, Tools.random.nextDouble() * 1.5, Tools.random.nextDouble()*1.5 - 1));
	if(!Main.createExplosions)
		tnt.setMetadata("ce.explosive", new FixedMetadataValue(getPlugin(), null));
	}
}
 
开发者ID:Taiterio,项目名称:ce,代码行数:12,代码来源:SelfDestruct.java

示例14: doOnRightClick

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@Override
public void doOnRightClick(Racer racer, Action action)
{
    racer.getPlayer().sendMessage(getMessage());
    // This will be performed in the event that you right-click with the item.
    if (EquestrianDash.plugin.getConfig().getBoolean("Powerups.TNT.ThrowDirections.ThrowBehindEnabled"))
    {
        Player p = racer.getPlayer();
        p.playSound(p.getLocation(), Sound.FUSE, 7, 1);
        TNTPrimed tnt = p.getWorld().spawn(p.getLocation(), TNTPrimed.class);
        tnt.setFuseTicks(EquestrianDash.plugin.getConfig().getInt("Powerups.TNT.ThrowDirections.ThrowBehindTicks"));

        racer.getPlayer().getInventory().clear();
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:16,代码来源:TNTPowerup.java

示例15: onExplosionPrime

import org.bukkit.entity.TNTPrimed; //导入方法依赖的package包/类
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity() instanceof TNTPrimed) {
        TNTPrimed tnt = (TNTPrimed) event.getEntity();
        if (fuse != 4) {
            tnt.setFuseTicks(fuse);
        }
        if (power != 4.0) {
            tnt.setYield((float) power);
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:13,代码来源:Tnt.java


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