BungeeCord can into server icon

This commit is contained in:
md_5 2013-10-23 20:44:48 +11:00
parent 07d9a56567
commit 37dc600fe0
3 changed files with 12 additions and 1 deletions

View File

@ -35,4 +35,5 @@ public class ServerPing
private int online;
}
private String description;
private String favicon;
}

View File

@ -1,6 +1,8 @@
package net.md_5.bungee;
import com.google.common.io.BaseEncoding;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import net.md_5.bungee.log.BungeeLogger;
import net.md_5.bungee.reconnect.YamlReconnectHandler;
import net.md_5.bungee.scheduler.BungeeScheduler;
@ -122,6 +124,7 @@ public class BungeeCord extends ProxyServer
public final Gson gson = new Gson();
@Getter
private ConnectionThrottle connectionThrottle;
public String favicon;
{
@ -187,6 +190,13 @@ 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() );

View File

@ -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() ),
motd ),
motd, BungeeCord.getInstance().favicon ),
null );
}