diff --git a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/ManagedServer.java b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/ManagedServer.java index 639d6c843..236e2b54f 100644 --- a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/ManagedServer.java +++ b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/ManagedServer.java @@ -180,17 +180,19 @@ private static String encode_favicon(String id, String favicon_path) throws IOEx } - private static class ServerStart { + public static class ServerStart { private static final int DEFAULT_TIMEOUT_SECONDS = 10; public String[] cmd; public Integer timeout; public String kick_msg; + public boolean allow_anyone; public ServerStart(String id, String display_name, CommentedConfig config) { List cmd = config.get("cmd"); var timeout = config.get("timeout"); var kick_msg = config.get("kick_msg"); + var allow_anyone = config.get("allow_anyone"); if (cmd != null) this.cmd = cmd.stream().map(s -> s.replace("{SERVER}", id)).toArray(String[]::new); else this.cmd = null; @@ -202,6 +204,10 @@ public ServerStart(String id, String display_name, CommentedConfig config) { this.kick_msg = ((String) kick_msg).replace("{SERVER}", id).replace("{SERVER_DISPLAY_NAME}", display_name); else this.kick_msg = null; + if (allow_anyone != null) + this.allow_anyone = (boolean)allow_anyone; + else this.allow_anyone = false; + if (timeout == null) { this.timeout = DEFAULT_TIMEOUT_SECONDS; return; diff --git a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/LoginEvent.java b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/LoginEvent.java index d5094ac6e..5b7aedcba 100644 --- a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/LoginEvent.java +++ b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/LoginEvent.java @@ -39,10 +39,10 @@ public final void fire() { // For use inside callback final var cms = plugin.get_config().managed_servers.get(server_info.getName()); - if (!connection.can_start_server(plugin.get_proxy(), server_info.getName())) { + if (!cms.start.allow_anyone && !connection.can_start_server(plugin.get_proxy(), server_info.getName())) { plugin.get_logger().log(Level.INFO, "Disconnecting '" + connection.get_name() + "' because they don't have the permission to start server '" + server_info.getName() + "'"); // TODO: This could probably use a configurable message? - this.cancel("Server is offline"); + this.cancel("Server is offline and you don't have the permission to start it"); return; } diff --git a/vane-velocity/build.gradle.kts b/vane-velocity/build.gradle.kts index b9e9d8bd4..2157e4735 100644 --- a/vane-velocity/build.gradle.kts +++ b/vane-velocity/build.gradle.kts @@ -4,8 +4,8 @@ plugins { dependencies { compileOnly(fileTree(mapOf("dir" to "external", "include" to listOf("*.jar")))) - implementation(group = "com.velocitypowered", name = "velocity-api", version = "3.0.1") - annotationProcessor(group = "com.velocitypowered", name = "velocity-api", version = "3.0.1") + implementation(group = "com.velocitypowered", name = "velocity-api", version = "3.1.1") + annotationProcessor(group = "com.velocitypowered", name = "velocity-api", version = "3.1.1") implementation(group = "org.bstats", name = "bstats-velocity", version = "3.0.0") implementation(group = "org.bstats", name = "bstats-base", version = "3.0.0") implementation(group = "org.json", name = "json", version = "20200518")