From ad93b9ed00b5fc22eabb48dbb10f29bc16534bf0 Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Fri, 14 Aug 2020 16:40:50 -0400 Subject: [PATCH] im stupid --- .../tfguilds/listener/ChatListener.java | 61 ++++++------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/src/main/java/me/totalfreedom/tfguilds/listener/ChatListener.java b/src/main/java/me/totalfreedom/tfguilds/listener/ChatListener.java index b4a433a..bcae284 100644 --- a/src/main/java/me/totalfreedom/tfguilds/listener/ChatListener.java +++ b/src/main/java/me/totalfreedom/tfguilds/listener/ChatListener.java @@ -6,7 +6,6 @@ import me.totalfreedom.tfguilds.config.ConfigEntry; import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.guild.GuildRank; import me.totalfreedom.tfguilds.util.GUtil; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -28,6 +27,13 @@ public class ChatListener implements Listener return; } + if (Common.IN_GUILD_CHAT.contains(player)) + { + guild.chat(player.getName(), e.getMessage()); + e.setCancelled(true); + return; + } + GuildRank rank = null; for (GuildRank r : guild.getRanks()) { @@ -58,55 +64,22 @@ public class ChatListener implements Listener display = rank.getName(); } - if (Common.IN_GUILD_CHAT.contains(player)) + if (!ConfigEntry.GUILD_TAGS_ENABLED.getBoolean()) { - guild.chat(player.getName(), e.getMessage()); - e.setCancelled(true); return; } + if (plugin.players.contains(player.getName())) + { + if (!plugin.players.getBoolean(player.getName() + ".tag")) + { + return; + } + } + if (guild.hasTag()) { - if (guild.getTag() != null) - { - e.setFormat(GUtil.colorize(guild.getTag().replace("%rank%", display)) + ChatColor.RESET + " " + e.getFormat()); - } - } - - if (!ConfigEntry.GUILD_TAGS_ENABLED.getBoolean()) - { - for (Player p : Bukkit.getOnlinePlayers()) - { - Guild g = Guild.getGuild(p); - - if (g.hasTag()) - { - e.setFormat(e.getFormat().substring(g.getTag().length())); - - if (g.getTag().contains(display)) - { - e.setFormat(e.getFormat().substring(display.length())); - } - } - } - } - - if (!plugin.players.getBoolean(player.getName() + ".tag") && plugin.players.contains(player.getName())) - { - if (!ConfigEntry.GUILD_TAGS_ENABLED.getBoolean()) - { - return; - } - - if (guild.hasTag()) - { - e.setFormat(e.getFormat().substring(guild.getTag().length())); - - if (guild.getTag().contains(display)) - { - e.setFormat(e.getFormat().substring(display.length())); - } - } + e.setFormat(GUtil.colorize(guild.getTag().replace("%rank%", display)) + ChatColor.RESET + " " + e.getFormat()); } } } \ No newline at end of file