本文整理匯總了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);
}
}
示例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);
}
}
}
}
}
示例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();
}
}
}
示例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);
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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, "冷卻時間還沒有結束呢!");
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}