Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
FPlayer: make player team always
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Jul 27, 2023
1 parent 1c22beb commit b270a89
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/java/net/flectone/custom/FPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,9 @@ public Team getPlayerTeam() {
Team bukkitTeam = FPlayerManager.getScoreBoard().getTeam(this.name);
Team team = bukkitTeam != null ? bukkitTeam : FPlayerManager.getScoreBoard().registerNewTeam(this.name);

boolean colorWorldsEnabled = Main.config.getBoolean("player.team.enable");
if (!team.hasEntry(this.name)) team.addEntry(this.name);

if (!team.hasEntry(this.name) && colorWorldsEnabled) team.addEntry(this.name);
if (team.hasEntry(this.name) && !colorWorldsEnabled) team.removeEntry(this.name);

team.setOption(Team.Option.NAME_TAG_VISIBILITY, Main.config.getBoolean("player.team.name-visible")
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Main.config.getBoolean("player.name-visible")
? Team.OptionStatus.ALWAYS : Team.OptionStatus.NEVER);

team.setColor(ChatColor.WHITE);
Expand Down Expand Up @@ -377,12 +374,16 @@ public String getRealName() {
}

public void setDisplayName() {
String name = getDisplayName();
String[] strings = name.split(this.name);
String prefix = strings.length > 0 ? strings[0] : "";
String suffix = strings.length > 1 ? strings[1] : "";

this.player.setPlayerListName(getTabName());

String prefix = "";
String suffix = "";
if(Main.config.getBoolean("player.name-tag.enable")){
String[] strings = getDisplayName().split(this.name);
prefix = strings.length > 0 ? strings[0] : "";
suffix = strings.length > 1 ? strings[1] : "";
}

this.team.setPrefix(prefix);
this.team.setSuffix(suffix);
}
Expand Down

0 comments on commit b270a89

Please sign in to comment.