Reverted Store-last-known-dimension-and-don-t-send-useless-re patch. This patch needs additional work before it is ready for general usage. There are multiple issues with client first connection and client kicks.

This commit is contained in:
Troy Frew 2016-07-16 20:45:23 -04:00
parent 39763df6a6
commit 1056d858fa
5 changed files with 19 additions and 150 deletions

View File

@ -1,4 +1,4 @@
From 26debc4163d31315a6083bb2fcc62f45333d8edc Mon Sep 17 00:00:00 2001
From 80a0bf1992f1ad7e080692ba323a784c3aee3fd3 Mon Sep 17 00:00:00 2001
From: Troy Frew <fuzzy_bot@arenaga.me>
Date: Tue, 28 Jun 2016 23:00:49 -0500
Subject: [PATCH] Improve ServerKickEvent
@ -62,10 +62,10 @@ index 0e1ef5c..ee63732 100644
@Deprecated
public String getKickReason()
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
index f1ccd72..beb8fa6 100644
index e327325..d16fa57 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -305,7 +305,7 @@ public class ServerConnector extends PacketHandler
@@ -302,7 +302,7 @@ public class ServerConnector extends PacketHandler
public void handle(Kick kick) throws Exception
{
ServerInfo def = user.updateAndGetNextServer( target );
@ -75,10 +75,10 @@ index f1ccd72..beb8fa6 100644
{
// Pre cancel the event if we are going to try another server
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 017c2b2..8ce578e 100644
index fa57f28..6463f75 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -59,16 +59,19 @@ public class DownstreamBridge extends PacketHandler
@@ -58,16 +58,19 @@ public class DownstreamBridge extends PacketHandler
return;
}
@ -104,7 +104,7 @@ index 017c2b2..8ce578e 100644
}
@Override
@@ -83,7 +86,19 @@ public class DownstreamBridge extends PacketHandler
@@ -82,7 +85,19 @@ public class DownstreamBridge extends PacketHandler
if ( !server.isObsolete() )
{
@ -125,7 +125,7 @@ index 017c2b2..8ce578e 100644
}
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
@@ -454,7 +469,7 @@ public class DownstreamBridge extends PacketHandler
@@ -453,7 +468,7 @@ public class DownstreamBridge extends PacketHandler
{
def = null;
}
@ -135,5 +135,5 @@ index 017c2b2..8ce578e 100644
{
con.connectNow( event.getCancelServer() );
--
2.9.0
2.7.4 (Apple Git-66)

View File

@ -1,130 +0,0 @@
From 0619f444be30213382fa501bcc12bc5dc68f58bc Mon Sep 17 00:00:00 2001
From: PunKeel <punkeel@me.com>
Date: Wed, 8 Apr 2015 22:36:33 +0200
Subject: [PATCH] Store last known dimension and don't send useless respawn
packets
In order to improve server switching without lossing the advantages of the Respawn package (reset entities, for instance)
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
index e327325..f1ccd72 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -257,7 +257,10 @@ public class ServerConnector extends PacketHandler
}
user.getSentBossBars().clear();
- user.sendDimensionSwitch();
+ if( user.getDimension() == login.getDimension() ){
+ // Only change dimension to reset entities
+ 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() ) );
@@ -280,7 +283,7 @@ public class ServerConnector extends PacketHandler
target.addPlayer( user );
user.getPendingConnects().remove( target );
user.setServerJoinQueue( null );
- user.setDimensionChange( false );
+ user.setDimension( login.getDimension() );
user.setServer( server );
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user, server ) );
@@ -316,14 +319,7 @@ public class ServerConnector extends PacketHandler
throw CancelSendSignal.INSTANCE;
}
- String message = bungee.getTranslation( "connect_kick", target.getName(), event.getKickReason() );
- if ( user.isDimensionChange() )
- {
- user.disconnect( message );
- } else
- {
- user.sendMessage( message );
- }
+ user.sendMessage( bungee.getTranslation( "connect_kick", target.getName(), event.getKickReason() ) );
throw CancelSendSignal.INSTANCE;
}
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
index 9a13f5c..ff103bf 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -89,7 +89,7 @@ public final class UserConnection implements ProxiedPlayer
private ServerConnection server;
@Getter
@Setter
- private boolean dimensionChange = true;
+ private int dimension = 0;
@Getter
private final Collection<ServerInfo> pendingConnects = new HashSet<>();
/*========================================================================*/
@@ -187,7 +187,7 @@ public final class UserConnection implements ProxiedPlayer
// No-config FML handshake marker.
// Set whether the connection has a 1.8 FML marker in the handshake.
- if (this.getPendingConnection().getExtraDataInHandshake().contains( ForgeConstants.FML_HANDSHAKE_TOKEN ))
+ if (this.getPendingConnection().getExtraDataInHandshake().contains( ForgeConstants.FML_HANDSHAKE_TOKEN ))
{
forgeClientHandler.setFmlTokenInHandshake( true );
}
@@ -223,16 +223,8 @@ public final class UserConnection implements ProxiedPlayer
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 );
}
@@ -328,12 +320,9 @@ public final class UserConnection implements ProxiedPlayer
{
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
connect( def, null, false );
- } else if ( dimensionChange )
- {
- disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
} else
{
- sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
+ disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
}
}
}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index fa57f28..017c2b2 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -37,6 +37,7 @@ import net.md_5.bungee.protocol.packet.ScoreboardScore;
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
import net.md_5.bungee.protocol.packet.PluginMessage;
import net.md_5.bungee.protocol.packet.Kick;
+import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.SetCompression;
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
import net.md_5.bungee.tab.TabList;
@@ -501,6 +502,12 @@ public class DownstreamBridge extends PacketHandler
}
@Override
+ public void handle(Respawn respawn) throws Exception
+ {
+ con.setDimension( respawn.getDimension() );
+ }
+
+ @Override
public String toString()
{
return "[" + con.getAddress() + "|" + con.getName() + "] <-> DownstreamBridge <-> [" + server.getInfo().getName() + "]";
--
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 1bd07f8815ec9d4435b66a2fe8ad5489c7491fb7 Mon Sep 17 00:00:00 2001
From 6d435eb0afdd47cf90abb505cf4bf0a943ec73bd Mon Sep 17 00:00:00 2001
From: Troy Frew <fuzzy_bot@arenaga.me>
Date: Wed, 29 Jun 2016 13:56:57 -0500
Subject: [PATCH] Configurable server version in ping response
@ -21,7 +21,7 @@ index f04e2bf..a443614 100644
/**
diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
index 114961d..7c84fea 100644
index 114961d..32f7b99 100644
--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
@@ -5,8 +5,11 @@ import lombok.*;

View File

@ -1,6 +1,6 @@
From 146a4a7ade1125df18f4d3ff7f2575822e1c0c44 Mon Sep 17 00:00:00 2001
From 062766d296509d5a201d6c0815eb0a608698a712 Mon Sep 17 00:00:00 2001
From: Ichbinjoe <joe@ibj.io>
Date: Sun, 3 Jul 2016 03:54:14 -0400
Date: Sat, 16 Jul 2016 20:44:01 -0400
Subject: [PATCH] Add timeout variant to connect methods
Also added more connect methods to ProxiedPlayer, in addition to the new method
@ -49,33 +49,32 @@ index 375815c..c49e900 100644
* Gets the server this player is connected to.
*
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
index ff103bf..47b37c0 100644
index 9a13f5c..fead216 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -251,6 +251,13 @@ public final class UserConnection implements ProxiedPlayer
@@ -259,6 +259,12 @@ public final class UserConnection implements ProxiedPlayer
public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry)
{
+ // Waterfall start
+ connect(info, callback, retry, 5000); // todo: configurable
+ }
+
+ public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, final int timeout)
+ {
+ // Waterfall end
Preconditions.checkNotNull( info, "info" );
ServerConnectEvent event = new ServerConnectEvent( this, info );
@@ -319,7 +326,7 @@ public final class UserConnection implements ProxiedPlayer
@@ -327,7 +333,7 @@ public final class UserConnection implements ProxiedPlayer
if ( retry && def != null && ( getServer() == null || def != getServer().getInfo() ) )
{
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
- connect( def, null, false );
+ connect( def, null, false, timeout ); // Waterfall
} else
} else if ( dimensionChange )
{
disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
@@ -331,7 +338,7 @@ public final class UserConnection implements ProxiedPlayer
@@ -342,7 +348,7 @@ public final class UserConnection implements ProxiedPlayer
.channel( PipelineUtils.getChannel() )
.group( ch.getHandle().eventLoop() )
.handler( initializer )
@ -85,5 +84,5 @@ index ff103bf..47b37c0 100644
// Windows is bugged, multi homed users will just have to live with random connecting IPs
if ( getPendingConnection().getListener().isSetLocalAddress() && !PlatformDependent.isWindows() )
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 2df0089bfe96dcd1abf5a192a4f21b025867bfa8 Mon Sep 17 00:00:00 2001
From 81f57993d2aa0f7595a469c3eaa33cbaf32e3b79 Mon Sep 17 00:00:00 2001
From: minecrafter <unknown@unknown>
Date: Sun, 3 Jul 2016 04:03:21 -0400
Subject: [PATCH] Proxy query event