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 fd71b8cd..30065b6b 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -121,7 +121,6 @@ public class BungeeCord extends ProxyServer public final Gson gson = new Gson(); @Getter private ConnectionThrottle connectionThrottle; - public String favicon; { @@ -187,13 +186,6 @@ public class BungeeCord extends ProxyServer } isRunning = true; - File fav = new File( "server-icon.png" ); - if ( fav.exists() ) - { - - favicon = "data:image/png;base64," + BaseEncoding.base64().encode( Files.toByteArray( fav ) ); - } - pluginManager.loadAndEnablePlugins(); connectionThrottle = new ConnectionThrottle( config.getThrottle() ); diff --git a/proxy/src/main/java/net/md_5/bungee/config/Configuration.java b/proxy/src/main/java/net/md_5/bungee/config/Configuration.java index df744d58..c8c9ed85 100644 --- a/proxy/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/proxy/src/main/java/net/md_5/bungee/config/Configuration.java @@ -1,11 +1,16 @@ package net.md_5.bungee.config; import com.google.common.base.Preconditions; +import com.google.common.io.BaseEncoding; +import com.google.common.io.Files; import gnu.trove.map.TMap; +import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.UUID; +import java.util.logging.Level; import lombok.Getter; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ConfigurationAdapter; @@ -45,19 +50,33 @@ public class Configuration private Collection disabledCommands; private int throttle = 4000; private boolean ipFoward; + public String favicon; public void load() { ConfigurationAdapter adapter = ProxyServer.getInstance().getConfigurationAdapter(); adapter.load(); + File fav = new File( "server-icon.png" ); + if ( fav.exists() ) + { + + try + { + favicon = "data:image/png;base64," + BaseEncoding.base64().encode( Files.toByteArray( fav ) ); + } catch ( IOException ex ) + { + ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not load server icon", ex ); + } + } + listeners = adapter.getListeners(); timeout = adapter.getInt( "timeout", timeout ); uuid = adapter.getString( "stats", uuid ); onlineMode = adapter.getBoolean( "online_mode", onlineMode ); playerLimit = adapter.getInt( "player_limit", playerLimit ); throttle = adapter.getInt( "connection_throttle", throttle ); - ipFoward = adapter.getBoolean( "ip_forward", ipFoward); + ipFoward = adapter.getBoolean( "ip_forward", ipFoward ); disabledCommands = new CaseInsensitiveSet( (Collection) adapter.getList( "disabled_commands", Arrays.asList( "find" ) ) ); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index af1577bf..f740eb54 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -166,7 +166,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection pingBack.done( new ServerPing( new ServerPing.Protocol( bungee.getGameVersion(), bungee.getProtocolVersion() ), new ServerPing.Players( listener.getMaxPlayers(), bungee.getOnlineCount() ), - null, motd, BungeeCord.getInstance().favicon ), + null, motd, BungeeCord.getInstance().config.favicon), null ); }