Add feature #208 - Bungee texture packs.
This commit is contained in:
parent
87fcef0658
commit
dfa47f740d
@ -42,4 +42,9 @@ public class ListenerInfo
|
||||
* transferred depending on the host they connect to.
|
||||
*/
|
||||
private final Map<String, String> forcedHosts;
|
||||
/**
|
||||
* Get the texture pack used for servers connected to this proxy. May be
|
||||
* null.
|
||||
*/
|
||||
private final TexturePackInfo texturePack;
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TexturePackInfo
|
||||
{
|
||||
|
||||
/**
|
||||
* The URL of the texture pack.
|
||||
*/
|
||||
private final String url;
|
||||
/**
|
||||
* The square dimension of this texture pack.
|
||||
*/
|
||||
private final int size;
|
||||
}
|
@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.config.TexturePackInfo;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.scoreboard.Objective;
|
||||
import net.md_5.bungee.api.scoreboard.Score;
|
||||
@ -19,6 +20,7 @@ import net.md_5.bungee.packet.Packet9Respawn;
|
||||
import net.md_5.bungee.packet.PacketCDClientStatus;
|
||||
import net.md_5.bungee.packet.PacketCEScoreboardObjective;
|
||||
import net.md_5.bungee.packet.PacketCFScoreboardScore;
|
||||
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.packet.PacketFDEncryptionRequest;
|
||||
import net.md_5.bungee.packet.PacketFFKick;
|
||||
import net.md_5.bungee.packet.PacketHandler;
|
||||
@ -90,6 +92,12 @@ public class ServerConnector extends PacketHandler
|
||||
(byte) user.getPendingConnection().getListener().getTabListSize() );
|
||||
user.ch.write( modLogin );
|
||||
ch.write( BungeeCord.getInstance().registerChannels() );
|
||||
|
||||
TexturePackInfo texture = user.getPendingConnection().getListener().getTexturePack();
|
||||
if ( texture != null )
|
||||
{
|
||||
ch.write( new PacketFAPluginMessage( "MC|TPack", ( texture.getUrl() + "\00" + texture.getSize() ).getBytes() ) );
|
||||
}
|
||||
} else
|
||||
{
|
||||
bungee.getTabListHandler().onServerChange( user );
|
||||
|
@ -20,6 +20,7 @@ import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ConfigurationAdapter;
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.config.TexturePackInfo;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
@ -185,7 +186,10 @@ public class YamlConfig implements ConfigurationAdapter
|
||||
int tabListSize = get( "tab_size", 60, val );
|
||||
InetSocketAddress address = Util.getAddr( host );
|
||||
Map<String, String> forced = get( "forced_hosts", forcedDef, val );
|
||||
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, forceDefault, forced );
|
||||
String textureURL = get( "texture_url", null, val );
|
||||
int textureSize = get( "texture_size", null, val );
|
||||
TexturePackInfo texture = ( textureURL == null ) ? null : new TexturePackInfo( textureURL, textureSize );
|
||||
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, forceDefault, forced, texture );
|
||||
ret.add( info );
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,11 @@ public class DownstreamBridge extends PacketHandler
|
||||
throw new CancelSendSignal();
|
||||
}
|
||||
|
||||
if ( pluginMessage.tag.equals( "MC|TPack" ) && con.getPendingConnection().getListener().getTexturePack() != null )
|
||||
{
|
||||
throw new CancelSendSignal();
|
||||
}
|
||||
|
||||
if ( pluginMessage.tag.equals( "BungeeCord" ) )
|
||||
{
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
Loading…
Reference in New Issue
Block a user