Update team creation and winner placement, fix NPE on Veteran Tracker.

This commit is contained in:
Thanos paravantis 2016-01-23 14:31:36 +02:00
parent a74d4fa960
commit 72fb2317b9
4 changed files with 68 additions and 42 deletions

View File

@ -1 +1 @@
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"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"]]
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"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\\Mineplex.Core.Common","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core.Common"}},"ABSENT"]]

View File

@ -110,7 +110,7 @@ import nautilus.game.arcade.kit.Kit;
public class MineWare extends TeamGame implements IThrown
{
private int _livesAmount = 1;
private int _livesAmount = 2;
private GameTeam _playersTeam;
private GameTeam _chickenTeam;
@ -174,27 +174,20 @@ public class MineWare extends TeamGame implements IThrown
new MinewareKangarooAtHeart(this)
);
}
@EventHandler
public void onTeamCreation(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
for (GameTeam team : GetTeamList())
{
if (team.GetColor() == ChatColor.YELLOW)
{
team.SetName("Players");
_playersTeam = team;
}
else if (team.GetColor() == ChatColor.WHITE)
{
team.SetName("Chickens");
team.SetVisible(false);
_chickenTeam = team;
}
}
_playersTeam = GetTeamList().get(0);
_playersTeam.SetColor(ChatColor.YELLOW);
_playersTeam.SetName("Players");
_chickenTeam = new GameTeam(this, "Chickens", ChatColor.WHITE, _playersTeam.GetSpawns());
_chickenTeam.SetVisible(false);
GetTeamList().add(_chickenTeam);
}
// Debug Only
@ -206,7 +199,7 @@ public class MineWare extends TeamGame implements IThrown
String restrictCommand = "restrict";
String skipCommand = "skip";
String message = event.getMessage();
if (player.isOp())
{
if (message.startsWith("/" + restrictCommand))
@ -368,30 +361,60 @@ public class MineWare extends TeamGame implements IThrown
if (living <= 1)
{
SetState(GameState.End);
AnnounceEnd(getWinners());
Collections.reverse(_places);
for(Player players: GetPlayers(false))
if (!_places.contains(GetPlayers(true).get(0)))
_places.add(0, GetPlayers(true).get(0));
if (_places.size() >= 1)
{
if(getWinners().contains(players))
{
AddGems(players, 40, "First Place", false, false);
}
if(_places.size() >= 1)
{
AddGems(_places.get(0), 20, "Third Place", false, false);
}
if(_places.size() >= 2)
AddGems(_places.get(0), 40, "First Place", false, false);
if (_places.size() >= 2)
{
AddGems(_places.get(1), 30, "Second Place", false, false);
if (_places.size() >= 3)
{
AddGems(_places.get(2), 20, "Third Place", false, false);
}
}
AddGems(players, 10, "Participation", false, false);
}
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false, false);
AnnounceEnd(_places);
SetState(GameState.End);
}
}
// if (living <= 1)
// {
// SetState(GameState.End);
// AnnounceEnd(getWinners());
//
// for(Player players: GetPlayers(false))
// {
// if(getWinners().contains(players))
// {
// AddGems(players, 40, "First Place", false, false);
// }
//
// if(_places.size() >= 1)
// {
// AddGems(_places.get(0), 20, "Third Place", false, false);
// }
//
// if(_places.size() >= 2)
// {
// AddGems(_places.get(1), 30, "Second Place", false, false);
// }
//
// AddGems(players, 10, "Participation", false, false);
// }
// }
@Override
public boolean isInsideMap(Player player)
@ -1060,10 +1083,10 @@ public class MineWare extends TeamGame implements IThrown
_places.add(player);
}
gameLostMessage(player);
// gameLostMessage(player);
Scoreboard.ResetScore(player.getName());
if (isDeath)
if (isDeath && playersAlive > 2)
{
// Manager.addSpectator(player, true);
_chickenAttack.start(player);
@ -1234,6 +1257,12 @@ public class MineWare extends TeamGame implements IThrown
{
return _chickenTeam;
}
@Override
public ArrayList<Player> getWinners()
{
return _places;
}
@Override
public void Idle(ProjectileUser data)

View File

@ -17,10 +17,8 @@ import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.disguise.disguises.DisguiseChicken;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.mineware.MineWare;
public class ChickenAttack

View File

@ -14,15 +14,14 @@ public class MinewareVeteranTracker extends StatTracker<Game>
public MinewareVeteranTracker(Game game)
{
super(game);
System.out.println("1");
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void tracePlayerWin(GameStateChangeEvent event)
{
if(event.GetState() == GameState.End)
if (event.GetState() == GameState.End)
{
for(Player player: getGame().getWinners())
for (Player player: getGame().getWinners())
{
addStat(player, "Veteran", 1, true, false);
}