parent
7279ed7f9d
commit
bf8db139ff
@ -15,9 +15,9 @@ public final class AuthMeConfig {
|
||||
|
||||
public AuthMeConfig(@NotNull Toml toml){
|
||||
this.authServers = toml.getList("authServers", List.of("auth1", "auth2"));
|
||||
this.serverOnLogin = ConfigUtils.getOrElse(toml, "SendOnLogin", () -> new ServerOnLogin(false, List.of("lobby1", "lobby2")));
|
||||
this.commands = ConfigUtils.getOrElse(toml, "Commands", () -> new Commands(Set.of("login", "register", "l", "reg", "email", "captcha"),"<red>You cannot execute commands if you are not logged in yet"));
|
||||
this.ensure = ConfigUtils.getOrElse(toml, "EnsureAuthServer", () -> new EnsureAuthServer(false, "<red>You could not connect to a login server, please try again later"));
|
||||
this.serverOnLogin = ConfigUtils.getOrElse(toml, "SendOnLogin", new ServerOnLogin(false, List.of("lobby1", "lobby2")));
|
||||
this.commands = ConfigUtils.getOrElse(toml, "Commands", new Commands(Set.of("login", "register", "l", "reg", "email", "captcha"),"<red>You cannot execute commands if you are not logged in yet"));
|
||||
this.ensure = ConfigUtils.getOrElse(toml, "EnsureAuthServer", new EnsureAuthServer(false, "<red>You could not connect to a login server, please try again later"));
|
||||
}
|
||||
|
||||
public static class ServerOnLogin {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.glyart.authmevelocity.proxy.config;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.moandjiezana.toml.Toml;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
@ -18,9 +16,9 @@ public final class ConfigUtils {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static <T>T getOrElse(Toml config, String key, Supplier<T> defaultValue){
|
||||
static <T>T getOrElse(Toml config, String key, T defaultValue){
|
||||
Toml configTable = config.getTable(key);
|
||||
return configTable == null ? defaultValue.get() : (T)configTable.to(defaultValue.getClass());
|
||||
return configTable == null ? defaultValue : (T)configTable.to(defaultValue.getClass());
|
||||
}
|
||||
private ConfigUtils(){}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user