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


Java Fireball類代碼示例

本文整理匯總了Java中org.bukkit.entity.Fireball的典型用法代碼示例。如果您正苦於以下問題:Java Fireball類的具體用法?Java Fireball怎麽用?Java Fireball使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: onEntityDamage

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
	if ((e.getDamager() instanceof Arrow) && (((Arrow) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
		e.setDamage(e.getDamage() + damage);
		if (effect != null) {

			((LivingEntity) e.getEntity()).addPotionEffect(effect);
		}
	}
	if ((e.getDamager() instanceof Fireball) && (((Fireball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
		e.setDamage(e.getDamage() + damage);
	}
	if ((e.getDamager() instanceof Snowball) && (((Snowball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
		e.setDamage(e.getDamage() + damage);
	}

}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:18,代碼來源:LongRangeWeapon.java

示例2: onMonsterDamage

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterDamage(EntityDamageEvent event)
{		
	if (event instanceof EntityDamageByEntityEvent)
	{
		EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event;
	
		//logger.info(entityDamageByEntityEvent.getDamager());
		if(entityDamageByEntityEvent.getDamager() instanceof Fireball) 
		{
			Fireball fb = (Fireball) entityDamageByEntityEvent.getDamager();
			
			if (fb.getShooter() instanceof Player)
			{
				if (fb instanceof SmallFireball)
				{
					entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 3);
				}
				else // Big fireball
				{
					entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 5);
				}
			}
		}
	}
}
 
開發者ID:Allov,項目名稱:world-of-icerealm,代碼行數:27,代碼來源:FireDamageModifier.java

示例3: onEntityExplodeEvent

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onEntityExplodeEvent(EntityExplodeEvent event) {
    AttackType attackType = AttackType.UNKNOWN;
    Entity attacker = event.getEntity();
    if (attacker instanceof TNTPrimed) {
        attackType = AttackType.TNT;
    } else if (attacker instanceof Creeper) {
        attackType = AttackType.CREEPER;
    } else if (attacker instanceof Fireball) {
        if (((Fireball) attacker).getShooter() instanceof Ghast) {
            attackType = AttackType.GHAST;
        }
    }
    if (plugin.getChestSettings().allowDestroyBy(attackType)) {
        return;
    }
    for (Iterator<Block> it = event.blockList().iterator(); it.hasNext();) {
        Block block = it.next();
        if (isProtected(block)) {
            it.remove();
        }
    }
}
 
開發者ID:rutgerkok,項目名稱:BlockLocker,代碼行數:24,代碼來源:BlockDestroyListener.java

示例4: onInteract

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@Override
public void onInteract(PlayerInteractEvent event) {
	event.setCancelled(true);
	Player player = event.getPlayer();
	User user = Zephyrus.getUser(player);
	Block block = (Block) user.getTarget(this).getTarget();
	int delay = user.getDelay(getInternalName());
	if (delay > 0) {
		Language.sendError("item.delay", player,
				"[SECONDS]", delay + "");
		return;
	}
	if (Zephyrus.getHookManager().canBuild(player, block)) {
		if (getLevel(player.getItemInHand().getItemMeta().getLore()) > 5) {
			player.launchProjectile(Fireball.class);
		} else {
			player.launchProjectile(SmallFireball.class);
		}
		user.setDelay(getName(), levelToDelay(getLevel(player.getItemInHand().getItemMeta().getLore())));
		return;
	}
	Language.sendError("item.rodoffire.failure", player);
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:24,代碼來源:RodOfFire.java

示例5: fireOnTarget

import org.bukkit.entity.Fireball; //導入依賴的package包/類
public void fireOnTarget(){
	lastFired = System.currentTimeMillis();
	Vector target = toTarget();
	Vector target2 = target.clone().multiply(5);
	//System.out.println("addition: " + target2);
	//System.out.println("SOUND");
	//myGhast.getWorld().playSound(myGhast.getLocation(), Sound.GHAST_DEATH, 2.0f, (float) (Math.random() * 3.0f));
	Location fireLoc = myGhast.getLocation().clone().add(target2);
	//System.out.println("fireloc: " + fireLoc);
	//Fireball f = (Fireball) myGhast.getWorld().spawnEntity(fireLoc, EntityType.FIREBALL);
	//f.setDirection(target);
	Projectile proj = myGhast.getWorld().spawn(fireLoc, Fireball.class);
	// launchProjectile(this.projectileClass, finalVec);
	// finally, set the shooter
	proj.setVelocity(target);
	Fireball f = (Fireball) proj;
	if(myGhast.getWorld().getName().startsWith("Trinitos_")){
		f.setIsIncendiary(false);
		f.setYield(2.0F);
	} else {
		f.setIsIncendiary(true);
		f.setYield(1.5F);
	}
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:25,代碼來源:DroneFighter.java

示例6: onChunkProtect

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@EventHandler
public void onChunkProtect(ChunkLoadEvent e) {
	for(Entity entity : e.getChunk().getEntities()) {
		if(entity instanceof WitherSkull) {
			WitherSkull wither = (WitherSkull) entity;
			if(pl.getConfiguration().getDebugConfig().isEnabled()) {
				xEssentials.log("removed wither skull at: {" + wither.getWorld().getName() + ", " + wither.getLocation().getBlockX() + ", " + wither.getLocation().getBlockY() + ", " + wither.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);	
			}
			wither.remove();
		} else if(entity instanceof Fireball) {
			Fireball fb = (Fireball) entity;
			if(pl.getConfiguration().getDebugConfig().isEnabled()) {
				xEssentials.log("removed fireball at: {" + fb.getWorld().getName() + ", " + fb.getLocation().getBlockX() + ", " + fb.getLocation().getBlockY() + ", " + fb.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);
			}
			fb.remove();
		}
	}
}
 
開發者ID:xEssentials,項目名稱:xEssentials-deprecated-bukkit,代碼行數:19,代碼來源:ChunkProtectionEvent.java

示例7: configureBullet

import org.bukkit.entity.Fireball; //導入依賴的package包/類
/**
 * Based on the parameters in this bullet, configure some stuff.
 * 
 * @param bullet the newly minted projectile 
 * @param world the world it inhabits
 * @param shooter who shot it
 * @param velocity The gun's intrinsic velocity. Might be ignored. 
 */
public void configureBullet(Projectile bullet, World world, ProjectileSource shooter, Vector velocity) {
	
	bullet.setVelocity(velocity);
	bullet.setFireTicks(this.fireTicks);
	
	if (bullet instanceof Fireball) {
		((Fireball) bullet).setIsIncendiary(Math.random() < this.fireChance);
	}
}
 
開發者ID:ProgrammerDan,項目名稱:AddGun,代碼行數:18,代碼來源:Bullet.java

示例8: launch

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@Override
public void launch(Player p, Vector vector) {
    Fireball fb = p.launchProjectile(Fireball.class);
    if (vector == null) {
        fb.setVelocity(p.getEyeLocation().getDirection().multiply(2));
    } else {
        fb.setVelocity(vector.multiply(2));
    }
    fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
    CooldownManager.getInstance().add(p);
}
 
開發者ID:Soldier233,項目名稱:ArchersBattle,代碼行數:12,代碼來源:FireBall.java

示例9: launchList

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@Override
public void launchList(Player p, List<Vector> vectors) {
    p.sendMessage(String.valueOf(vectors.size()));
    for(Vector v:vectors){
        Fireball fb = p.launchProjectile(Fireball.class);
        fb.setDirection(v.multiply(2));
        fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
    }

    CooldownManager.getInstance().add(p);
}
 
開發者ID:Soldier233,項目名稱:ArchersBattle,代碼行數:12,代碼來源:FireBall.java

示例10: run

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@Override
public void run(PlayerInteractEvent evt) {
    Player player = evt.getPlayer();
    if (CooldownTicker.can(this, player) || evt.getItem().getItemMeta().getLore().contains("§6高速射擊")) {
        Inventory inv = player.getInventory();
        if (!inv.contains(Material.SULPHUR)) {
            AzureAPI.log(player, "你沒有彈藥! 需要 " + ChatColor.RED + "火藥" + ChatColor.GOLD + " 作為彈藥");
            AzureAPI.playSound(player, Sound.ENTITY_ITEM_BREAK);
            return;
        }
        int slot = inv.first(Material.SULPHUR);
        ItemStack ammo = inv.getItem(slot);
        int amount = ammo.getAmount();
        if (amount > 1) {
            ammo.setAmount(amount - 1);
            inv.setItem(slot, ammo);
        } else {
            inv.setItem(slot, null);
        }
        
        Location eye = player.getEyeLocation();
        Vector direction = eye.getDirection().multiply(2);
        Projectile projectile = player.getWorld().spawn(eye.add(direction), Fireball.class);
        projectile.setShooter(player);
        projectile.setVelocity(direction);
        AzureAPI.playSound(player, Sound.ITEM_FIRECHARGE_USE, true);
        
        CooldownTicker.cooldown(this, player, TimeUnit.SECONDS, 3);
    } else {
        AzureAPI.playSound(player, Sound.UI_BUTTON_CLICK);
        AzureAPI.log(player, "冷卻時間還沒有結束呢!");
    }
}
 
開發者ID:Recraft,項目名稱:Recreator,代碼行數:34,代碼來源:ItemRedstoneCannon.java

示例11: onExplosionPrime

import org.bukkit.entity.Fireball; //導入依賴的package包/類
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
	event.setFire(false);
	if (event.getEntity() instanceof Fireball && event.getEntity().hasMetadata("ultimate")){
		event.setRadius(0);
	}
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:8,代碼來源:PlayerListener.java

示例12: cast

import org.bukkit.entity.Fireball; //導入依賴的package包/類
public void cast(Player source) {
	Account account = new Account(source);
	Character character = account.getLoadedCharacter();
	if(character.getMana() < getCost()){
		return;
	}
	character.setMana(character.getMana() - getCost());
	World world = source.getWorld();
	Location loc = source.getLocation();
	new BukkitRunnable(){
		int count = 0;
		public void run(){
			boolean d = false;
			for(int i = 0; i < 6; i++){
				int x = new Random().nextInt(getRange());
				int z = new Random().nextInt(getRange());
				
				if(d)
					x = x*-1;
				
				if(!d)
					z = z*-1;
				
				d = !d;
				loc.add(x, 30, z);
				Fireball ball = (Fireball)world.spawnEntity(loc, EntityType.FIREBALL);
				loc.subtract(x, 30, z);
				ball.setDirection(new Vector(0, -0.3, 0));
				ball.setYield(2);
			}
			count++;
			if(count > overSeconds())
				this.cancel();
		}
	}.runTaskTimer(Cardinal.getPlugin(), 0, 20);
	
	
	
}
 
開發者ID:DamoclesProject,項目名稱:Damocles,代碼行數:40,代碼來源:MeteorShowerSpell.java

示例13: executeMagic

import org.bukkit.entity.Fireball; //導入依賴的package包/類
public void executeMagic(Player player)
{
	Fireball fb = player.launchProjectile(Fireball.class);
	fb.setIsIncendiary(true);
	fb.setBounce(false);
	fb.setShooter(player);
//	fb.setVelocity(new Vector(1.0,0,0));
}
 
開發者ID:Allov,項目名稱:world-of-icerealm,代碼行數:9,代碼來源:BigFireballMagic.java

示例14: launchFireball

import org.bukkit.entity.Fireball; //導入依賴的package包/類
public static Fireball launchFireball(Player owner, Location loc, Vector vec)
{
	World world = loc.getWorld();
	Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.FIREBALL);
	fb.setShooter(owner);
	fb.setVelocity(vec.multiply(2.0));
	world.playSound(loc, Sound.WITHER_SHOOT, 1F, 1F);
	return fb;
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:10,代碼來源:AbilityManager.java

示例15: launchSmallFireball

import org.bukkit.entity.Fireball; //導入依賴的package包/類
public static Fireball launchSmallFireball(Player owner, Location loc, Vector vec)
{
	World world = loc.getWorld();
	Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.SMALL_FIREBALL);
	fb.setShooter(owner);
	fb.setVelocity(vec.multiply(2.0));
	world.playSound(loc, Sound.GHAST_FIREBALL, 1F, 2F);
	return fb;
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:10,代碼來源:AbilityManager.java


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