2023-11-04 02:12:26 +01:00
|
|
|
From 7443ac4a48f0afc87dd65b7b467cfc046d056720 Mon Sep 17 00:00:00 2001
|
2016-05-28 18:34:39 +02:00
|
|
|
From: Techcable <Techcable@techcable.net>
|
2016-10-25 18:57:11 +02:00
|
|
|
Date: Tue, 25 Oct 2016 11:58:37 -0400
|
2016-05-28 18:34:39 +02:00
|
|
|
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
|
2020-02-01 16:39:53 +01:00
|
|
|
index 2e41b4c4..6495e7f2 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
|
|
|
+++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
2020-02-01 16:39:53 +01:00
|
|
|
@@ -125,4 +125,9 @@ public interface ProxyConfig
|
2020-01-06 20:43:23 +01:00
|
|
|
* @return favicon
|
2016-05-28 18:34:39 +02:00
|
|
|
*/
|
|
|
|
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
|
2018-07-22 18:40:31 +02:00
|
|
|
index 00000000..741ebfde
|
2016-05-28 18:34:39 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
2018-07-22 18:40:31 +02:00
|
|
|
@@ -0,0 +1,17 @@
|
2016-05-28 18:34:39 +02:00
|
|
|
+package io.github.waterfallmc.waterfall.conf;
|
|
|
|
+
|
|
|
|
+import net.md_5.bungee.conf.Configuration;
|
|
|
|
+import net.md_5.bungee.conf.YamlConfig;
|
|
|
|
+
|
2018-07-22 18:40:31 +02:00
|
|
|
+import java.io.File;
|
|
|
|
+
|
2016-05-28 18:34:39 +02:00
|
|
|
+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
|
|
|
|
+ }
|
2018-07-22 18:40:31 +02:00
|
|
|
+
|
2016-05-28 18:34:39 +02:00
|
|
|
+}
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
2023-11-04 02:12:26 +01:00
|
|
|
index db2a1b99..3429c989 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
2023-11-04 02:12:26 +01:00
|
|
|
@@ -9,6 +9,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
2016-05-28 18:34:39 +02:00
|
|
|
import com.google.gson.Gson;
|
2016-10-25 18:57:11 +02:00
|
|
|
import com.google.gson.GsonBuilder;
|
2016-05-28 18:34:39 +02:00
|
|
|
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;
|
2022-11-14 20:14:25 +01:00
|
|
|
@@ -114,7 +115,7 @@ public class BungeeCord extends ProxyServer
|
2016-05-28 18:34:39 +02:00
|
|
|
* Configuration.
|
|
|
|
*/
|
|
|
|
@Getter
|
|
|
|
- public final Configuration config = new Configuration();
|
|
|
|
+ public final Configuration config = new WaterfallConfiguration();
|
|
|
|
/**
|
2022-11-14 20:14:25 +01:00
|
|
|
* Localization formats.
|
2016-05-28 18:34:39 +02:00
|
|
|
*/
|
|
|
|
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
|
2022-11-14 20:14:25 +01:00
|
|
|
index 54c3223c..54a6cb38 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- 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
|
2023-11-04 02:12:26 +01:00
|
|
|
index b9e99d6c..f6b5e8b8 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
|
2020-03-07 23:50:46 +01:00
|
|
|
@@ -47,10 +47,15 @@ public class YamlConfig implements ConfigurationAdapter
|
2016-05-28 18:34:39 +02:00
|
|
|
}
|
|
|
|
private final Yaml yaml;
|
2017-10-28 21:51:33 +02:00
|
|
|
private Map<String, Object> config;
|
2016-05-28 18:34:39 +02:00
|
|
|
- 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 );
|
2020-03-07 23:50:46 +01:00
|
|
|
@@ -58,6 +63,11 @@ public class YamlConfig implements ConfigurationAdapter
|
2018-07-22 18:40:31 +02:00
|
|
|
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public void load()
|
2018-07-22 18:40:31 +02:00
|
|
|
+ {
|
2016-05-28 18:34:39 +02:00
|
|
|
+ load(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void load(boolean doPermissions)
|
2018-07-22 18:40:31 +02:00
|
|
|
{
|
2016-05-28 18:34:39 +02:00
|
|
|
try
|
|
|
|
{
|
2020-03-07 23:50:46 +01:00
|
|
|
@@ -86,6 +96,7 @@ public class YamlConfig implements ConfigurationAdapter
|
2018-12-21 16:43:20 +01:00
|
|
|
throw new RuntimeException( "Could not load configuration!", ex );
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if(!doPermissions) return; // Waterfall
|
|
|
|
Map<String, Object> permissions = get( "permissions", null );
|
|
|
|
if ( permissions == null )
|
|
|
|
{
|
2016-05-28 18:34:39 +02:00
|
|
|
--
|
2023-11-04 02:12:26 +01:00
|
|
|
2.42.1
|
2016-05-28 18:34:39 +02:00
|
|
|
|