Fix the teammate message not appearing if there were an odd number of players

This commit is contained in:
Sam 2017-12-09 13:12:28 +00:00 committed by Alexander Meech
parent b8d0353a01
commit 7e6dbed17e
2 changed files with 2 additions and 50 deletions

View File

@ -44,6 +44,7 @@ public class TeamSuperSmash extends SuperSmash
DontAllowOverfill = true;
TeamMode = true;
ShowTeammateMessage = true;
new TeamModule().register(this);
@ -102,55 +103,6 @@ public class TeamSuperSmash extends SuperSmash
Scoreboard.draw();
}
@Override
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
super.gameStart(event);
new BukkitRunnable()
{
@Override
public void run()
{
for (Player player : GetPlayers(true))
{
GameTeam team = GetTeam(player);
Player bestTeamMember = null;
if (team == null)
{
continue;
}
for (Player teamMember : team.GetPlayers(true))
{
if (player.equals(teamMember))
{
continue;
}
bestTeamMember = teamMember;
}
if (bestTeamMember == null)
{
UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teammate :(", 10, 50, 10, player);
return;
}
UtilTextMiddle.display(null, team.GetColor() + bestTeamMember.getName() + " is your teammate", 10, 50, 10, player);
}
}
}.runTaskLater(Manager.getPlugin(), 40);
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)

View File

@ -437,7 +437,7 @@ public class GamePlayerManager implements Listener
if (bestTeamMember == null)
{
UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teammate :(", 10, 50, 10, player);
return;
continue;
}
UtilTextMiddle.display(null, team.GetColor() + bestTeamMember.getName() + " is your teammate", 10, 50, 10, player);