Added getUniqueTeam(prefix) to DisguiseUtilities for other plugins

This commit is contained in:
libraryaddict 2020-04-24 16:28:31 +12:00
parent 5fe25f90a0
commit 714c37d1c3
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -1340,6 +1340,10 @@ public class DisguiseUtilities {
} }
public static String getUniqueTeam() { public static String getUniqueTeam() {
return getUniqueTeam("LD_");
}
public static String getUniqueTeam(String prefix) {
Scoreboard mainBoard = Bukkit.getScoreboardManager().getMainScoreboard(); Scoreboard mainBoard = Bukkit.getScoreboardManager().getMainScoreboard();
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
@ -1349,7 +1353,7 @@ public class DisguiseUtilities {
teamName = teamName.substring(teamName.length() - 13); teamName = teamName.substring(teamName.length() - 13);
} }
teamName = "LD_" + teamName; teamName = prefix + teamName;
if (mainBoard.getTeam(teamName) != null) { if (mainBoard.getTeam(teamName) != null) {
continue; continue;