Make volley pig map size and spawns dynamic

This commit is contained in:
Thanos Paravantis 2016-07-01 12:31:41 +03:00
parent baca63dcae
commit 7379b2069b
1 changed files with 9 additions and 11 deletions

View File

@ -66,17 +66,16 @@ public class ChallengeVolleyPig extends TeamChallenge
public ArrayList<Location> createSpawns() public ArrayList<Location> createSpawns()
{ {
ArrayList<Location> spawns = new ArrayList<Location>(); ArrayList<Location> spawns = new ArrayList<Location>();
int size = getArenaSize() - 1;
for (int x = -5; x <= 5; x++) for (int x = -size; x <= 5; x++)
{ {
for (int z = -9; z <= 9; z++) for (int z = -size; z <= size; z++)
{ {
if (z == 0) if (z != 0)
{ {
continue; spawns.add(getCenter().add(x + 0.5, 1.1, z + 0.5));
} }
spawns.add(getCenter().add(x + 0.5, 1.1, z + 0.5));
} }
} }
@ -86,15 +85,15 @@ public class ChallengeVolleyPig extends TeamChallenge
@Override @Override
public void createMap() public void createMap()
{ {
for (int x = -6; x <= 6; x++) for (int x = -getArenaSize(); x <= 6; x++)
{ {
for (int z = -10; z <= 10; z++) for (int z = -getArenaSize(); z <= getArenaSize(); z++)
{ {
for (int y = 0; y <= 3; y++) for (int y = 0; y <= 3; y++)
{ {
Block block = getCenter().getBlock().getRelative(x, y, z); Block block = getCenter().getBlock().getRelative(x, y, z);
if (y == 0 || Math.abs(x) == 6 || Math.abs(z) == 10) if (x == 6 || x == -getArenaSize() || y == 0 || Math.abs(z) == getArenaSize())
{ {
setBlock(block, z == 0 ? Material.STAINED_GLASS : Material.STAINED_CLAY, (byte) (z < 0 ? 11 : z > 0 ? 14 : 0)); setBlock(block, z == 0 ? Material.STAINED_GLASS : Material.STAINED_CLAY, (byte) (z < 0 ? 11 : z > 0 ? 14 : 0));
addBlock(block); addBlock(block);
@ -254,8 +253,7 @@ public class ChallengeVolleyPig extends TeamChallenge
0, 0,
0, 0,
0, 0,
false false);
);
if (Recharge.Instance.use(player, "Knockback Message", 1000, false, false)) if (Recharge.Instance.use(player, "Knockback Message", 1000, false, false))
{ {