mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2026-01-06 15:42:00 +00:00
add prefix to team
This commit is contained in:
@@ -51,6 +51,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -143,6 +144,11 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin implement
|
||||
if (storageManager != null) ((StorageManagerImpl) this.storageManager).disable();
|
||||
if (adventureManager != null) ((AdventureManagerImpl) this.adventureManager).close();
|
||||
if (versionManager != null) HandlerList.unregisterAll((VersionManagerImpl) versionManager);
|
||||
for (Team team : Bukkit.getScoreboardManager().getMainScoreboard().getTeams()) {
|
||||
if (team.getName().startsWith("CNP_")) {
|
||||
team.unregister();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,7 +70,7 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener {
|
||||
if (CNConfig.disableTeamManage) return;
|
||||
if (CNConfig.isOtherTeamPluginHooked()) return;
|
||||
String team = teamProvider.getTeam(player, null);
|
||||
if (!team.equals(player.getName())) return;
|
||||
if (!team.equals("CNP_" + player.getName())) return;
|
||||
// if (CNConfig.createRealTeam) {
|
||||
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||
Team playerTeam = scoreboard.getTeam(team);
|
||||
@@ -121,7 +121,7 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener {
|
||||
if (CNConfig.isOtherTeamPluginHooked()) return;
|
||||
String team = teamProvider.getTeam(player, null);
|
||||
// If the team is created by other plugins
|
||||
if (!team.equals(player.getName())) return;
|
||||
if (!team.equals("CNP_" + player.getName())) return;
|
||||
// if (CNConfig.createRealTeam) {
|
||||
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||
Optional.ofNullable(scoreboard.getTeam(team)).ifPresent(Team::unregister);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DefaultProvider implements TeamProvider {
|
||||
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||
Team team = scoreboard.getPlayerTeam(player);
|
||||
if (team == null) {
|
||||
return player.getName();
|
||||
return "CNP_" + player.getName();
|
||||
}
|
||||
return team.getName();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user