diff --git a/src/main/java/net/frozenorb/apiv3/model/User.java b/src/main/java/net/frozenorb/apiv3/model/User.java index e79158b..837c3fa 100644 --- a/src/main/java/net/frozenorb/apiv3/model/User.java +++ b/src/main/java/net/frozenorb/apiv3/model/User.java @@ -255,7 +255,6 @@ public final class User { List ranks = getRanksScoped(serverGroup, grants); result.put("user", this); - result.put("access", accessInfo); result.put("bestRank", ranks.get(0).getId()); result.put("ranks", ranks.stream().map(Rank::getId).collect(Collectors.toList())); result.put("totpSetup", getTotpSecret() != null); @@ -264,6 +263,10 @@ public final class User { result.put("mute", activeMute); } + if (accessInfo != null) { + result.put("access", accessInfo); + } + callback.onResult(result, null); }); } @@ -286,11 +289,6 @@ public final class User { } } - Map accessAllowed = ImmutableMap.of( - "allowed", true, - "message", "" - ); - if (activeBan != null) { callback.onResult(ImmutableMap.of( "allowed", false, @@ -330,15 +328,17 @@ public final class User { hasPermissionAnywhere(Permissions.BYPASS_VPN_CHECK, (bypass, error) -> { if (error != null) { callback.onResult(null, error); + } else if (bypass) { + callback.onResult(null, null); } else { - callback.onResult(bypass ? accessAllowed : finalProposedAccess, null); + callback.onResult(finalProposedAccess, null); } }); } else { - callback.onResult(accessAllowed, null); + callback.onResult(null, null); } } else { - callback.onResult(accessAllowed, null); + callback.onResult(null, null); } }