Store locations after game start (fix NPE)

This commit is contained in:
Thanos Paravantis 2016-06-28 11:47:25 +03:00
parent 7218dc710f
commit dc250d4bf2
3 changed files with 16 additions and 12 deletions

View File

@ -43,9 +43,6 @@ public class ChallengeKingOfTheLadder extends Challenge
Settings.setUseMapHeight();
Settings.setMaxPlayers(15);
Settings.setLockInventory(4);
_winCornerA = getCenter().add(1, 20, -1);
_winCornerB = getCenter().add(0, 23, 1);
}
@Override
@ -118,14 +115,17 @@ public class ChallengeKingOfTheLadder extends Challenge
@Override
public void onStart()
{
Host.DamagePvP = true;
_winCornerA = getCenter().add(1, 20, -1);
_winCornerB = getCenter().add(0, 23, 1);
ItemStack stick = new ItemBuilder(Material.STICK)
.addEnchantment(Enchantment.KNOCKBACK, 5)
.addItemFlags(ItemFlag.HIDE_ENCHANTS)
.build();
setItem(Settings.getLockedSlot(), stick);
Host.DamagePvP = true;
}
@SuppressWarnings("deprecation")

View File

@ -64,9 +64,6 @@ public class ChallengeVolleyPig extends TeamChallenge
Settings.setTeamBased();
Settings.setLockInventory(4);
Settings.setDuration(30000);
_blueCenter = getCenter().add(0, 3, 5);
_redCenter = getCenter().add(0, 3, -5);
}
@Override
@ -116,6 +113,9 @@ public class ChallengeVolleyPig extends TeamChallenge
{
Host.DamagePvE = true;
_blueCenter = getCenter().add(0, 3, 5);
_redCenter = getCenter().add(0, 3, -5);
spawnPig();
equipKnockbackStick();
equipTeamHelmets();
@ -131,7 +131,7 @@ public class ChallengeVolleyPig extends TeamChallenge
{
_pig.remove();
}
_pig = null;
_blueSide = 0;
_redSide = 0;

View File

@ -57,9 +57,6 @@ public class ChallengeWaterHorror extends Challenge
"Use your boat to dodge explosions.");
Settings.setUseMapHeight();
_dropsite = getCenter().add(0, 7.0, 0);
_base = _dropsite.clone().subtract(0, 0.5, 0);
}
@Override
@ -169,6 +166,9 @@ public class ChallengeWaterHorror extends Challenge
{
Host.getArcadeManager().GetExplosion().SetLiquidDamage(false);
_dropsite = getCenter().add(0, 7.0, 0);
_base = _dropsite.clone().subtract(0, 0.5, 0);
for (Player player : getPlayersAlive())
{
Boat boat = player.getWorld().spawn(player.getLocation(), Boat.class);
@ -255,7 +255,9 @@ public class ChallengeWaterHorror extends Challenge
return;
if (event.getVehicle() instanceof Boat)
{
event.setCancelled(true);
}
}
@EventHandler
@ -274,7 +276,9 @@ public class ChallengeWaterHorror extends Challenge
return;
if (event.getBlock().getType() == Material.ICE)
{
event.setCancelled(true);
}
}
@EventHandler