From 4f97e181a72782e9a2dbe0caae13b88924961ec3 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 5 Jul 2024 19:43:18 +0100 Subject: [PATCH] fix log error --- src/main/java/cc/fascinated/bat/common/RoleUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/common/RoleUtils.java b/src/main/java/cc/fascinated/bat/common/RoleUtils.java index c6e8ce0..5c2c126 100644 --- a/src/main/java/cc/fascinated/bat/common/RoleUtils.java +++ b/src/main/java/cc/fascinated/bat/common/RoleUtils.java @@ -7,6 +7,7 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; import java.awt.*; +import java.util.EnumSet; /** * @author Fascinated (fascinated7) @@ -33,7 +34,11 @@ public class RoleUtils { */ public String getFormattedPermissions(Role role) { StringBuilder formattedPermissions = new StringBuilder(); - for (Permission permission : role.getPermissions()) { + EnumSet permissions = role.getPermissions(); + if (permissions.isEmpty()) { + return "`None`"; + } + for (Permission permission : permissions) { formattedPermissions.append("`").append(permission.getName()).append("`, "); } return formattedPermissions.substring(0, formattedPermissions.length() - 2);