Waterfall/BungeeCord-Patches/0004-Add-Waterfall-configuration-files.patch
Shane Freeder d6688e05e6
Updated Upstream (BungeeCord)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
511017ab #3396: Update Netty version
c3e8cfac #3374, #3389: Improve log handling of normal java.util Logger usage by forwarding the LogRecords directly to the BungeeLogger instead of the fallback err stream.
bf2b3c68 #3384: Update documentation of ProxyPingEvent
68e74a8c #3378: Remove KickStringWriter from the pipeline after handshake arrives
5b4a5404 #3361: Cache MessageFormats for translations
88da5c05 #3353: Update GitHub actions
2022-11-14 19:14:25 +00:00

123 lines
4.3 KiB
Diff

From ece5cfccb9506cc13bb552613cc9424afff3ae51 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 2e41b4c4..6495e7f2 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
@@ -125,4 +125,9 @@ public interface ProxyConfig
* @return favicon
*/
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 e3065f12..f1ddb4d0 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -10,6 +10,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;
@@ -114,7 +115,7 @@ public class BungeeCord extends ProxyServer
* Configuration.
*/
@Getter
- public final Configuration config = new Configuration();
+ public final Configuration config = new WaterfallConfiguration();
/**
* Localization formats.
*/
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 54c3223c..54a6cb38 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 8ae799c1..0dd69778 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
@@ -47,10 +47,15 @@ public class YamlConfig implements ConfigurationAdapter
}
private final Yaml yaml;
private Map<String, Object> 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 );
@@ -58,6 +63,11 @@ public class YamlConfig implements ConfigurationAdapter
@Override
public void load()
+ {
+ load(true);
+ }
+
+ public void load(boolean doPermissions)
{
try
{
@@ -86,6 +96,7 @@ public class YamlConfig implements ConfigurationAdapter
throw new RuntimeException( "Could not load configuration!", ex );
}
+ if(!doPermissions) return; // Waterfall
Map<String, Object> permissions = get( "permissions", null );
if ( permissions == null )
{
--
2.38.1