Remove extra space from prefixes

This commit is contained in:
Taah 2023-08-24 21:24:14 -07:00
parent 4887960463
commit b0240ef46e
4 changed files with 9 additions and 6 deletions

View File

@ -50,7 +50,11 @@ public class ListCMD extends PlexCommand
} }
else else
{ {
list = list.append(VaultHook.getPrefix(getPlexPlayer(player))).append(Component.space()).append(Component.text(player.getName()).color(NamedTextColor.WHITE)); Component prefix = VaultHook.getPrefix(getPlexPlayer(player));
if (prefix != null && !prefix.equals(Component.empty()) && !prefix.equals(Component.space())) {
list = list.append(prefix).append(Component.space());
}
list = list.append(Component.text(player.getName()).color(NamedTextColor.WHITE));
} }
if (i != players.size() - 1) if (i != players.size() - 1)
{ {

View File

@ -76,15 +76,14 @@ public class TagCMD extends PlexCommand
} }
PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId()); PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId());
player.setPrefix(""); player.setPrefix(null);
DataUtils.update(player); DataUtils.update(player);
return messageComponent("prefixCleared"); return messageComponent("prefixCleared");
} }
checkRank(sender, Rank.ADMIN, "plex.tag.clear.others"); checkRank(sender, Rank.ADMIN, "plex.tag.clear.others");
Player target = getNonNullPlayer(args[1]); Player target = getNonNullPlayer(args[1]);
PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId()); PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId());
plexTarget.setPrefix(""); plexTarget.setPrefix(null);
DataUtils.update(plexTarget); DataUtils.update(plexTarget);
return messageComponent("otherPrefixCleared", target.getName()); return messageComponent("otherPrefixCleared", target.getName());
} }

View File

@ -48,7 +48,7 @@ public class ChatListener extends PlexListener
} }
Component prefix = plugin.getRankManager().getPrefix(plexPlayer); Component prefix = plugin.getRankManager().getPrefix(plexPlayer);
if (prefix != null) if (prefix != null && !prefix.equals(Component.empty()) && !prefix.equals(Component.space()))
{ {
renderer.hasPrefix = true; renderer.hasPrefix = true;
renderer.prefix = prefix; renderer.prefix = prefix;

View File

@ -124,7 +124,7 @@ public class RankManager
} }
if (getConfigPrefixes(plexPlayer) != null) if (getConfigPrefixes(plexPlayer) != null)
{ {
getConfigPrefixes(plexPlayer); return getConfigPrefixes(plexPlayer);
} }
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault") && Plex.get().getSystem().equalsIgnoreCase("permissions")) if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault") && Plex.get().getSystem().equalsIgnoreCase("permissions"))
{ {