Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge branch 'SpigotMC-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sleiss committed Oct 31, 2016
2 parents 9799522 + d27f8bc commit 687f4f7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
19 changes: 13 additions & 6 deletions proxy/src/main/java/net/md_5/bungee/ServerConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ public void handle(Login login) throws Exception
user.unsafe().sendPacket( new PluginMessage( "MC|Brand", DefinedPacket.toArray( brand ), handshakeHandler.isServerForge() ) );
brand.release();
}

user.setDimension( login.getDimension() );
}
else
{
Expand All @@ -231,12 +233,17 @@ public void handle(Login login) throws Exception
// Send remove bossbar packet
user.unsafe().sendPacket(new net.md_5.bungee.protocol.packet.BossBar(bossbar, 1));
user.getSentBossBars().clear();

user.sendDimensionSwitch();

user.setServerEntityId(login.getEntityId());
user.unsafe().sendPacket(new Respawn(login.getDimension(), login.getDifficulty(), login.getGameMode(), login.getLevelType()));


user.setDimensionChange( true );
if ( login.getDimension() == user.getDimension() )
{
user.unsafe().sendPacket( new Respawn( ( login.getDimension() >= 0 ? -1 : 0 ), login.getDifficulty(), login.getGameMode(), login.getLevelType() ) );
}

user.setServerEntityId( login.getEntityId() );
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), login.getLevelType() ) );
user.setDimension( login.getDimension() );

// Remove from old servers
user.getServer().disconnect("Quitting");
}
Expand Down
15 changes: 6 additions & 9 deletions proxy/src/main/java/net/md_5/bungee/UserConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PluginMessage;
import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.SetCompression;
import net.md_5.bungee.tab.ServerUnique;
import net.md_5.bungee.tab.TabList;
Expand All @@ -80,6 +81,9 @@ public final class UserConnection implements ProxiedPlayer
private ServerConnection server;
@Getter
@Setter
private int dimension;
@Getter
@Setter
private boolean dimensionChange = true;
@Getter
private final Collection<ServerInfo> pendingConnects = new HashSet<>();
Expand Down Expand Up @@ -214,17 +218,10 @@ public void connect(ServerInfo target, Callback<Boolean> callback)
connect( target, callback, false );
}

void sendDimensionSwitch()
{
dimensionChange = true;
unsafe().sendPacket( PacketConstants.DIM1_SWITCH );
unsafe().sendPacket( PacketConstants.DIM2_SWITCH );
}

public void connectNow(ServerInfo target)
{
sendDimensionSwitch();
connect( target );
dimensionChange = true;
connect(target);
}

public ServerInfo updateAndGetNextServer(ServerInfo currentTarget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.PluginMessage;
import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
import net.md_5.bungee.protocol.packet.ScoreboardScore;
Expand Down Expand Up @@ -480,6 +481,12 @@ public void handle(BossBar bossBar)
}
}

@Override
public void handle(Respawn respawn)
{
con.setDimension( respawn.getDimension() );
}

@Override
public String toString()
{
Expand Down

0 comments on commit 687f4f7

Please sign in to comment.