2013-08-27 17:14:08 +02:00
|
|
|
package nautilus.game.arcade.kit.perks;
|
|
|
|
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.block.BlockBreakEvent;
|
|
|
|
import org.bukkit.event.block.BlockDamageEvent;
|
|
|
|
|
|
|
|
import mineplex.core.common.util.C;
|
|
|
|
import mineplex.core.common.util.UtilBlock;
|
|
|
|
import mineplex.core.recharge.Recharge;
|
|
|
|
import nautilus.game.arcade.kit.Perk;
|
|
|
|
|
|
|
|
public class PerkSmasher extends Perk
|
|
|
|
{
|
|
|
|
public PerkSmasher()
|
|
|
|
{
|
|
|
|
super("Smasher", new String[]
|
|
|
|
{
|
|
|
|
C.cGray + "Hitting blocks damages all surrounding blocks",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockSmash(BlockDamageEvent event)
|
|
|
|
{
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
|
|
|
if (!Kit.HasKit(player))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this.Manager.GetGame() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!this.Manager.GetGame().IsAlive(player))
|
|
|
|
return;
|
|
|
|
|
2014-04-03 06:48:58 +02:00
|
|
|
if (!Recharge.Instance.use(player, GetName(), 250, false, false))
|
2013-08-27 17:14:08 +02:00
|
|
|
return;
|
|
|
|
|
2013-09-21 05:34:14 +02:00
|
|
|
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
BlockDamageEvent blockDamage = new BlockDamageEvent(event.getPlayer(), block, event.getPlayer().getItemInHand(), false);
|
2015-02-26 06:07:07 +01:00
|
|
|
Manager.getPlugin().getServer().getPluginManager().callEvent(blockDamage);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BlockDamageEvent blockDamage = new BlockDamageEvent(event.getPlayer(), event.getBlock(), event.getPlayer().getItemInHand(), false);
|
2015-02-26 06:07:07 +01:00
|
|
|
Manager.getPlugin().getServer().getPluginManager().callEvent(blockDamage);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void BlockSmash(BlockBreakEvent event)
|
|
|
|
{
|
|
|
|
if (event.isCancelled())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
|
|
|
if (!Kit.HasKit(player))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this.Manager.GetGame() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!this.Manager.GetGame().IsAlive(player))
|
|
|
|
return;
|
|
|
|
|
2014-04-03 06:48:58 +02:00
|
|
|
if (!Recharge.Instance.use(player, GetName(), 50, false, false))
|
2013-08-27 17:14:08 +02:00
|
|
|
return;
|
|
|
|
|
2013-09-21 05:34:14 +02:00
|
|
|
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
BlockBreakEvent blockDamage = new BlockBreakEvent(block, player);
|
2015-02-26 06:07:07 +01:00
|
|
|
Manager.getPlugin().getServer().getPluginManager().callEvent(blockDamage);
|
2013-08-27 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|