refactor: add missing this and final

This commit is contained in:
Simon Giesel 2020-05-14 00:32:59 +02:00
parent ee9bab2e3f
commit fe09426f69

View file

@ -44,18 +44,18 @@ public class TeamManager {
final Team team, afkTeam;
if (jsonTeam.get("Name") == null)
continue;
if (scoreboard.getTeam((String) jsonTeam.get("Name")) == null) {
if (this.scoreboard.getTeam((String) jsonTeam.get("Name")) == null) {
team = this.scoreboard.registerNewTeam((String) jsonTeam.get("Name"));
} else {
team = scoreboard.getTeam((String) jsonTeam.get("Name"));
team = this.scoreboard.getTeam((String) jsonTeam.get("Name"));
}
if (scoreboard.getTeam("afk" + jsonTeam.get("Name")) == null) {
if (this.scoreboard.getTeam("afk" + jsonTeam.get("Name")) == null) {
afkTeam = this.scoreboard.registerNewTeam("afk" + jsonTeam.get("Name"));
} else {
afkTeam = scoreboard.getTeam("afk" + jsonTeam.get("Name"));
afkTeam = this.scoreboard.getTeam("afk" + jsonTeam.get("Name"));
}
teams.add(team);
teams.add(afkTeam);
this.teams.add(team);
this.teams.add(afkTeam);
team.setPrefix(ChatColor.valueOf((String) jsonTeam.get("Color")) + "§l[" + jsonTeam.get("Prefix") + "] ");
afkTeam.setPrefix("§8§l[AFK] ");
team.setColor(ChatColor.WHITE);
@ -94,8 +94,8 @@ public class TeamManager {
return null;
}
public void setAFK(String player) {
Team oldTeam = getTeamByPlayer(player);
public void setAFK(final String player) {
final Team oldTeam = getTeamByPlayer(player);
for (final Team team : this.teams) {
if (team.getName().equals("afk" + oldTeam.getName())) {
team.addEntry(player);
@ -103,12 +103,12 @@ public class TeamManager {
}
}
public void setTeam(Player player) {
public void setTeam(final Player player) {
final JSONArray jsonTeams = config.getArray("Teams");
for (final Object jsonRawTeam : jsonTeams) {
JSONObject jsonTeam = (JSONObject) jsonRawTeam;
final JSONObject jsonTeam = (JSONObject) jsonRawTeam;
if (((JSONArray) jsonTeam.get("Players")).contains(player.getUniqueId().toString().replace("-", ""))) {
for (Team team : this.teams) {
for (final Team team : this.teams) {
if (team.getName().equals(jsonTeam.get("Name").toString())) {
team.addEntry(player.getName());
}