Skip to content

Commit

Permalink
Try to recover from bad plugins unregistering PvPManager teams
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanceSD authored and ChanceSD committed May 30, 2020
1 parent a8aa07d commit 936761c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public TeamProfile(final PvPlayer p) {
setupTeams();
final Team team = scoreboard.getEntryTeam(pvPlayer.getName());
// player got stuck in this team somehow (server crash?)
if (team != null && team.getPrefix().equals(ChatColor.translateAlternateColorCodes('&', Settings.getNameTagColor()))) {
if (team != null && team.getScoreboard() != null && team.getPrefix().equals(ChatColor.translateAlternateColorCodes('&', Settings.getNameTagColor()))) {
team.removeEntry(pvPlayer.getName());
}
}
Expand Down Expand Up @@ -78,7 +78,14 @@ public final void setInCombat() {
if (team != null && !team.equals(inCombat)) {
previousTeam = team;
}
inCombat.addEntry(pvPlayer.getName());
try {
inCombat.addEntry(pvPlayer.getName());
} catch (final IllegalStateException e) {
setupTeams();
inCombat.addEntry(pvPlayer.getName());
Log.info("Failed to add player to combat team");
Log.info("This warning can be ignored but if it happens often it means one of your plugins is removing PvPManager teams and causing a conflict");
}
}

public final void restoreTeam() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public PvPlayer(final Player player, final PvPManager plugin) {
Settings.setUseNameTag(false);
Settings.setToggleNametagsEnabled(false);
this.teamProfile = null;
Log.severe("Colored nametags disabled. You need to update your Spigot version.");
Log.warning("Colored nametags disabled. You need to update your Spigot version.");
}
}
}
Expand Down

0 comments on commit 936761c

Please sign in to comment.