Validate config
This commit is contained in:
parent
e2c49f35e6
commit
c77fcbd09f
|
|
@ -37,6 +37,7 @@ import java.nio.file.Path;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
||||||
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3;
|
||||||
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
|
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
|
||||||
|
|
||||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.2.0-beta", authors = {"adde0109"})
|
@Plugin(id = "ambassador", name = "Ambassador", version = "1.2.0-beta", authors = {"adde0109"})
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,13 @@ public class AmbassadorConfig {
|
||||||
public void validate() {
|
public void validate() {
|
||||||
final int connectionTimeout = Ambassador.getInstance().server.getConfiguration().getConnectTimeout();
|
final int connectionTimeout = Ambassador.getInstance().server.getConfiguration().getConnectTimeout();
|
||||||
if (resetTimeout >= connectionTimeout) {
|
if (resetTimeout >= connectionTimeout) {
|
||||||
throw new InvalidValueException("'reset-timeout' can't be larger than nor equal to 'connection-timeout': reset-timeout=" + resetTimeout + " connection-timeout=" + connectionTimeout);
|
throw new InvalidValueException("'reset-timeout' can't be more than nor equal to 'connection-timeout': reset-timeout=" + resetTimeout + " connection-timeout=" + connectionTimeout);
|
||||||
|
}
|
||||||
|
if (resetTimeout <= 0) {
|
||||||
|
throw new InvalidValueException("'reset-timeout' can't be less than nor equal to zero: reset-timeout=" + resetTimeout);
|
||||||
|
}
|
||||||
|
if (serverSwitchCancellationTime <= 0) {
|
||||||
|
throw new InvalidValueException("'server-switch-cancellation-time' can't be less than nor equal to zero: server-switch-cancellation-time=" + serverSwitchCancellationTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user