From aad83d787f6207c543429e83bd03c1a9652c265d Mon Sep 17 00:00:00 2001 From: hcherndon Date: Mon, 2 Dec 2013 15:17:19 +1100 Subject: [PATCH] Add methods to expose parts of the proxy internal config. This is depreceated as it is subject to breaking changes without warning. --- .../java/net/md_5/bungee/api/ProxyConfig.java | 71 +++++++++++++++++++ .../java/net/md_5/bungee/api/ProxyServer.java | 8 +++ .../main/java/net/md_5/bungee/BungeeCord.java | 1 + .../net/md_5/bungee/conf/Configuration.java | 3 +- 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 api/src/main/java/net/md_5/bungee/api/ProxyConfig.java 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 new file mode 100644 index 00000000..485422f8 --- /dev/null +++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java @@ -0,0 +1,71 @@ +package net.md_5.bungee.api; + +import net.md_5.bungee.api.config.ListenerInfo; +import net.md_5.bungee.api.config.ServerInfo; + +import java.util.Collection; +import java.util.Map; + +/** + * Core configuration adaptor for the proxy api. + * + * @deprecated This class is subject to rapid change between releases + */ +@Deprecated +public interface ProxyConfig +{ + + /** + * Time before users are disconnected due to no network activity. + */ + int getTimeout(); + + /** + * UUID used for metrics. + */ + String getUuid(); + + /** + * Set of all listeners. + */ + Collection getListeners(); + + /** + * Set of all servers. + */ + Map getServers(); + + /** + * Does the server authenticate with mojang + */ + boolean isOnlineMode(); + + /** + * Returns the player max. + */ + int getPlayerLimit(); + + /** + * A collection of disabled commands. + */ + Collection getDisabledCommands(); + + /** + * The connection throttle delay. + */ + @Deprecated + int getThrottle(); + + /** + * Whether the proxy will parse IPs with spigot or not + */ + @Deprecated + boolean isIpFoward(); + + /** + * The path for the Favicon (I.e. server_icon.png) Should be no more or no + * less than a 64 by 64 Pixel PNG picture. + */ + @Deprecated + String getFavicon(); +} diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java index b4894ab4..65d20404 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java +++ b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java @@ -247,4 +247,12 @@ public abstract class ProxyServer * @return the set of disabled commands */ public abstract Collection getDisabledCommands(); + + /** + * Gets BungeeCord's core config. + * + * @return the config. + */ + public abstract ProxyConfig getConfig(); + } 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 b30fdef1..3d4db710 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -76,6 +76,7 @@ public class BungeeCord extends ProxyServer /** * Configuration. */ + @Getter public final Configuration config = new Configuration(); /** * 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 57da0ba0..854042b8 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 @@ -12,6 +12,7 @@ import java.util.Map; import java.util.UUID; import java.util.logging.Level; import lombok.Getter; +import net.md_5.bungee.api.ProxyConfig; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ConfigurationAdapter; import net.md_5.bungee.api.config.ListenerInfo; @@ -23,7 +24,7 @@ import net.md_5.bungee.util.CaseInsensitiveSet; * Core configuration for the proxy. */ @Getter -public class Configuration +public class Configuration implements ProxyConfig { /**