From a5135ef6414f5bd8d3deea90e850cdd8e0d6f292 Mon Sep 17 00:00:00 2001 From: Video Date: Sat, 11 Mar 2023 02:38:33 -0700 Subject: [PATCH] [DISCORD] Lots and lots of bugfixes - Fixes bug where sending any messages through Discord would result in errors about roles - Fixes bug where attempting to send any messages to Discord just didn't work - Discord integration now shows main chat messages in color --- .../java/me/totalfreedom/discord/Bot.java | 4 +- .../java/me/totalfreedom/discord/TFD4J.java | 2 +- .../discord/TFD4JCommonsImpl.java | 18 ++-- .../discord/listener/AdminChatListener.java | 27 +++-- .../discord/listener/MinecraftListener.java | 102 ++++-------------- .../discord/listener/ReactionListener.java | 6 +- .../discord/util/SnowflakeEntry.java | 41 ++++--- .../totalfreedom/discord/util/TFM_Bridge.java | 56 ++++++---- 8 files changed, 114 insertions(+), 142 deletions(-) diff --git a/discord/src/main/java/me/totalfreedom/discord/Bot.java b/discord/src/main/java/me/totalfreedom/discord/Bot.java index b812e3bf..43c4eb1e 100644 --- a/discord/src/main/java/me/totalfreedom/discord/Bot.java +++ b/discord/src/main/java/me/totalfreedom/discord/Bot.java @@ -86,7 +86,7 @@ public class Bot public Mono getGuildById() { - return client.getGuildById(SnowflakeEntry.serverID); + return client.getGuildById(SnowflakeEntry.SERVER_ID.getSnowflake()); } public GatewayDiscordClient getClient() @@ -112,7 +112,7 @@ public class Bot return false; } - Guild server = client.getGuildById(SnowflakeEntry.serverID).block(); + Guild server = client.getGuildById(SnowflakeEntry.SERVER_ID.getSnowflake()).block(); if (server == null) { FLog.severe("The Discord server ID specified is invalid, or the bot is not on the server."); diff --git a/discord/src/main/java/me/totalfreedom/discord/TFD4J.java b/discord/src/main/java/me/totalfreedom/discord/TFD4J.java index 765e273d..721bc18f 100644 --- a/discord/src/main/java/me/totalfreedom/discord/TFD4J.java +++ b/discord/src/main/java/me/totalfreedom/discord/TFD4J.java @@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory; public class TFD4J extends JavaPlugin { - private final Logger slf4j = LoggerFactory.getLogger("TFD4J"); + private final Logger slf4j = getSLF4JLogger(); private Bot bot; private MinecraftListener mc; private AdminChatListener ac; diff --git a/discord/src/main/java/me/totalfreedom/discord/TFD4JCommonsImpl.java b/discord/src/main/java/me/totalfreedom/discord/TFD4JCommonsImpl.java index 4ef2a5d7..203bb047 100644 --- a/discord/src/main/java/me/totalfreedom/discord/TFD4JCommonsImpl.java +++ b/discord/src/main/java/me/totalfreedom/discord/TFD4JCommonsImpl.java @@ -62,11 +62,11 @@ public class TFD4JCommonsImpl implements TFD4JCommons Mono sentMessage = tfd4J .getBot() .getClient() - .getChannelById(SnowflakeEntry.adminChatChannelID) + .getChannelById(SnowflakeEntry.ADMIN_CHAT_CHANNEL_ID.getSnowflake()) .ofType(TextChannel.class) .flatMap(c -> c.createMessage(spec)); - insert(sentMessage); + sentMessage.subscribe(); } } @@ -104,11 +104,11 @@ public class TFD4JCommonsImpl implements TFD4JCommons Mono sentMessage = tfd4J .getBot() .getClient() - .getChannelById(SnowflakeEntry.chatChannelID) + .getChannelById(SnowflakeEntry.CHAT_CHANNEL_ID.getSnowflake()) .ofType(TextChannel.class) .flatMap(c -> c.createMessage(spec)); - insert(sentMessage); + sentMessage.subscribe(); } } @@ -159,11 +159,11 @@ public class TFD4JCommonsImpl implements TFD4JCommons .blockOptional() .orElseThrow(); - Role adminRole = server.getRoleById(SnowflakeEntry.adminRoleID) + Role adminRole = server.getRoleById(SnowflakeEntry.ADMIN_ROLE_ID.getSnowflake()) .blockOptional() .orElseThrow(); - Role senioradminRole = server.getRoleById(SnowflakeEntry.seniorRoleID) + Role senioradminRole = server.getRoleById(SnowflakeEntry.SENIOR_ADMIN_ROLE_ID.getSnowflake()) .blockOptional() .orElseThrow(); @@ -282,7 +282,7 @@ public class TFD4JCommonsImpl implements TFD4JCommons if (server == null) return false; - final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID) + final TextChannel channel = server.getChannelById(SnowflakeEntry.REPORT_CHANNEL_ID.getSnowflake()) .ofType(TextChannel.class) .blockOptional() .orElseThrow(); @@ -324,7 +324,7 @@ public class TFD4JCommonsImpl implements TFD4JCommons final Guild server = tfd4J.getBot() .getClient() - .getGuildById(SnowflakeEntry.serverID) + .getGuildById(SnowflakeEntry.SERVER_ID.getSnowflake()) .block(); if (server == null) @@ -333,7 +333,7 @@ public class TFD4JCommonsImpl implements TFD4JCommons return false; } - final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID) + final TextChannel channel = server.getChannelById(SnowflakeEntry.REPORT_CHANNEL_ID.getSnowflake()) .ofType(TextChannel.class) .blockOptional() .orElseThrow(); diff --git a/discord/src/main/java/me/totalfreedom/discord/listener/AdminChatListener.java b/discord/src/main/java/me/totalfreedom/discord/listener/AdminChatListener.java index 0ef2decc..17d969f1 100644 --- a/discord/src/main/java/me/totalfreedom/discord/listener/AdminChatListener.java +++ b/discord/src/main/java/me/totalfreedom/discord/listener/AdminChatListener.java @@ -49,7 +49,7 @@ public class AdminChatListener .blockOptional() .orElseThrow() .getId() - .equals(SnowflakeEntry.adminChatChannelID)) + .equals(SnowflakeEntry.ADMIN_CHAT_CHANNEL_ID.getSnowflake())) .filter(m -> !m.getMessage() .getAuthor() .orElseThrow() @@ -61,7 +61,7 @@ public class AdminChatListener public void createMessageSpec(MessageCreateEvent m) { Member member = m.getMember().orElseThrow(IllegalAccessError::new); - String tag = tfd4j.getMinecraftListener().getDisplay(member); + String tag = tfd4j.getBot().getTFM().getDisplay(member); Message msg = m.getMessage(); String mediamessage = ChatColor.YELLOW + "[Media]"; @@ -129,28 +129,35 @@ public class AdminChatListener assert server != null; return member.getRoles().map(role -> { - if (role.getId().equals(SnowflakeEntry.ownerRoleID)) + if (role.getId().equals(SnowflakeEntry.OWNER_ROLE_ID.getSnowflake())) { return Title.OWNER; - } else if (role.getId().equals(SnowflakeEntry.developerRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.DEVELOPER_ROLE_ID.getSnowflake())) { return Title.DEVELOPER; - } else if (role.getId().equals(SnowflakeEntry.executiveRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.EXECUTIVE_ROLE_ID.getSnowflake())) { return Title.EXECUTIVE; - } else if (role.getId().equals(SnowflakeEntry.assistantRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.ASSISTANT_EXECUTIVE_ROLE_ID.getSnowflake())) { return Title.ASSTEXEC; - } else if (role.getId().equals(SnowflakeEntry.seniorRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.SENIOR_ADMIN_ROLE_ID.getSnowflake())) { return Rank.SENIOR_ADMIN; - } else if (role.getId().equals(SnowflakeEntry.adminRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.ADMIN_ROLE_ID.getSnowflake())) { return Rank.ADMIN; - } else if (role.getId().equals(SnowflakeEntry.builderRoleID)) + } + else if (role.getId().equals(SnowflakeEntry.MASTERBUILDER_ROLE_ID.getSnowflake())) { return Title.MASTER_BUILDER; - } else + } + else { return null; } diff --git a/discord/src/main/java/me/totalfreedom/discord/listener/MinecraftListener.java b/discord/src/main/java/me/totalfreedom/discord/listener/MinecraftListener.java index 0ac84de9..6c29ab9b 100644 --- a/discord/src/main/java/me/totalfreedom/discord/listener/MinecraftListener.java +++ b/discord/src/main/java/me/totalfreedom/discord/listener/MinecraftListener.java @@ -2,7 +2,6 @@ package me.totalfreedom.discord.listener; import discord4j.core.event.domain.message.MessageCreateEvent; import discord4j.core.object.entity.Attachment; -import discord4j.core.object.entity.Guild; import discord4j.core.object.entity.Member; import discord4j.core.object.entity.Message; import discord4j.core.object.entity.channel.TextChannel; @@ -11,17 +10,14 @@ import me.totalfreedom.discord.TFD4J; import me.totalfreedom.discord.util.SnowflakeEntry; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.rank.Title; -import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; -import org.bukkit.entity.Player; public class MinecraftListener { @@ -52,7 +48,7 @@ public class MinecraftListener .blockOptional() .orElseThrow(IllegalAccessError::new) .getId() - .equals(SnowflakeEntry.chatChannelID)) + .equals(SnowflakeEntry.CHAT_CHANNEL_ID.getSnowflake())) .filter(m -> { Boolean b = m.getMessage() @@ -67,98 +63,44 @@ public class MinecraftListener { Member member = m.getMember().orElseThrow(); Message msg = m.getMessage(); - String tag = getDisplay(member); - TextComponent[] emsg = {Component.empty()}; // We are using a single value arrays here to silence SonarLint's "return value never used" bullshit. + String tag = bot.getTFM().getDisplay(member); - emsg[0] = emsg[0].append(Component.text("[", NamedTextColor.DARK_GRAY)); - TextComponent[] inviteLink = {Component.text("Discord")}; - inviteLink[0] = inviteLink[0].color(NamedTextColor.DARK_AQUA); - HoverEvent hoverEvent = HoverEvent.showText(Component.text("Click to join our Discord server!")); - ClickEvent clickEvent = ClickEvent.openUrl(ConfigEntry.DISCORD_INVITE_LINK.getString()); - inviteLink[0] = inviteLink[0].hoverEvent(hoverEvent); - inviteLink[0] = inviteLink[0].clickEvent(clickEvent); - emsg[0] = emsg[0].append(inviteLink[0]); - emsg[0] = emsg[0].append(Component.text("] ", NamedTextColor.DARK_GRAY)); + TextComponent.Builder builder = Component.text(); + TextComponent prefix = Component.text("[", NamedTextColor.DARK_GRAY) + .append(Component.text("Discord", NamedTextColor.DARK_AQUA) + .hoverEvent(HoverEvent.showText(Component.text("Click to join our Discord server!"))) + .clickEvent(ClickEvent.openUrl(ConfigEntry.DISCORD_INVITE_LINK.getString()))) + .append(Component.text("] ", NamedTextColor.DARK_GRAY)); + TextComponent user = Component.empty(); // Tag (if they have one) - if (tag != null) + if (tag != null && !tag.isEmpty()) { - emsg[0] = emsg[0].append(Component.text(tag)); + user = LegacyComponentSerializer.legacyAmpersand().deserialize(tag).append(Component.space()); } - emsg[0] = emsg[0].append(Component.space()); + user = user.append(Component.text(FUtil.stripColors(member.getDisplayName()).trim(), NamedTextColor.RED)); - // User - TextComponent[] user = {Component.text(FUtil.stripColors(member.getDisplayName()))}; - user[0] = user[0].color(NamedTextColor.RED); - emsg[0] = emsg[0].append(user[0]); + TextComponent message = Component.text(": ", NamedTextColor.DARK_GRAY) + .append(Component.text(FUtil.stripColors(msg.getContent()), NamedTextColor.WHITE)); - // Message - emsg[0] = emsg[0].append(Component.text(": ", NamedTextColor.DARK_GRAY)); - emsg[0] = emsg[0].append(Component.text(FUtil.stripColors(msg.getContent()), NamedTextColor.WHITE)); // Attachments if (!msg.getAttachments().isEmpty()) { if (!msg.getContent().isEmpty()) - emsg[0] = emsg[0].append(Component.space()); + { + message = message.append(Component.space()); + } for (Attachment attachment : msg.getAttachments()) { - TextComponent[] media = {Component.text("[Media] ")}; - media[0] = media[0].color(NamedTextColor.YELLOW); - HoverEvent hover = HoverEvent.showText(Component.text(attachment.getUrl())); - ClickEvent click = ClickEvent.openUrl(attachment.getUrl()); - media[0] = media[0].clickEvent(click); - media[0] = media[0].hoverEvent(hover); - emsg[0] = emsg[0].append(media[0]); + message = message.append(Component.text("[Media] ", NamedTextColor.YELLOW) + .hoverEvent(HoverEvent.showText(Component.text(attachment.getUrl()))) + .clickEvent(ClickEvent.openUrl(attachment.getUrl()))); } } - - for (Player player : Bukkit.getOnlinePlayers()) - { - if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord()) - { - player.sendMessage(emsg[0]); - } - } - - FLog.info(emsg[0].content(), true); - } - - public String getDisplay(Member member) - { - Guild server = tfd4j.getBot().getGuildById().block(); - // Server Owner - assert server != null; - return member.getRoles().map(role -> - { - if (role.getId().equals(SnowflakeEntry.ownerRoleID)) - { - return Title.OWNER.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.developerRoleID)) - { - return Title.DEVELOPER.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.executiveRoleID)) - { - return Title.EXECUTIVE.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.assistantRoleID)) - { - return Title.ASSTEXEC.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.seniorRoleID)) - { - return Rank.SENIOR_ADMIN.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.adminRoleID)) - { - return Rank.ADMIN.getColoredTag(); - } else if (role.getId().equals(SnowflakeEntry.builderRoleID)) - { - return Title.MASTER_BUILDER.getColoredTag(); - } else - { - return null; - } - }).blockFirst(); + Bukkit.broadcast(builder.append(prefix, user, message).build()); } } diff --git a/discord/src/main/java/me/totalfreedom/discord/listener/ReactionListener.java b/discord/src/main/java/me/totalfreedom/discord/listener/ReactionListener.java index a6d6bedb..6b277680 100644 --- a/discord/src/main/java/me/totalfreedom/discord/listener/ReactionListener.java +++ b/discord/src/main/java/me/totalfreedom/discord/listener/ReactionListener.java @@ -4,12 +4,10 @@ import discord4j.core.event.domain.message.ReactionAddEvent; import discord4j.core.object.Embed; import discord4j.core.object.entity.Member; import discord4j.core.object.entity.Message; -import discord4j.core.object.entity.channel.Channel; import discord4j.core.object.entity.channel.TextChannel; import discord4j.discordjson.json.MessageCreateRequest; import me.totalfreedom.discord.TFD4J; import me.totalfreedom.discord.util.SnowflakeEntry; -import me.totalfreedom.totalfreedommod.util.FLog; public class ReactionListener { @@ -34,7 +32,7 @@ public class ReactionListener .equals(tfd4j.getBot().getClient().getSelfId())) .filter(r -> !r.getChannel() .blockOptional() - .orElseThrow().getId().equals(SnowflakeEntry.reportChannelID)) + .orElseThrow().getId().equals(SnowflakeEntry.REPORT_CHANNEL_ID.getSnowflake())) .filter(r -> r.getEmoji() .asUnicodeEmoji() .orElseThrow(UnsupportedOperationException::new) @@ -47,7 +45,7 @@ public class ReactionListener { final TextChannel archiveChannel = tfd4j.getBot() .getClient() - .getChannelById(SnowflakeEntry.archiveChannelID) + .getChannelById(SnowflakeEntry.ARCHIVE_REPORT_CHANNEL_ID.getSnowflake()) .ofType(TextChannel.class) .blockOptional() .orElseThrow(); diff --git a/discord/src/main/java/me/totalfreedom/discord/util/SnowflakeEntry.java b/discord/src/main/java/me/totalfreedom/discord/util/SnowflakeEntry.java index 030e4055..d064ad5a 100644 --- a/discord/src/main/java/me/totalfreedom/discord/util/SnowflakeEntry.java +++ b/discord/src/main/java/me/totalfreedom/discord/util/SnowflakeEntry.java @@ -3,18 +3,33 @@ package me.totalfreedom.discord.util; import discord4j.common.util.Snowflake; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -public class SnowflakeEntry +public enum SnowflakeEntry { - public static final Snowflake adminChatChannelID = Snowflake.of(ConfigEntry.DISCORD_ADMINCHAT_CHANNEL_ID.getString()); - public static final Snowflake chatChannelID = Snowflake.of(ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString()); - public static final Snowflake serverID = Snowflake.of(ConfigEntry.DISCORD_SERVER_ID.getString()); - public static final Snowflake ownerRoleID = Snowflake.of(ConfigEntry.DISCORD_SERVER_OWNER_ROLE_ID.getString()); - public static final Snowflake developerRoleID = Snowflake.of(ConfigEntry.DISCORD_DEVELOPER_ROLE_ID.getString()); - public static final Snowflake executiveRoleID = Snowflake.of(ConfigEntry.DISCORD_EXECUTIVE_ROLE_ID.getString()); - public static final Snowflake assistantRoleID = Snowflake.of(ConfigEntry.DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID.getString()); - public static final Snowflake seniorRoleID = Snowflake.of(ConfigEntry.DISCORD_SENIOR_ADMIN_ROLE_ID.getString()); - public static final Snowflake adminRoleID = Snowflake.of(ConfigEntry.DISCORD_NEW_ADMIN_ROLE_ID.getString()); - public static final Snowflake builderRoleID = Snowflake.of(ConfigEntry.DISCORD_MASTER_BUILDER_ROLE_ID.getString()); - public static final Snowflake reportChannelID = Snowflake.of(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString()); - public static final Snowflake archiveChannelID = Snowflake.of(ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString()); + ADMIN_CHAT_CHANNEL_ID(ConfigEntry.DISCORD_ADMINCHAT_CHANNEL_ID), + CHAT_CHANNEL_ID(ConfigEntry.DISCORD_CHAT_CHANNEL_ID), + REPORT_CHANNEL_ID(ConfigEntry.DISCORD_REPORT_CHANNEL_ID), + ARCHIVE_REPORT_CHANNEL_ID(ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID), + //-- + SERVER_ID(ConfigEntry.DISCORD_SERVER_ID), + //-- + OWNER_ROLE_ID(ConfigEntry.DISCORD_SERVER_OWNER_ROLE_ID), + DEVELOPER_ROLE_ID(ConfigEntry.DISCORD_DEVELOPER_ROLE_ID), + EXECUTIVE_ROLE_ID(ConfigEntry.DISCORD_EXECUTIVE_ROLE_ID), + ASSISTANT_EXECUTIVE_ROLE_ID(ConfigEntry.DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID), + SENIOR_ADMIN_ROLE_ID(ConfigEntry.DISCORD_SENIOR_ADMIN_ROLE_ID), + ADMIN_ROLE_ID(ConfigEntry.DISCORD_NEW_ADMIN_ROLE_ID), + MASTERBUILDER_ROLE_ID(ConfigEntry.DISCORD_MASTER_BUILDER_ROLE_ID); + + + private ConfigEntry entry; + + SnowflakeEntry(ConfigEntry entry) + { + this.entry = entry; + } + + public Snowflake getSnowflake() + { + return Snowflake.of(entry.getString()); + } } diff --git a/discord/src/main/java/me/totalfreedom/discord/util/TFM_Bridge.java b/discord/src/main/java/me/totalfreedom/discord/util/TFM_Bridge.java index f47ff443..72651855 100644 --- a/discord/src/main/java/me/totalfreedom/discord/util/TFM_Bridge.java +++ b/discord/src/main/java/me/totalfreedom/discord/util/TFM_Bridge.java @@ -31,36 +31,46 @@ public class TFM_Bridge { Guild server = bot.getGuildById().block(); // Server Owner - if (server == null) - { - throw new IllegalStateException(); - } - - Snowflake ownerID = Snowflake.of(ConfigEntry.DISCORD_SERVER_OWNER_ROLE_ID.getString()); - Snowflake developerID = Snowflake.of(ConfigEntry.DISCORD_DEVELOPER_ROLE_ID.getString()); - Snowflake executiveID = Snowflake.of(ConfigEntry.DISCORD_EXECUTIVE_ROLE_ID.getString()); - Snowflake assistantExecutiveID = Snowflake.of(ConfigEntry.DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID.getString()); - Snowflake seniorAdminID = Snowflake.of(ConfigEntry.DISCORD_SENIOR_ADMIN_ROLE_ID.getString()); - Snowflake adminID = Snowflake.of(ConfigEntry.DISCORD_NEW_ADMIN_ROLE_ID.getString()); - Snowflake masterBuilderID = Snowflake.of(ConfigEntry.DISCORD_MASTER_BUILDER_ROLE_ID.getString()); - - Snowflake[] ids = {ownerID, developerID, executiveID, assistantExecutiveID, seniorAdminID, adminID, masterBuilderID}; - String[] titles = {Title.OWNER.getColoredTag(), Title.DEVELOPER.getColoredTag(), Title.EXECUTIVE.getColoredTag(), Title.ASSTEXEC.getColoredTag(), Rank.SENIOR_ADMIN.getColoredTag(), Rank.ADMIN.getColoredTag(), Title.MASTER_BUILDER.getColoredTag()}; - + assert server != null; return member.getRoles().map(role -> { - for (int i = 0; i < ids.length; i++) + if (role.getId().equals(SnowflakeEntry.OWNER_ROLE_ID.getSnowflake())) { - if (role.getId().equals(ids[i])) - { - return titles[i]; - } + return Title.OWNER.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.DEVELOPER_ROLE_ID.getSnowflake())) + { + return Title.DEVELOPER.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.EXECUTIVE_ROLE_ID.getSnowflake())) + { + return Title.EXECUTIVE.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.ASSISTANT_EXECUTIVE_ROLE_ID.getSnowflake())) + { + return Title.ASSTEXEC.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.SENIOR_ADMIN_ROLE_ID.getSnowflake())) + { + return Rank.SENIOR_ADMIN.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.ADMIN_ROLE_ID.getSnowflake())) + { + return Rank.ADMIN.getColoredTag(); + } + else if (role.getId().equals(SnowflakeEntry.MASTERBUILDER_ROLE_ID.getSnowflake())) + { + return Title.MASTER_BUILDER.getColoredTag(); + } + else + { + return ""; } - return null; }).blockFirst(); } - public TotalFreedomMod getCommons() { + public TotalFreedomMod getCommons() + { return commons; } }