im stupid

This commit is contained in:
speedxx 2020-08-14 16:40:50 -04:00
parent d9c703e73e
commit ad93b9ed00

View file

@ -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 (guild.hasTag())
if (plugin.players.contains(player.getName()))
{
if (guild.getTag() != null)
if (!plugin.players.getBoolean(player.getName() + ".tag"))
{
return;
}
}
if (guild.hasTag())
{
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()));
}
}
}
}
}