From b1daa760c06c5e706ae3bc34a67b2f646ed6b047 Mon Sep 17 00:00:00 2001 From: Techcable Date: Tue, 25 Oct 2016 11:58:37 -0400 Subject: [PATCH] Add Waterfall configuration files diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java index edd82c1e..b30541be 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java +++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java @@ -79,4 +79,9 @@ public interface ProxyConfig * The favicon used for the server ping list. */ Favicon getFaviconObject(); + + // + // Waterfall Options + // + } diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java new file mode 100644 index 00000000..741ebfde --- /dev/null +++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java @@ -0,0 +1,17 @@ +package io.github.waterfallmc.waterfall.conf; + +import net.md_5.bungee.conf.Configuration; +import net.md_5.bungee.conf.YamlConfig; + +import java.io.File; + +public class WaterfallConfiguration extends Configuration { + + @Override + public void load() { + super.load(); + YamlConfig config = new YamlConfig(new File("waterfall.yml")); + config.load(false); // Load, but no permissions + } + +} diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 71f30980..084bc11e 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -11,6 +11,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import io.github.waterfallmc.waterfall.conf.WaterfallConfiguration; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelException; @@ -110,7 +111,7 @@ public class BungeeCord extends ProxyServer * Configuration. */ @Getter - public final Configuration config = new Configuration(); + public final Configuration config = new WaterfallConfiguration(); /** * Localization bundle. */ diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java index 1ee82eec..6c722e8b 100644 --- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java +++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java @@ -24,7 +24,7 @@ import net.md_5.bungee.util.CaseInsensitiveSet; * Core configuration for the proxy. */ @Getter -public class Configuration implements ProxyConfig +public abstract class Configuration implements ProxyConfig { /** diff --git a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java index 95590b6d..1019c307 100644 --- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java +++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java @@ -43,10 +43,15 @@ public class YamlConfig implements ConfigurationAdapter } private final Yaml yaml; private Map config; - private final File file = new File( "config.yml" ); + private final File file; - public YamlConfig() + public YamlConfig() { + this(new File("config.yml")); + } + + public YamlConfig(File file) { + this.file = file; DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK ); yaml = new Yaml( options ); @@ -54,6 +59,11 @@ public class YamlConfig implements ConfigurationAdapter @Override public void load() + { + load(true); + } + + public void load(boolean doPermissions) { try { @@ -82,6 +92,7 @@ public class YamlConfig implements ConfigurationAdapter throw new RuntimeException( "Could not load configuration!", ex ); } + if (!doPermissions) return; Map permissions = get( "permissions", new HashMap() ); if ( permissions.isEmpty() ) { -- 2.18.0