SteamWar/FightSystem
Archiviert
13
1

Merge branch 'leaderPlayer' into 'master'

Removed leaderPlayer doubles + scoreboard testing

See merge request Yaruma3341/fightsystem!8
Dieser Commit ist enthalten in:
Yaruma3341 2019-02-23 21:09:10 +01:00
Commit 6bef99e8e7
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) { public FightPlayer getFightPlayer(Player player) {
if(leader.getPlayer().equals(player))
return leader;
for(FightPlayer fightPlayer : players) { for(FightPlayer fightPlayer : players) {
if(fightPlayer.getPlayer().equals(player)) if(fightPlayer.getPlayer().equals(player))
return fightPlayer; return fightPlayer;
@ -43,9 +41,6 @@ public class FightTeam {
} }
public boolean allPlayersOut() { public boolean allPlayersOut() {
if(!this.leader.isOut()) {
return false;
}
for(FightPlayer fightPlayer : this.players) { for(FightPlayer fightPlayer : this.players) {
if(!fightPlayer.isOut()) if(!fightPlayer.isOut())
return false; return false;
@ -58,7 +53,7 @@ public class FightTeam {
if(fightPlayer.getPlayer().equals(player)) if(fightPlayer.getPlayer().equals(player))
return true; return true;
} }
return leader.getPlayer() != null && leader.getPlayer().equals(player); return false;
} }
public boolean isPlayerLeader(Player player) { public boolean isPlayerLeader(Player player) {
@ -70,7 +65,6 @@ public class FightTeam {
} }
public void broadcast(String message) { public void broadcast(String message) {
leader.sendMessage(message);
for(FightPlayer fightPlayer : players) { for(FightPlayer fightPlayer : players) {
fightPlayer.sendMessage(message); fightPlayer.sendMessage(message);
} }
@ -97,7 +91,8 @@ public class FightTeam {
public void setLeader(FightPlayer leader) { public void setLeader(FightPlayer leader) {
this.leader = 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() { 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.FightSystem;
import me.yaruma.fightsystem.fight.Fight; import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightPlayer;
import me.yaruma.fightsystem.fight.FightTeam; import me.yaruma.fightsystem.fight.FightTeam;
import me.yaruma.fightsystem.winconditions.Methods; import me.yaruma.fightsystem.winconditions.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -30,13 +31,14 @@ public class Scoreboard {
@Override @Override
public void run() { public void run() {
if(getIndexDisplay(index) != null) { FightTeam fightTeam = getIndexDisplay(index);
if(fightTeam != null) {
objective.setDisplaySlot(DisplaySlot.SIDEBAR); 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++) { for(FightPlayer fp : fightTeam.getPlayers()) {
objective.getScore(getIndexDisplay(index).getPrefix() + getIndexDisplay(index).getPlayers().get(i).getPlayer().getDisplayName() + " §8: " + "§6" + getIndexDisplay(index).getPlayers().get(i).getPlayer().getHealth()).setScore(i); objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getDisplayName()).setScore(fp.getPlayer().getHealth());
} }
} else { } else {