mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-28 13:15:31 +01:00
125 lines
4.4 KiB
Diff
125 lines
4.4 KiB
Diff
From b8a481fec8d1606361e8aa557ae22d32dd0a486a Mon Sep 17 00:00:00 2001
|
|
From: Techcable <Techcable@techcable.net>
|
|
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 edd82c1..b30541b 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 0000000..12c5859
|
|
--- /dev/null
|
|
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
|
@@ -0,0 +1,18 @@
|
|
+package io.github.waterfallmc.waterfall.conf;
|
|
+
|
|
+import lombok.*;
|
|
+
|
|
+import java.io.File;
|
|
+
|
|
+import net.md_5.bungee.conf.Configuration;
|
|
+import net.md_5.bungee.conf.YamlConfig;
|
|
+
|
|
+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
|
|
+ }
|
|
+}
|
|
\ No newline at end of file
|
|
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 5b01030..7bb0862 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;
|
|
@@ -103,7 +104,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 25d87d9..81dd4af 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 82ff91a..4ec9782 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
|
|
@@ -42,10 +42,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
|
|
{
|
|
file.createNewFile();
|
|
@@ -75,6 +85,7 @@ public class YamlConfig implements ConfigurationAdapter
|
|
throw new RuntimeException( "Could not load configuration!", ex );
|
|
}
|
|
|
|
+ if (!doPermissions) return;
|
|
Map<String, Object> permissions = get( "permissions", new HashMap<String, Object>() );
|
|
if ( permissions.isEmpty() )
|
|
{
|
|
--
|
|
2.7.4 (Apple Git-66)
|
|
|