Make Obsidian Bomb skip non-air blocks and look upwards for one.

This commit is contained in:
garbagemule 2014-03-17 04:17:08 +01:00
parent 515fbc6a22
commit 71fe565316
2 changed files with 20 additions and 5 deletions

View File

@ -1,7 +1,7 @@
name: MobArena name: MobArena
author: garbagemule author: garbagemule
main: com.garbagemule.MobArena.MobArena main: com.garbagemule.MobArena.MobArena
version: 0.96.2.15 version: 0.96.2.16
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
commands: commands:
ma: ma:

View File

@ -1,5 +1,6 @@
package com.garbagemule.MobArena.waves.ability.core; package com.garbagemule.MobArena.waves.ability.core;
import com.garbagemule.MobArena.Messenger;
import com.garbagemule.MobArena.framework.Arena; import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.MABoss; import com.garbagemule.MobArena.waves.MABoss;
import com.garbagemule.MobArena.waves.ability.Ability; import com.garbagemule.MobArena.waves.ability.Ability;
@ -9,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@AbilityInfo( @AbilityInfo(
@ -28,9 +30,22 @@ public class ObsidianBomb implements Ability
LivingEntity target = AbilityUtils.getTarget(arena, boss.getEntity(), true); LivingEntity target = AbilityUtils.getTarget(arena, boss.getEntity(), true);
final World world = arena.getWorld(); final World world = arena.getWorld();
final Location loc = target.getLocation(); final Location loc;
Block b = world.getBlockAt(target.getLocation());
for (int i = 0; i < 3; i++) {
if (b.getType() == Material.AIR) {
break;
}
b = b.getRelative(BlockFace.UP);
}
loc = b.getLocation();
if (b.getType() != Material.AIR) {
Messenger.warning("Failed to place Obsidian Bomb at: " + target.getLocation());
return;
}
Block b = world.getBlockAt(loc);
b.setType(Material.OBSIDIAN); b.setType(Material.OBSIDIAN);
arena.addBlock(b); arena.addBlock(b);