Add missing Spleef challenge to removed package

This commit is contained in:
Thanos paravantis 2016-04-09 11:06:46 +03:00
parent 0b780c8e99
commit ea6219984a

View File

@ -0,0 +1,108 @@
package nautilus.game.arcade.game.games.mineware.challenge.type.removed;
import java.util.ArrayList;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
public class ChallengeSpleef extends Challenge
{
public ChallengeSpleef(BawkBawkBattles host)
{
super(
host,
ChallengeType.LastStanding,
"Spleef",
"Destroy the blocks beneath other players!");
Settings.setUseMapHeight();
}
@Override
public ArrayList<Location> createSpawns()
{
ArrayList<Location> spawns = new ArrayList<Location>();
for (int x = -7; x <= 7; x++)
{
for (int z = -7; z <= 7; z++)
{
spawns.add(getCenter().clone().add(x + 0.5, 2, z + 0.5));
}
}
return spawns;
}
@Override
public void onEnd()
{
}
@Override
public void onStart()
{
}
@EventHandler
public void onBreak(PlayerInteractEvent event)
{
if (event.getAction() != Action.LEFT_CLICK_BLOCK)
{
return;
}
if (UtilPlayer.isSpectator(event.getPlayer()))
{
return;
}
Block block = event.getClickedBlock();
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND,
block.getTypeId());
block.setType(Material.AIR);
}
@Override
public void createMap()
{
for (int x = -15; x <= 15; x++)
{
for (int z = -15; z <= 15; z++)
{
Block block = getCenter().getBlock().getRelative(x, 0, z);
block.setType(Material.LAVA);
addBlock(block);
if (Math.abs(x) <= 10 && Math.abs(z) <= 10)
{
Block b = block.getRelative(0, 5, 0);
if (Math.abs(x) == 10 || Math.abs(z) == 10)
{
b.setType(Material.IRON_BLOCK);
}
else
{
b.setType(Material.WOOL);
block.setData((byte) UtilMath.r(16));
}
addBlock(b);
}
}
}
}
}