From 4def45e8cfc4830e00d8ecf79b39f030f0d068a4 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 14 May 2020 02:17:15 +0200 Subject: [PATCH] fix: TeamManager Char Limit --- .../de/cliffbreak/varo/managers/TeamManager.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/varo/src/main/java/de/cliffbreak/varo/managers/TeamManager.java b/varo/src/main/java/de/cliffbreak/varo/managers/TeamManager.java index a644600..3aa4b4b 100644 --- a/varo/src/main/java/de/cliffbreak/varo/managers/TeamManager.java +++ b/varo/src/main/java/de/cliffbreak/varo/managers/TeamManager.java @@ -25,6 +25,7 @@ public class TeamManager { private final JSONConfig config; private final Scoreboard scoreboard; private final ArrayList teams; + private static final String TEAM_PREFIX = "~"; public TeamManager(final Varo plugin) { this.plugin = plugin; @@ -42,17 +43,18 @@ public class TeamManager { for (final Object jsonRawTeam : jsonTeams) { final JSONObject jsonTeam = (JSONObject) jsonRawTeam; final Team team, afkTeam; - if (jsonTeam.get("Name") == null) + if (jsonTeam.get("Name") == null) { continue; + } if (this.scoreboard.getTeam((String) jsonTeam.get("Name")) == null) { team = this.scoreboard.registerNewTeam((String) jsonTeam.get("Name")); } else { team = this.scoreboard.getTeam((String) jsonTeam.get("Name")); } - if (this.scoreboard.getTeam("afk" + jsonTeam.get("Name")) == null) { - afkTeam = this.scoreboard.registerNewTeam("afk" + jsonTeam.get("Name")); + if (this.scoreboard.getTeam(TEAM_PREFIX + jsonTeam.get("Name")) == null) { + afkTeam = this.scoreboard.registerNewTeam(TEAM_PREFIX + jsonTeam.get("Name")); } else { - afkTeam = this.scoreboard.getTeam("afk" + jsonTeam.get("Name")); + afkTeam = this.scoreboard.getTeam(TEAM_PREFIX + jsonTeam.get("Name")); } this.teams.add(team); this.teams.add(afkTeam); @@ -81,7 +83,6 @@ public class TeamManager { "§c§lFehler:§r§c beim Verbinden mit der Mojang-API ist ein Fehler aufgetreten. Eventuell sind die Mojang Server down."); } } - } } @@ -97,7 +98,7 @@ public class TeamManager { public void setAFK(final String player) { final Team oldTeam = getTeamByPlayer(player); for (final Team team : this.teams) { - if (team.getName().equals("afk" + oldTeam.getName())) { + if (team.getName().equals(TEAM_PREFIX + oldTeam.getName())) { team.addEntry(player); } }