mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Tidy things up a bit
This commit is contained in:
parent
3bd72dacda
commit
5a96204f1b
@ -34,55 +34,36 @@ public class DiscordToMinecraftListener extends ListenerAdapter
|
|||||||
{
|
{
|
||||||
message += " " + tag;
|
message += " " + tag;
|
||||||
}
|
}
|
||||||
message += " " + ChatColor.RED + ChatColor.stripColor(member.getEffectiveName()) + ChatColor.DARK_GRAY + ": " + ChatColor.RESET;
|
message += " " + ChatColor.RED + ChatColor.stripColor(member.getEffectiveName()) + ChatColor.DARK_GRAY + ":" + ChatColor.RESET;
|
||||||
|
ComponentBuilder builder = new ComponentBuilder(message);
|
||||||
if (!msg.getContentDisplay().isEmpty())
|
if (!msg.getContentDisplay().isEmpty())
|
||||||
{
|
{
|
||||||
message += ChatColor.stripColor(msg.getContentDisplay());
|
builder.append(" ").append(ChatColor.stripColor(msg.getContentDisplay()));
|
||||||
ComponentBuilder builder = new ComponentBuilder(message);
|
message += " " + ChatColor.stripColor(msg.getContentDisplay()); // for logging
|
||||||
if (!msg.getAttachments().isEmpty())
|
|
||||||
{
|
|
||||||
for (Message.Attachment attachment : msg.getAttachments())
|
|
||||||
{
|
|
||||||
if (attachment.getUrl() == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
builder.append(" ");
|
|
||||||
TextComponent text = new TextComponent(net.md_5.bungee.api.ChatColor.YELLOW + "[Media]");
|
|
||||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
|
||||||
builder.append(text).append(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
|
||||||
{
|
|
||||||
player.spigot().sendMessage(builder.create());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FLog.info(message);
|
|
||||||
}
|
}
|
||||||
else
|
if (!msg.getAttachments().isEmpty())
|
||||||
{
|
{
|
||||||
ComponentBuilder builder = new ComponentBuilder(message);
|
|
||||||
for (Message.Attachment attachment : msg.getAttachments())
|
for (Message.Attachment attachment : msg.getAttachments())
|
||||||
{
|
{
|
||||||
if (attachment.getUrl() == null)
|
if (attachment.getUrl() == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TextComponent text = new TextComponent(net.md_5.bungee.api.ChatColor.YELLOW + "[Media]");
|
builder.append(" ");
|
||||||
|
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]");
|
||||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
||||||
builder.append(text).append(" ");
|
builder.append(text);
|
||||||
}
|
message += " [Media]"; // for logging
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
|
||||||
{
|
|
||||||
player.spigot().sendMessage(builder.create());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
||||||
|
{
|
||||||
|
player.spigot().sendMessage(builder.create());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FLog.info(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user