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()
|
||||
{
|
||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||
"XXXXOXXXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO").getItemSlots();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
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.zombiesurvival.ZombieSurvival;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
//Mini
|
||||
@ -142,7 +142,7 @@ public enum GameType
|
||||
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
|
||||
GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
|
||||
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.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
|
||||
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.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@ -118,7 +119,7 @@ import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
private int _livesAmount = 1;
|
||||
private int _livesAmount = 2;
|
||||
|
||||
private String _restrictCommand = "restrict";
|
||||
private String _skipCommand = "skip";
|
||||
@ -160,6 +161,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
DamageSelf = false;
|
||||
DamageTeamSelf = true;
|
||||
DamageTeamOther = false;
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
DamageEvP = false;
|
||||
@ -174,6 +176,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
TeleportsDisqualify = false;
|
||||
GiveClock = false;
|
||||
|
||||
// TODO: Temporary
|
||||
CompassEnabled = false;
|
||||
CompassGiveItem = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
populateChallenges();
|
||||
@ -406,12 +412,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
_crumbling = true;
|
||||
|
||||
UtilServer.broadcast(F.main(GetName(), "The map has started to crumble."));
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
if (IsAlive(player))
|
||||
UtilPlayer.message(player,
|
||||
F.main(GetName(), "Challenge ends when there's only 1 player alive."));
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
UtilTextMiddle.display(null, "The map has started to crumble.", 5, 50, 5, player);
|
||||
}
|
||||
}
|
||||
else if (canEndChallengeFromCrumble())
|
||||
{
|
||||
@ -658,7 +662,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
int alive = 0;
|
||||
|
||||
for (Player cAlive : _lives.keySet())
|
||||
if (getLives(cAlive) != 0)
|
||||
if (lives(cAlive) != 0)
|
||||
alive++;
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
@ -702,7 +706,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
int currentLives = getLives(player);
|
||||
int currentLives = lives(player);
|
||||
String status;
|
||||
String currentlyOut = "";
|
||||
|
||||
@ -816,7 +820,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
C.cRed + C.Bold + "3",
|
||||
C.cYellow + C.Bold + "2",
|
||||
C.cGreen + C.Bold + "1",
|
||||
C.cGreen + C.Bold + "GO!");
|
||||
C.cWhite + C.Bold + "GO!");
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@ -912,7 +916,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (!event.GetCondition().GetReason().equals("Spectator"))
|
||||
return;
|
||||
|
||||
System.out.println("Cancelled");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -942,26 +945,37 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
else
|
||||
{
|
||||
handleFailure(player, false);
|
||||
handleFailure(player, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public int looseLife(Player player)
|
||||
{
|
||||
int lives = getLives(player);
|
||||
int lives = lives(player);
|
||||
lives -= 1;
|
||||
_lives.put(player, lives);
|
||||
|
||||
if (lives >= 0)
|
||||
_lives.put(player, lives);
|
||||
|
||||
return lives;
|
||||
}
|
||||
|
||||
public void handleFailure(Player player, boolean looseLife)
|
||||
{
|
||||
handleFailure(player, looseLife, false);
|
||||
}
|
||||
|
||||
public void handleFailure(Player player, boolean looseLife, boolean cloak)
|
||||
{
|
||||
if (looseLife)
|
||||
looseLife(player);
|
||||
|
||||
taskFailedMessage(player, getLives(player));
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
taskFailedMessage(player, lives(player));
|
||||
// SetPlayerState(player, PlayerState.OUT);
|
||||
Manager.addSpectator(player, true);
|
||||
|
||||
if (cloak)
|
||||
Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, 7777, true, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -970,7 +984,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
@ -983,14 +997,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (UtilMath.offset(other, player) > 5)
|
||||
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;
|
||||
while (bottom.getVehicle() != null)
|
||||
bottom = bottom.getVehicle();
|
||||
|
||||
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)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
UtilPlayer.message(player, "");
|
||||
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)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
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
|
||||
@ -1168,6 +1199,11 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
private int getLives(Player player)
|
||||
private int lives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
@ -1290,7 +1326,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (getLives(player) > 0)
|
||||
if (lives(player) > 0)
|
||||
{
|
||||
living++;
|
||||
}
|
||||
@ -1298,7 +1334,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
if (living <= 1)
|
||||
{
|
||||
SetCustomWinLine("You have defeated Bawk Bawk!");
|
||||
Collections.reverse(_places);
|
||||
|
||||
if (!_places.contains(GetPlayers(true).get(0)))
|
||||
@ -1323,6 +1358,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
SetCustomWinLine("You have defeated Bawk Bawk!");
|
||||
AnnounceEnd(_places);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
@ -196,7 +196,11 @@ public abstract class Challenge implements Listener
|
||||
}
|
||||
|
||||
_completed.add(player);
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
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);
|
||||
}
|
||||
|
||||
@ -216,11 +220,11 @@ public abstract class Challenge implements Listener
|
||||
if (invis)
|
||||
{
|
||||
_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);
|
||||
Host.handleFailure(player, true);
|
||||
}
|
||||
|
||||
public void setLost(Player player)
|
||||
|
@ -27,7 +27,8 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
{
|
||||
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
|
||||
@ -35,11 +36,11 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
{
|
||||
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));
|
||||
}
|
||||
@ -54,9 +55,9 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
Host.DamagePvP = 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();
|
||||
}
|
||||
@ -66,7 +67,7 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
@Override
|
||||
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 ItemStack(Material.ARROW));
|
||||
@ -78,34 +79,33 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
@Override
|
||||
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:
|
||||
for(int y = 0; y <= 1; y++)
|
||||
forloopY: for (int y = 0; y <= 1; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if(y == 0)
|
||||
if (y == 0)
|
||||
{
|
||||
b.setType(Material.GRASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||
if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -113,13 +113,13 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
b.setType(Material.STAINED_CLAY);
|
||||
b.getRelative(BlockFace.UP).setType(Material.STAINED_CLAY);
|
||||
|
||||
b.setData((byte)14);
|
||||
b.getRelative(BlockFace.UP).setData((byte)14);
|
||||
b.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);
|
||||
@ -133,21 +133,21 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
@EventHandler
|
||||
public void giveArrowHandler(UpdateEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(event.getType() != UpdateType.SLOW)
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for(Player player: Host.GetPlayers(true))
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
if(isLost(player))
|
||||
if (isLost(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(UtilInv.contains(player, Material.ARROW, (byte)0, 1))
|
||||
if (UtilInv.contains(player, Material.ARROW, (byte) 0, 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -159,22 +159,22 @@ public class ChallengeMiniOneInTheQuiver extends Challenge
|
||||
@EventHandler
|
||||
public void onArrowHitPlayer(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!(event.getDamager() instanceof Arrow)) // Damager = Arrow (player)
|
||||
if (!(event.getDamager() instanceof Arrow)) // Damager = Arrow (player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!(event.getEntity() instanceof Player)) // Damaged = player
|
||||
if (!(event.getEntity() instanceof Player)) // Damaged = player
|
||||
{
|
||||
return;
|
||||
}
|
||||
Arrow arrow = (Arrow) event.getDamager();
|
||||
Player shooter = (Player) arrow.getShooter();
|
||||
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);
|
||||
return;
|
||||
|
@ -78,7 +78,7 @@ public class ChickenAttack
|
||||
|
||||
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);
|
||||
|
||||
debugDeathTask(player);
|
||||
@ -107,6 +107,7 @@ public class ChickenAttack
|
||||
_host.SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
DisguiseChicken disguise = new DisguiseChicken(player);
|
||||
disguise.setBaby();
|
||||
_host.Manager.GetDisguise().disguise(disguise, UtilServer.getPlayers());
|
||||
|
||||
player.teleport(_host.GetSpectatorLocation());
|
||||
@ -155,4 +156,9 @@ public class ChickenAttack
|
||||
|
||||
_chickens.clear();
|
||||
}
|
||||
|
||||
public Location getPlatformCenter()
|
||||
{
|
||||
return _center;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user