Skip to content

Commit

Permalink
Fix #40
Browse files Browse the repository at this point in the history
  • Loading branch information
sgdc3 committed Apr 18, 2019
1 parent 39620e7 commit a0d8692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class BungeeConfigProperties implements SettingsHolder {
@Comment("List of servers which required to be authenticated")
public static final Property<List<String>> AUTH_SERVERS =
newListProperty("authServers", "lobby");
@Comment("Consider every server as an auth server")
public static final Property<Boolean> ALL_SERVERS_ARE_AUTH_SERVERS =
newProperty("allServersAreAuthServers", false);
@Comment("Allows or not commands to be performed if user is not logged in")
public static final Property<Boolean> COMMANDS_REQUIRE_AUTH =
newProperty("commands.requireAuth", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent {
private boolean isServerSwitchRequiresAuth;
private String requiresAuthKickMessage;
private List<String> authServers;
private boolean allServersAreAuthServers;
private boolean isCommandsRequireAuth;
private List<String> commandWhitelist;
private boolean chatRequiresAuth;
Expand All @@ -49,6 +50,7 @@ public void reload(final SettingsManager settings) {
for (final String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) {
authServers.add(server.toLowerCase());
}
allServersAreAuthServers = settings.getProperty(BungeeConfigProperties.ALL_SERVERS_ARE_AUTH_SERVERS);
isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH);
commandWhitelist = new ArrayList<>();
for (final String command : settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST)) {
Expand Down Expand Up @@ -127,7 +129,7 @@ public void onPlayerChat(final ChatEvent event) {
}

private boolean isAuthServer(ServerInfo serverInfo) {
return authServers.contains(serverInfo.getName().toLowerCase());
return allServersAreAuthServers || authServers.contains(serverInfo.getName().toLowerCase());
}

@EventHandler(priority = EventPriority.LOWEST)
Expand Down

0 comments on commit a0d8692

Please sign in to comment.