SteamWar/FightSystem
Archiviert
13
1

Removed leaderPlayer doubles + scoreboard testing

Dieser Commit ist enthalten in:
lixfel 2019-02-23 21:07:47 +01:00
Ursprung bf0ffb5684
Commit 84c8e38472
2 geänderte Dateien mit 9 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -29,8 +29,6 @@ public class FightTeam {
}
public FightPlayer getFightPlayer(Player player) {
if(leader.getPlayer().equals(player))
return leader;
for(FightPlayer fightPlayer : players) {
if(fightPlayer.getPlayer().equals(player))
return fightPlayer;
@ -43,9 +41,6 @@ public class FightTeam {
}
public boolean allPlayersOut() {
if(!this.leader.isOut()) {
return false;
}
for(FightPlayer fightPlayer : this.players) {
if(!fightPlayer.isOut())
return false;
@ -58,7 +53,7 @@ public class FightTeam {
if(fightPlayer.getPlayer().equals(player))
return true;
}
return leader.getPlayer() != null && leader.getPlayer().equals(player);
return false;
}
public boolean isPlayerLeader(Player player) {
@ -70,7 +65,6 @@ public class FightTeam {
}
public void broadcast(String message) {
leader.sendMessage(message);
for(FightPlayer fightPlayer : players) {
fightPlayer.sendMessage(message);
}
@ -97,7 +91,8 @@ public class FightTeam {
public void setLeader(FightPlayer leader) {
this.leader = leader;
if(!this.players.contains(leader)) this.players.add(leader);
if(!this.players.contains(leader))
this.players.add(leader);
}
public ArrayList<FightPlayer> getPlayers() {

Datei anzeigen

@ -2,6 +2,7 @@ package me.yaruma.fightsystem.utils.scoreboard;
import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightPlayer;
import me.yaruma.fightsystem.fight.FightTeam;
import me.yaruma.fightsystem.winconditions.Methods;
import org.bukkit.Bukkit;
@ -30,13 +31,14 @@ public class Scoreboard {
@Override
public void run() {
if(getIndexDisplay(index) != null) {
FightTeam fightTeam = getIndexDisplay(index);
if(fightTeam != null) {
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("§6Info " + getIndexDisplay(index).getPrefix() + getIndexDisplay(index).getName());
objective.setDisplayName("§6Info " + fightTeam.getPrefix() + fightTeam.getName());
for(int i = 0; i < getIndexDisplay(index).getPlayers().size(); i++) {
objective.getScore(getIndexDisplay(index).getPrefix() + getIndexDisplay(index).getPlayers().get(i).getPlayer().getDisplayName() + " §8: " + "§6" + getIndexDisplay(index).getPlayers().get(i).getPlayer().getHealth()).setScore(i);
for(FightPlayer fp : fightTeam.getPlayers()) {
objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getDisplayName()).setScore(fp.getPlayer().getHealth());
}
} else {