@@ -17,53 +17,55 @@ public class AccessLevel {
1717 * Literally everyone, everywhere.
1818 */
1919 public static final AccessLevel EVERYONE = new AccessLevel (
20- EnumSet .noneOf (Permission .class ), false , false , 0 );
20+ EnumSet .noneOf (Permission .class ), false , false );
2121
2222 /**
2323 * Only available in guilds.
2424 */
2525 public static final AccessLevel GUILD_ONLY = new AccessLevel (
26- EnumSet .noneOf (Permission .class ), true , false , 0 );
26+ EnumSet .noneOf (Permission .class ), true , false );
2727
2828 /**
2929 * Only available in private channels.
3030 */
3131 public static final AccessLevel PRIVATE_ONLY = new AccessLevel (
32- EnumSet .noneOf (Permission .class ), false , true , 0 );
32+ EnumSet .noneOf (Permission .class ), false , true );
3333
3434 /**
3535 * In guilds, peoples who can delete messages.
3636 */
3737 public static final AccessLevel GUILD_MODERATOR = new AccessLevel (
38- EnumSet .of (Permission .MESSAGE_MANAGE ), true , false , 0 );
38+ EnumSet .of (Permission .MESSAGE_MANAGE ), true , false );
3939
4040 /**
4141 * In guilds, those who have all of the permissions.
4242 */
4343 public static final AccessLevel GUILD_ADMINISTRATOR = new AccessLevel (
44- EnumSet .of (Permission .ADMINISTRATOR ), true , false , 0 );
44+ EnumSet .of (Permission .ADMINISTRATOR ), true , false );
4545
4646 /**
4747 * Only the creator of the bot.
4848 */
49- public static final AccessLevel CREATOR = new AccessLevel (EnumSet .noneOf (Permission .class ), false , false , CREATOR_ID );
49+ public static final AccessLevel CREATOR = new AccessLevel (EnumSet .noneOf (Permission .class ), false , false ) {
50+ @ Override
51+ public boolean check (@ Nonnull CommandEvent event ) {
52+ return event .getAuthor ().getIdLong () == CREATOR_ID ;
53+ }
54+ };
5055
5156 private final EnumSet <Permission > requiredPermissions ;
5257 private final boolean onlyGuild ;
5358 private final boolean onlyPrivate ;
54- private final long user ;
5559
5660 /**
5761 * @param requiredPermissions The permissions required if in a guild.
5862 * @param onlyGuild Flag that indicate that this can only occur in a guild.
5963 * @param onlyPrivate Flag that indicate that this can only occur in a private channel.
60- * @param user Flag that indicate that only this user can use this, /!\ overwrite every other flag /!\.
6164 */
62- public AccessLevel (@ Nonnull EnumSet <Permission > requiredPermissions , boolean onlyGuild , boolean onlyPrivate , long user ) {
65+ public AccessLevel (@ Nonnull EnumSet <Permission > requiredPermissions , boolean onlyGuild , boolean onlyPrivate ) {
6366 this .requiredPermissions = requiredPermissions ;
6467 this .onlyGuild = onlyGuild ;
6568 this .onlyPrivate = onlyPrivate ;
66- this .user = user ;
6769 }
6870
6971 /**
@@ -72,10 +74,6 @@ public AccessLevel(@Nonnull EnumSet<Permission> requiredPermissions, boolean onl
7274 * @return
7375 */
7476 public boolean check (@ Nonnull CommandEvent event ) {
75- // Check user
76- if (user != 0 )
77- return user == event .getAuthor ().getIdLong ();
78-
7977 // If in a guild
8078 if (event .isFromType (ChannelType .TEXT )) {
8179 // Only private, eliminatory
0 commit comments