Don't expose the channel
This commit is contained in:
parent
5bf616dc4d
commit
a1f928b210
@ -97,18 +97,18 @@ public class ServerConnector extends PacketHandler
|
||||
login.difficulty,
|
||||
login.unused,
|
||||
(byte) user.getPendingConnection().getListener().getTabListSize() );
|
||||
user.ch.write( modLogin );
|
||||
user.sendPacket( modLogin );
|
||||
} else
|
||||
{
|
||||
bungee.getTabListHandler().onServerChange( user );
|
||||
|
||||
for ( Objective objective : user.serverSentScoreboard.getObjectives() )
|
||||
{
|
||||
user.ch.write( new PacketCEScoreboardObjective( objective.getName(), objective.getValue(), (byte) 1 ) );
|
||||
user.sendPacket( new PacketCEScoreboardObjective( objective.getName(), objective.getValue(), (byte) 1 ) );
|
||||
}
|
||||
for ( Team team : user.serverSentScoreboard.getTeams() )
|
||||
{
|
||||
user.ch.write( PacketD1Team.destroy( team.getName() ) );
|
||||
user.sendPacket( PacketD1Team.destroy( team.getName() ) );
|
||||
}
|
||||
user.serverSentScoreboard.clear();
|
||||
|
||||
@ -116,7 +116,7 @@ public class ServerConnector extends PacketHandler
|
||||
user.sendPacket( Packet9Respawn.DIM2_SWITCH );
|
||||
|
||||
user.serverEntityId = login.entityId;
|
||||
user.ch.write( new Packet9Respawn( login.dimension, login.difficulty, login.gameMode, (short) 256, login.levelType ) );
|
||||
user.sendPacket( new Packet9Respawn( login.dimension, login.difficulty, login.gameMode, (short) 256, login.levelType ) );
|
||||
|
||||
// Remove from old servers
|
||||
user.getServer().setObsolete( true );
|
||||
@ -124,7 +124,7 @@ public class ServerConnector extends PacketHandler
|
||||
}
|
||||
|
||||
// TODO: Fix this?
|
||||
if ( !user.ch.getHandle().isActive() )
|
||||
if ( !user.isActive() )
|
||||
{
|
||||
server.disconnect( "Quitting" );
|
||||
// Silly server admins see stack trace and die
|
||||
|
@ -18,7 +18,6 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.Synchronized;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
@ -43,7 +42,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
|
||||
/*========================================================================*/
|
||||
private final ProxyServer bungee;
|
||||
public final ChannelWrapper ch;
|
||||
private final ChannelWrapper ch;
|
||||
@Getter
|
||||
private final String name;
|
||||
@Getter
|
||||
@ -89,6 +88,17 @@ public final class UserConnection implements ProxiedPlayer
|
||||
ch.write( p );
|
||||
}
|
||||
|
||||
public void sendPacket(byte[] b)
|
||||
{
|
||||
ch.write( b );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isActive()
|
||||
{
|
||||
return ch.getHandle().isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String name)
|
||||
{
|
||||
@ -107,8 +117,8 @@ public final class UserConnection implements ProxiedPlayer
|
||||
|
||||
public void connectNow(ServerInfo target)
|
||||
{
|
||||
ch.write( Packet9Respawn.DIM1_SWITCH );
|
||||
ch.write( Packet9Respawn.DIM2_SWITCH );
|
||||
sendPacket( Packet9Respawn.DIM1_SWITCH );
|
||||
sendPacket( Packet9Respawn.DIM2_SWITCH );
|
||||
connect( target );
|
||||
}
|
||||
|
||||
@ -183,7 +193,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
if ( ch.getHandle().isActive() )
|
||||
{
|
||||
bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + reason );
|
||||
ch.write( new PacketFFKick( reason ) );
|
||||
sendPacket( new PacketFFKick( reason ) );
|
||||
ch.getHandle().close();
|
||||
if ( server != null )
|
||||
{
|
||||
@ -202,7 +212,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
ch.write( new Packet3Chat( message ) );
|
||||
sendPacket( new Packet3Chat( message ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,7 +227,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Override
|
||||
public void sendData(String channel, byte[] data)
|
||||
{
|
||||
ch.write( new PacketFAPluginMessage( channel, data ) );
|
||||
sendPacket( new PacketFAPluginMessage( channel, data ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
public void handle(byte[] buf) throws Exception
|
||||
{
|
||||
EntityMap.rewrite( buf, con.serverEntityId, con.clientEntityId );
|
||||
con.ch.write( buf );
|
||||
con.sendPacket( buf );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,12 +31,12 @@ public class UpstreamBridge extends PacketHandler
|
||||
|
||||
BungeeCord.getInstance().connections.put( con.getName(), con );
|
||||
bungee.getTabListHandler().onConnect( con );
|
||||
con.ch.write( BungeeCord.getInstance().registerChannels() );
|
||||
con.sendPacket(BungeeCord.getInstance().registerChannels() );
|
||||
|
||||
TexturePackInfo texture = con.getPendingConnection().getListener().getTexturePack();
|
||||
if ( texture != null )
|
||||
{
|
||||
con.ch.write( new PacketFAPluginMessage( "MC|TPack", ( texture.getUrl() + "\00" + texture.getSize() ).getBytes() ) );
|
||||
con.sendPacket(new PacketFAPluginMessage( "MC|TPack", ( texture.getUrl() + "\00" + texture.getSize() ).getBytes() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user