diff --git a/src/main/java/buttondevteam/discordplugin/mcchat/MCListener.java b/src/main/java/buttondevteam/discordplugin/mcchat/MCListener.java index 144304d..50843e6 100644 --- a/src/main/java/buttondevteam/discordplugin/mcchat/MCListener.java +++ b/src/main/java/buttondevteam/discordplugin/mcchat/MCListener.java @@ -44,7 +44,7 @@ class MCListener implements Listener { .ifPresent(dcp -> MCChatUtils.callLogoutEvent(dcp, false)); } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent e) { if (e.getPlayer() instanceof DiscordConnectedPlayer) return; // Don't show the joined message for the fake player @@ -67,7 +67,7 @@ class MCListener implements Listener { }); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLeave(PlayerQuitEvent e) { if (e.getPlayer() instanceof DiscordConnectedPlayer) return; // Only care about real users diff --git a/src/main/java/buttondevteam/discordplugin/role/GameRoleModule.java b/src/main/java/buttondevteam/discordplugin/role/GameRoleModule.java index e4713b7..d666a13 100644 --- a/src/main/java/buttondevteam/discordplugin/role/GameRoleModule.java +++ b/src/main/java/buttondevteam/discordplugin/role/GameRoleModule.java @@ -21,6 +21,10 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +/** + * Automatically collects roles with a certain color (the second to last in the upper row - #95a5a6). + * Users can add these roles to themselves using the /role Discord command. + */ public class GameRoleModule extends Component { public List GameRoles; @@ -35,6 +39,9 @@ public class GameRoleModule extends Component { } + /** + * The channel where the bot logs when it detects a role change that results in a new game role or one being removed. + */ private ReadOnlyConfigData> logChannel() { return DPUtils.channelData(getConfig(), "logChannel"); } @@ -52,7 +59,7 @@ public class GameRoleModule extends Component { return Mono.empty(); //Deleted or not a game role GameRoles.add(role.getName()); if (logChannel != null) - return logChannel.flatMap(ch -> ch.createMessage("Added " + role.getName() + " as game role. If you don't want this, change the role's color from the default.")); + return logChannel.flatMap(ch -> ch.createMessage("Added " + role.getName() + " as game role. If you don't want this, change the role's color from the game role color.")); return Mono.empty(); }).subscribe(); }, 100); @@ -81,7 +88,7 @@ public class GameRoleModule extends Component { if (removed) return logChannel.flatMap(ch -> ch.createMessage("Changed game role from " + or.getName() + " to " + event.getCurrent().getName() + ".")); else - return logChannel.flatMap(ch -> ch.createMessage("Added " + event.getCurrent().getName() + " as game role because it has the default color.")); + return logChannel.flatMap(ch -> ch.createMessage("Added " + event.getCurrent().getName() + " as game role because it has the color of one.")); } } return Mono.empty(); diff --git a/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java b/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java index 2dab969..d484ef2 100755 --- a/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java +++ b/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java @@ -66,12 +66,14 @@ public class RoleCommand extends ICommand2DC { for (String role : (Iterable) grm.GameRoles.stream().sorted()::iterator) { sb.append(role); if (!b) - for (int j = 0; j < Math.min(0, 20 - role.length()); j++) + for (int j = 0; j < Math.max(1, 20 - role.length()); j++) sb.append(" "); else sb.append("\n"); b = !b; } + if (sb.charAt(sb.length() - 1) != '\n') + sb.append('\n'); sender.sendMessage("list of roles:\n```\n" + sb + "```"); }