diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java index 8528e51..87058ab 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/config/AuthMeConfig.java @@ -1,21 +1,24 @@ package com.glyart.authmevelocity.proxy.config; import java.util.List; +import java.util.Objects; import java.util.Set; import com.moandjiezana.toml.Toml; +import org.jetbrains.annotations.NotNull; + public final class AuthMeConfig { private final List authServers; private final ServerOnLogin serverOnLogin; private final Commands commands; private final EnsureAuthServer ensure; - public AuthMeConfig(Toml toml){ - this.authServers = toml.getList("authServers"); - this.serverOnLogin = toml.getTable("SendOnLogin").to(ServerOnLogin.class); - this.commands = toml.getTable("Commands").to(Commands.class); - this.ensure = toml.getTable("EnsureAuthServer").to(EnsureAuthServer.class); + public AuthMeConfig(@NotNull Toml toml){ + this.authServers = Objects.requireNonNull(toml.getList("authServers"), "the list of auth servers is not available, please check your configuration for any failure"); + this.serverOnLogin = Objects.requireNonNull(toml.getTable("SendOnLogin"), "SendOnLogin options are not available, check your configuration").to(ServerOnLogin.class); + this.commands = Objects.requireNonNull(toml.getTable("Commands"), "Commands options are not available, check your configuration").to(Commands.class); + this.ensure = Objects.requireNonNull(toml.getTable("EnsureAuthServer"), "EnsureAuthServer options are not available, check your configuration").to(EnsureAuthServer.class); } public static class ServerOnLogin { @@ -26,7 +29,7 @@ public final class AuthMeConfig { return this.sendToServerOnLogin; } - public List getTeleportServers(){ + public @NotNull List getTeleportServers(){ return this.teleportServers; } } @@ -35,11 +38,11 @@ public final class AuthMeConfig { private Set allowedCommands; private String blockedCommandMessage; - public Set getAllowedCommands(){ + public @NotNull Set getAllowedCommands(){ return this.allowedCommands; } - public String getBlockedMessage() { + public @NotNull String getBlockedMessage() { return this.blockedCommandMessage; } } @@ -52,25 +55,25 @@ public final class AuthMeConfig { return this.ensureFirstServerIsAuthServer; } - public String getDisconnectMessage(){ + public @NotNull String getDisconnectMessage(){ return this.disconnectMessage; } } - public Commands getCommandsConfig(){ + public @NotNull Commands getCommandsConfig(){ return this.commands; } - public ServerOnLogin getToServerOptions(){ + public @NotNull ServerOnLogin getToServerOptions(){ return this.serverOnLogin; } - public EnsureAuthServer getEnsureOptions(){ + public @NotNull EnsureAuthServer getEnsureOptions(){ return this.ensure; } - public List getAuthServers(){ + public @NotNull List getAuthServers(){ return this.authServers; } }