From b0240ef46e995313aef57d3bd8b473de609d514b Mon Sep 17 00:00:00 2001 From: Taah Date: Thu, 24 Aug 2023 21:24:14 -0700 Subject: [PATCH] Remove extra space from prefixes --- server/src/main/java/dev/plex/command/impl/ListCMD.java | 6 +++++- server/src/main/java/dev/plex/command/impl/TagCMD.java | 5 ++--- .../src/main/java/dev/plex/listener/impl/ChatListener.java | 2 +- server/src/main/java/dev/plex/rank/RankManager.java | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/ListCMD.java b/server/src/main/java/dev/plex/command/impl/ListCMD.java index 573cb8e..108fd5e 100644 --- a/server/src/main/java/dev/plex/command/impl/ListCMD.java +++ b/server/src/main/java/dev/plex/command/impl/ListCMD.java @@ -50,7 +50,11 @@ public class ListCMD extends PlexCommand } 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) { diff --git a/server/src/main/java/dev/plex/command/impl/TagCMD.java b/server/src/main/java/dev/plex/command/impl/TagCMD.java index 7b4be8e..f99851f 100644 --- a/server/src/main/java/dev/plex/command/impl/TagCMD.java +++ b/server/src/main/java/dev/plex/command/impl/TagCMD.java @@ -76,15 +76,14 @@ public class TagCMD extends PlexCommand } PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId()); - player.setPrefix(""); + player.setPrefix(null); DataUtils.update(player); return messageComponent("prefixCleared"); } - checkRank(sender, Rank.ADMIN, "plex.tag.clear.others"); Player target = getNonNullPlayer(args[1]); PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId()); - plexTarget.setPrefix(""); + plexTarget.setPrefix(null); DataUtils.update(plexTarget); return messageComponent("otherPrefixCleared", target.getName()); } diff --git a/server/src/main/java/dev/plex/listener/impl/ChatListener.java b/server/src/main/java/dev/plex/listener/impl/ChatListener.java index 319b277..2d7e186 100644 --- a/server/src/main/java/dev/plex/listener/impl/ChatListener.java +++ b/server/src/main/java/dev/plex/listener/impl/ChatListener.java @@ -48,7 +48,7 @@ public class ChatListener extends PlexListener } Component prefix = plugin.getRankManager().getPrefix(plexPlayer); - if (prefix != null) + if (prefix != null && !prefix.equals(Component.empty()) && !prefix.equals(Component.space())) { renderer.hasPrefix = true; renderer.prefix = prefix; diff --git a/server/src/main/java/dev/plex/rank/RankManager.java b/server/src/main/java/dev/plex/rank/RankManager.java index 2dbaa6c..6b922d5 100644 --- a/server/src/main/java/dev/plex/rank/RankManager.java +++ b/server/src/main/java/dev/plex/rank/RankManager.java @@ -124,7 +124,7 @@ public class RankManager } if (getConfigPrefixes(plexPlayer) != null) { - getConfigPrefixes(plexPlayer); + return getConfigPrefixes(plexPlayer); } if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault") && Plex.get().getSystem().equalsIgnoreCase("permissions")) {