Spectator and chicken attack changes.

This commit is contained in:
Thanos paravantis 2016-01-31 23:50:23 +02:00
parent 1f22883c13
commit de1ee4f6cb
4 changed files with 88 additions and 23 deletions

View File

@ -1 +1 @@
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core.Common","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core.Common"}},"ABSENT"]]
{}

View File

@ -187,7 +187,6 @@ public abstract class Challenge implements Listener
public void setCompleted(Player player, boolean invis)
{
if (_completed.contains(player))
return;
if (invis)

View File

@ -17,6 +17,7 @@ import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -74,8 +75,8 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlock
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFastFood;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFishingDay;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeInfestation;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKingOfTheHill;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKingOfTheHill;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeLavaRun;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMilkACow;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMineADiamond;
@ -112,7 +113,7 @@ import nautilus.game.arcade.kit.Kit;
public class MineWare extends TeamGame implements IThrown
{
private int _livesAmount = 5;
private int _livesAmount = 1;
private String _restrictCommand = "restrict";
private String _skipCommand = "skip";
@ -371,6 +372,7 @@ public class MineWare extends TeamGame implements IThrown
if (!_sendingMessages && !_messagesSent)
{
addEffectsToPlayers();
startChallengeDescriptionThread();
// return;
@ -500,6 +502,15 @@ public class MineWare extends TeamGame implements IThrown
}
}
private void addEffectsToPlayers()
{
for (Player player : GetPlayers(true))
{
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integer.MAX_VALUE, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1));
}
}
private void startChallengeDescriptionThread()
{
Thread thread = new Thread(new Runnable()
@ -644,27 +655,40 @@ public class MineWare extends TeamGame implements IThrown
if (getLives(cAlive) != 0)
alive++;
if (_challenge != null && _challengeStarted)
{
Scoreboard.Write(C.cGreen + C.Bold + "Alive");
Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size());
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + C.Bold + "Completed");
Scoreboard.Write("" + _challenge.getCompleted().size());
Scoreboard.Write(C.cYellow + C.Bold + "Players");
Scoreboard.Write(alive + " ");
Scoreboard.Write(C.cGray + C.Bold + "Dead");
Scoreboard.Write("" + _challenge.getLost().size());
}
boolean check = _challenge != null && _challengeStarted;
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + C.Bold + "Alive");
Scoreboard.Write(alive + " ");
if (check)
Scoreboard.Write("" + _challenge.getCurrentyAlive(false).size());
else
Scoreboard.Write("-");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + C.Bold + "Dead");
Scoreboard.Write((GetPlayers(false).size() - alive) + " ");
Scoreboard.Write(C.cGold + C.Bold + "Completed");
if (check)
Scoreboard.Write("" + _challenge.getCompleted().size());
else
Scoreboard.Write("-");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGray + C.Bold + "Dead");
if (check)
Scoreboard.Write("" + _challenge.getLost().size());
else
Scoreboard.Write("-");
}
else
{
@ -831,7 +855,7 @@ public class MineWare extends TeamGame implements IThrown
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
public void onChallengeFreeze(PlayerMoveEvent event)
{
if (!IsLive())
return;
@ -857,7 +881,7 @@ public class MineWare extends TeamGame implements IThrown
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
public void onChallengeDeath(PlayerDeathEvent event)
{
if (_challenge == null)
return;
@ -889,7 +913,12 @@ public class MineWare extends TeamGame implements IThrown
_lives.put(player, lives);
if (lives > 0)
{
taskFailedMessage(player, lives);
if (isDeath)
Manager.addSpectator(player, true);
}
else
{
if (alive <= 3)
@ -945,8 +974,7 @@ public class MineWare extends TeamGame implements IThrown
if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() < 2)
{
UtilServer
.broadcast(F.main(GetName(), C.cRed + "This game requires at least 2 players to start."));
UtilServer.broadcast(F.main(GetName(), C.cRed + "This game requires at least 2 players to start."));
SetCountdown(-1);
Manager.GetLobby().DisplayWaiting();
}
@ -1313,6 +1341,44 @@ public class MineWare extends TeamGame implements IThrown
return _chickenAttack;
}
/**
* Returns the list of players contained on the player's team.
*
* @param aliveOnly Whether or not to select all players.
*/
@Override
public ArrayList<Player> GetPlayers(boolean aliveOnly)
{
return _playersTeam.GetPlayers(aliveOnly);
}
/**
* Checks on the player's team, whether the player is alive or not.
*
* @param entity The player (or entity if no cast is applied) to check.
*/
@Override
public boolean IsAlive(Entity entity)
{
if (entity instanceof Player)
{
Player player = (Player) entity;
if (_playersTeam.HasPlayer(player))
{
return _playersTeam.IsAlive(player);
}
else
{
return false;
}
}
else
{
return false;
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{

View File

@ -27,9 +27,9 @@ public class ChallengeDiamondFall extends Challenge
}
@Override
public boolean finish()
public boolean canFinish()
{
if (super.finish())
if (super.canFinish())
{
final HashMap<Player, Integer> diamonds = new HashMap<Player, Integer>();
ArrayList<Player> players = getChallengers();
@ -65,7 +65,7 @@ public class ChallengeDiamondFall extends Challenge
}
}
return super.finish();
return super.canFinish();
}
@Override