Player death handling and chicken attack changes.
This commit is contained in:
parent
1dbf7581d2
commit
0e697e279b
@ -46,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||||
"XXXXOXXXO",
|
"OXOXOXOXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"OXOXOXOXO").getItemSlots();
|
"OXOXOXOXO").getItemSlots();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package nautilus.game.arcade;
|
package nautilus.game.arcade;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import mineplex.core.game.GameCategory;
|
import mineplex.core.game.GameCategory;
|
||||||
import mineplex.core.game.GameDisplay;
|
import mineplex.core.game.GameDisplay;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
@ -67,8 +69,6 @@ import nautilus.game.arcade.game.games.wither.WitherGame;
|
|||||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
public enum GameType
|
public enum GameType
|
||||||
{
|
{
|
||||||
//Mini
|
//Mini
|
||||||
@ -142,7 +142,7 @@ public enum GameType
|
|||||||
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
|
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
|
||||||
GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
|
GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
|
||||||
GameType.Draw, GameType.Evolution, GameType.Gravity, GameType.Halloween, GameType.HideSeek,
|
GameType.Draw, GameType.Evolution, GameType.Gravity, GameType.Halloween, GameType.HideSeek,
|
||||||
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.MineWare,
|
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.BawkBawkBattles,
|
||||||
GameType.OldMineWare, GameType.Paintball, GameType.Quiver, GameType.QuiverTeams, GameType.Runner, GameType.SearchAndDestroy,
|
GameType.OldMineWare, GameType.Paintball, GameType.Quiver, GameType.QuiverTeams, GameType.Runner, GameType.SearchAndDestroy,
|
||||||
GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
|
GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
|
||||||
GameType.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
|
GameType.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
|
||||||
|
@ -26,6 +26,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
@ -118,7 +119,7 @@ import nautilus.game.arcade.kit.Kit;
|
|||||||
|
|
||||||
public class BawkBawkBattles extends TeamGame implements IThrown
|
public class BawkBawkBattles extends TeamGame implements IThrown
|
||||||
{
|
{
|
||||||
private int _livesAmount = 1;
|
private int _livesAmount = 2;
|
||||||
|
|
||||||
private String _restrictCommand = "restrict";
|
private String _restrictCommand = "restrict";
|
||||||
private String _skipCommand = "skip";
|
private String _skipCommand = "skip";
|
||||||
@ -160,6 +161,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
DamageSelf = false;
|
DamageSelf = false;
|
||||||
DamageTeamSelf = true;
|
DamageTeamSelf = true;
|
||||||
|
DamageTeamOther = false;
|
||||||
DamagePvP = false;
|
DamagePvP = false;
|
||||||
DamagePvE = false;
|
DamagePvE = false;
|
||||||
DamageEvP = false;
|
DamageEvP = false;
|
||||||
@ -174,6 +176,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
TeleportsDisqualify = false;
|
TeleportsDisqualify = false;
|
||||||
GiveClock = false;
|
GiveClock = false;
|
||||||
|
|
||||||
|
// TODO: Temporary
|
||||||
|
CompassEnabled = false;
|
||||||
|
CompassGiveItem = false;
|
||||||
|
|
||||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
populateChallenges();
|
populateChallenges();
|
||||||
@ -406,12 +412,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
{
|
{
|
||||||
_crumbling = true;
|
_crumbling = true;
|
||||||
|
|
||||||
UtilServer.broadcast(F.main(GetName(), "The map has started to crumble."));
|
for (Player player : getChallengers())
|
||||||
|
{
|
||||||
for (Player player : UtilServer.getPlayers())
|
UtilTextMiddle.display(null, "The map has started to crumble.", 5, 50, 5, player);
|
||||||
if (IsAlive(player))
|
}
|
||||||
UtilPlayer.message(player,
|
|
||||||
F.main(GetName(), "Challenge ends when there's only 1 player alive."));
|
|
||||||
}
|
}
|
||||||
else if (canEndChallengeFromCrumble())
|
else if (canEndChallengeFromCrumble())
|
||||||
{
|
{
|
||||||
@ -658,7 +662,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
int alive = 0;
|
int alive = 0;
|
||||||
|
|
||||||
for (Player cAlive : _lives.keySet())
|
for (Player cAlive : _lives.keySet())
|
||||||
if (getLives(cAlive) != 0)
|
if (lives(cAlive) != 0)
|
||||||
alive++;
|
alive++;
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
@ -702,7 +706,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
int currentLives = getLives(player);
|
int currentLives = lives(player);
|
||||||
String status;
|
String status;
|
||||||
String currentlyOut = "";
|
String currentlyOut = "";
|
||||||
|
|
||||||
@ -816,7 +820,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
C.cRed + C.Bold + "3",
|
C.cRed + C.Bold + "3",
|
||||||
C.cYellow + C.Bold + "2",
|
C.cYellow + C.Bold + "2",
|
||||||
C.cGreen + C.Bold + "1",
|
C.cGreen + C.Bold + "1",
|
||||||
C.cGreen + C.Bold + "GO!");
|
C.cWhite + C.Bold + "GO!");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
@ -912,7 +916,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
if (!event.GetCondition().GetReason().equals("Spectator"))
|
if (!event.GetCondition().GetReason().equals("Spectator"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
System.out.println("Cancelled");
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,35 +945,46 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handleFailure(player, false);
|
handleFailure(player, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int looseLife(Player player)
|
public int looseLife(Player player)
|
||||||
{
|
{
|
||||||
int lives = getLives(player);
|
int lives = lives(player);
|
||||||
lives -= 1;
|
lives -= 1;
|
||||||
_lives.put(player, lives);
|
|
||||||
|
if (lives >= 0)
|
||||||
|
_lives.put(player, lives);
|
||||||
|
|
||||||
return lives;
|
return lives;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleFailure(Player player, boolean looseLife)
|
public void handleFailure(Player player, boolean looseLife)
|
||||||
|
{
|
||||||
|
handleFailure(player, looseLife, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleFailure(Player player, boolean looseLife, boolean cloak)
|
||||||
{
|
{
|
||||||
if (looseLife)
|
if (looseLife)
|
||||||
looseLife(player);
|
looseLife(player);
|
||||||
|
|
||||||
taskFailedMessage(player, getLives(player));
|
taskFailedMessage(player, lives(player));
|
||||||
SetPlayerState(player, PlayerState.OUT);
|
// SetPlayerState(player, PlayerState.OUT);
|
||||||
Manager.addSpectator(player, true);
|
Manager.addSpectator(player, true);
|
||||||
|
|
||||||
|
if (cloak)
|
||||||
|
Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, 7777, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChickenApproachPlayer(UpdateEvent event)
|
public void onChickenApproachPlayer(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getType() != UpdateType.FASTER)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
@ -979,18 +993,18 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
{
|
{
|
||||||
if (player.equals(other))
|
if (player.equals(other))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilMath.offset(other, player) > 5)
|
if (UtilMath.offset(other, player) > 5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Recharge.Instance.use(other, "Approach Alive Player", 500, false, false))
|
if (Recharge.Instance.use(player, "Approach Alive Player", 500, false, false))
|
||||||
{
|
{
|
||||||
Entity bottom = other;
|
Entity bottom = other;
|
||||||
while (bottom.getVehicle() != null)
|
while (bottom.getVehicle() != null)
|
||||||
bottom = bottom.getVehicle();
|
bottom = bottom.getVehicle();
|
||||||
|
|
||||||
UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(player, bottom), 1.6, true, 0.8, 0, 10, true);
|
UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(player, bottom), 1.6, true, 0.8, 0, 10, true);
|
||||||
other.playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f);
|
other.playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2.0F, 0.5F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -998,14 +1012,31 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
private void gameLostMessage(Player player)
|
private void gameLostMessage(Player player)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
UtilPlayer.message(player, "");
|
||||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game.");
|
||||||
|
player.playSound(player.getLocation(), Sound.EXPLODE, 2.0F, 1.0F);
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void taskFailedMessage(Player player, int lives)
|
private void taskFailedMessage(Player player, int lives)
|
||||||
{
|
{
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!");
|
UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!");
|
||||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!");
|
|
||||||
|
String suffix = "lives";
|
||||||
|
|
||||||
|
if (lives == 1)
|
||||||
|
suffix = "life";
|
||||||
|
|
||||||
|
String msg = C.Bold + "You have " + F.elem(C.Bold + lives) + C.Bold + " " + suffix + " left.";
|
||||||
|
|
||||||
|
if (lives <= 0)
|
||||||
|
msg = C.Bold + "You don't have any lives left.";
|
||||||
|
|
||||||
|
UtilPlayer.message(player, C.cGray + msg);
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
|
||||||
|
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -1168,6 +1199,11 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getCause() == DamageCause.VOID)
|
||||||
|
{
|
||||||
|
chicken.teleport(_chickenAttack.getPlatformCenter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,7 +1297,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLives(Player player)
|
private int lives(Player player)
|
||||||
{
|
{
|
||||||
if (!_lives.containsKey(player))
|
if (!_lives.containsKey(player))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1290,7 +1326,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
for (Player player : GetPlayers(false))
|
for (Player player : GetPlayers(false))
|
||||||
{
|
{
|
||||||
if (getLives(player) > 0)
|
if (lives(player) > 0)
|
||||||
{
|
{
|
||||||
living++;
|
living++;
|
||||||
}
|
}
|
||||||
@ -1298,7 +1334,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
|
|
||||||
if (living <= 1)
|
if (living <= 1)
|
||||||
{
|
{
|
||||||
SetCustomWinLine("You have defeated Bawk Bawk!");
|
|
||||||
Collections.reverse(_places);
|
Collections.reverse(_places);
|
||||||
|
|
||||||
if (!_places.contains(GetPlayers(true).get(0)))
|
if (!_places.contains(GetPlayers(true).get(0)))
|
||||||
@ -1323,6 +1358,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
AddGems(player, 10, "Participation", false, false);
|
AddGems(player, 10, "Participation", false, false);
|
||||||
|
|
||||||
|
SetCustomWinLine("You have defeated Bawk Bawk!");
|
||||||
AnnounceEnd(_places);
|
AnnounceEnd(_places);
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,11 @@ public abstract class Challenge implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
_completed.add(player);
|
_completed.add(player);
|
||||||
|
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
|
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2.0F, 1.0F);
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,11 +220,11 @@ public abstract class Challenge implements Listener
|
|||||||
if (invis)
|
if (invis)
|
||||||
{
|
{
|
||||||
_invisPlayers.add(player);
|
_invisPlayers.add(player);
|
||||||
Host.Manager.GetCondition().Factory().Cloak("Completed", player, player, 7777, true, false);
|
Host.Manager.GetCondition().Factory().Cloak("Lost", player, player, 7777, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Host.handleFailure(player, true);
|
|
||||||
UtilInv.Clear(player);
|
UtilInv.Clear(player);
|
||||||
|
Host.handleFailure(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLost(Player player)
|
public void setLost(Player player)
|
||||||
|
@ -27,7 +27,8 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
{
|
{
|
||||||
public ChallengeMiniOneInTheQuiver(BawkBawkBattles host)
|
public ChallengeMiniOneInTheQuiver(BawkBawkBattles host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Do not get hit!", "You receive a new arrow every 4 seconds.", "Last man standing wins!");
|
super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Avoid getting hit by arrows.", "You receive an arrow every 4 seconds.",
|
||||||
|
"Last man standing wins!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,11 +36,11 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
{
|
{
|
||||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||||
|
|
||||||
for(int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++)
|
for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++)
|
||||||
{
|
{
|
||||||
for(int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++)
|
for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++)
|
||||||
{
|
{
|
||||||
if(x % 2 == 0 && z % 2 == 0)
|
if (x % 2 == 0 && z % 2 == 0)
|
||||||
{
|
{
|
||||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||||
}
|
}
|
||||||
@ -54,9 +55,9 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
Host.DamagePvP = false;
|
Host.DamagePvP = false;
|
||||||
Host.DamagePvE = false;
|
Host.DamagePvE = false;
|
||||||
|
|
||||||
for(Entity entities : Host.WorldData.World.getEntities())
|
for (Entity entities : Host.WorldData.World.getEntities())
|
||||||
{
|
{
|
||||||
if(entities instanceof Arrow)
|
if (entities instanceof Arrow)
|
||||||
{
|
{
|
||||||
entities.remove();
|
entities.remove();
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void setupPlayers()
|
public void setupPlayers()
|
||||||
{
|
{
|
||||||
for(Player player : Host.GetPlayers(true))
|
for (Player player : Host.GetPlayers(true))
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "1Shot1Kill").build());
|
player.getInventory().addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "1Shot1Kill").build());
|
||||||
player.getInventory().addItem(new ItemStack(Material.ARROW));
|
player.getInventory().addItem(new ItemStack(Material.ARROW));
|
||||||
@ -78,48 +79,47 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void generateRoom()
|
public void generateRoom()
|
||||||
{
|
{
|
||||||
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
|
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||||
{
|
{
|
||||||
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
|
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||||
{
|
{
|
||||||
forloopY:
|
forloopY: for (int y = 0; y <= 1; y++)
|
||||||
for(int y = 0; y <= 1; y++)
|
|
||||||
{
|
{
|
||||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||||
|
|
||||||
if(y == 0)
|
if (y == 0)
|
||||||
{
|
{
|
||||||
b.setType(Material.GRASS);
|
b.setType(Material.GRASS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||||
{
|
{
|
||||||
b.setType(Material.FENCE);
|
b.setType(Material.FENCE);
|
||||||
}
|
}
|
||||||
if(Math.abs(x) == getArenaSize() - 2 || Math.abs(z) == getArenaSize() - 2)
|
if (Math.abs(x) == getArenaSize() - 2 || Math.abs(z) == getArenaSize() - 2)
|
||||||
{
|
{
|
||||||
if(y == 1)
|
if (y == 1)
|
||||||
{
|
{
|
||||||
if(UtilMath.r(8) == 0)
|
if (UtilMath.r(8) == 0)
|
||||||
{
|
{
|
||||||
for(Location spawns: getSpawns())
|
for (Location spawns : getSpawns())
|
||||||
{
|
{
|
||||||
if(spawns.getBlockX() == b.getLocation().getBlockX() && spawns.getBlockZ() == b.getLocation().getBlockZ())
|
if (spawns.getBlockX() == b.getLocation().getBlockX() && spawns.getBlockZ() == b.getLocation().getBlockZ())
|
||||||
{
|
{
|
||||||
continue forloopY;
|
continue forloopY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.setType(Material.STAINED_CLAY);
|
b.setType(Material.STAINED_CLAY);
|
||||||
b.getRelative(BlockFace.UP).setType(Material.STAINED_CLAY);
|
b.getRelative(BlockFace.UP).setType(Material.STAINED_CLAY);
|
||||||
|
|
||||||
b.setData((byte)14);
|
b.setData((byte) 14);
|
||||||
b.getRelative(BlockFace.UP).setData((byte)14);
|
b.getRelative(BlockFace.UP).setData((byte) 14);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(b.getType() != Material.AIR)
|
if (b.getType() != Material.AIR)
|
||||||
{
|
{
|
||||||
addBlock(b.getRelative(BlockFace.UP));
|
addBlock(b.getRelative(BlockFace.UP));
|
||||||
addBlock(b);
|
addBlock(b);
|
||||||
@ -133,21 +133,21 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void giveArrowHandler(UpdateEvent event)
|
public void giveArrowHandler(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if(!Host.IsLive())
|
if (!Host.IsLive())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(Player player: Host.GetPlayers(true))
|
for (Player player : Host.GetPlayers(true))
|
||||||
{
|
{
|
||||||
if(isLost(player))
|
if (isLost(player))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(UtilInv.contains(player, Material.ARROW, (byte)0, 1))
|
if (UtilInv.contains(player, Material.ARROW, (byte) 0, 1))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -159,22 +159,22 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onArrowHitPlayer(EntityDamageByEntityEvent event)
|
public void onArrowHitPlayer(EntityDamageByEntityEvent event)
|
||||||
{
|
{
|
||||||
if(!Host.IsLive())
|
if (!Host.IsLive())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!(event.getDamager() instanceof Arrow)) // Damager = Arrow (player)
|
if (!(event.getDamager() instanceof Arrow)) // Damager = Arrow (player)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!(event.getEntity() instanceof Player)) // Damaged = player
|
if (!(event.getEntity() instanceof Player)) // Damaged = player
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Arrow arrow = (Arrow) event.getDamager();
|
Arrow arrow = (Arrow) event.getDamager();
|
||||||
Player shooter = (Player) arrow.getShooter();
|
Player shooter = (Player) arrow.getShooter();
|
||||||
Player damaged = (Player) event.getEntity();
|
Player damaged = (Player) event.getEntity();
|
||||||
if(isLost(shooter) || !Host.IsPlaying(shooter) || shooter.equals(damaged))
|
if (isLost(shooter) || !Host.IsPlaying(shooter) || shooter.equals(damaged))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -78,7 +78,7 @@ public class ChickenAttack
|
|||||||
|
|
||||||
player.teleport(_center);
|
player.teleport(_center);
|
||||||
|
|
||||||
UtilTextMiddle.display(null, C.cRed + C.Bold + "Chicken Attack!", 5, 40, 5, player);
|
UtilTextMiddle.display(C.cRed + "Chicken Attack", "You ran out of lives!", 5, 40, 5, player);
|
||||||
player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 1.0F, 1.0F);
|
player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 1.0F, 1.0F);
|
||||||
|
|
||||||
debugDeathTask(player);
|
debugDeathTask(player);
|
||||||
@ -107,6 +107,7 @@ public class ChickenAttack
|
|||||||
_host.SetPlayerState(player, PlayerState.OUT);
|
_host.SetPlayerState(player, PlayerState.OUT);
|
||||||
|
|
||||||
DisguiseChicken disguise = new DisguiseChicken(player);
|
DisguiseChicken disguise = new DisguiseChicken(player);
|
||||||
|
disguise.setBaby();
|
||||||
_host.Manager.GetDisguise().disguise(disguise, UtilServer.getPlayers());
|
_host.Manager.GetDisguise().disguise(disguise, UtilServer.getPlayers());
|
||||||
|
|
||||||
player.teleport(_host.GetSpectatorLocation());
|
player.teleport(_host.GetSpectatorLocation());
|
||||||
@ -155,4 +156,9 @@ public class ChickenAttack
|
|||||||
|
|
||||||
_chickens.clear();
|
_chickens.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location getPlatformCenter()
|
||||||
|
{
|
||||||
|
return _center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user