Fix the teammate message not appearing if there were an odd number of players
This commit is contained in:
parent
b8d0353a01
commit
7e6dbed17e
@ -44,6 +44,7 @@ public class TeamSuperSmash extends SuperSmash
|
||||
DontAllowOverfill = true;
|
||||
|
||||
TeamMode = true;
|
||||
ShowTeammateMessage = true;
|
||||
|
||||
new TeamModule().register(this);
|
||||
|
||||
@ -103,55 +104,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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user