Template
mirror of
https://github.com/LOOHP/Limbo.git
synced 2026-10-22 12:38:55 +00:00
Flesh out allowlist handling
Addresses comments from https://github.com/LOOHP/Limbo/pull/57#issuecomment-1304543589 In particular: * Functionality now matches other server types * only enforce the allowlist if a new "enforce-allowlist" boolean in server.properties is set to true * Loads and process the allowlist only once when the server starts (or the reload command is executed), instead of every time a user connects. * Add a new command & associated permissions "allowlist reload" to reload the allowlist
This commit is contained in:
@@ -432,6 +432,31 @@ public class Limbo {
|
||||
public ServerProperties getServerProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void reloadAllowlist() {
|
||||
properties.reloadAllowlist();
|
||||
}
|
||||
|
||||
public boolean uuidIsAllowed(UUID requestedUuid) {
|
||||
if (!properties.isEnforceAllowlist()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (UUID allowedUuid : properties.getAllowlist()) {
|
||||
if (requestedUuid.equals(allowedUuid)) {
|
||||
if(!properties.isReducedDebugInfo()) {
|
||||
Limbo.getInstance().getConsole().sendMessage(String.format("allowlist: %s allowed", requestedUuid.toString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!properties.isReducedDebugInfo()) {
|
||||
Limbo.getInstance().getConsole().sendMessage(String.format("allowlist: %s not allowed", requestedUuid.toString()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ServerConnection getServerConnection() {
|
||||
return server;
|
||||
|
||||
Reference in New Issue
Block a user