Server player concurrency fix
Fixes an issue where the server can move a player while the player is moving, process the player's last move (putting the player back where they were before the teleport), and then complain about the player moving too fast when the client catches up to it's new position. Also fixes this issue while riding an entity. Only affects player client/server movement sync.
This commit is contained in:
parent
e53595f1f5
commit
a50abc514f
1 changed files with 51 additions and 7 deletions
|
@ -11,7 +11,39 @@
|
|||
|
||||
public class NetServerHandler extends NetHandler
|
||||
{
|
||||
@@ -310,7 +314,7 @@
|
||||
@@ -193,6 +197,11 @@
|
||||
if (this.playerEntity.ridingEntity != null)
|
||||
{
|
||||
this.playerEntity.ridingEntity.updateRiderPosition();
|
||||
+ }
|
||||
+
|
||||
+ if (!this.hasMoved) //Fixes teleportation kick while riding entities
|
||||
+ {
|
||||
+ return;
|
||||
}
|
||||
|
||||
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
@@ -285,6 +294,11 @@
|
||||
this.playerEntity.addExhaustion(0.2F);
|
||||
}
|
||||
|
||||
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
this.playerEntity.moveEntity(var13, var15, var17);
|
||||
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
||||
this.playerEntity.addMovementStat(var13, var15, var17);
|
||||
@@ -307,10 +321,15 @@
|
||||
logger.warning(this.playerEntity.username + " moved wrongly!");
|
||||
}
|
||||
|
||||
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
this.playerEntity.setPositionAndRotation(var5, var7, var9, var11, var12);
|
||||
boolean var32 = var2.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)var27, (double)var27, (double)var27)).isEmpty();
|
||||
|
||||
|
@ -20,7 +52,7 @@
|
|||
{
|
||||
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12);
|
||||
return;
|
||||
@@ -318,7 +322,7 @@
|
||||
@@ -318,7 +337,7 @@
|
||||
|
||||
AxisAlignedBB var33 = this.playerEntity.boundingBox.copy().expand((double)var27, (double)var27, (double)var27).addCoord(0.0D, -0.55D, 0.0D);
|
||||
|
||||
|
@ -29,7 +61,19 @@
|
|||
{
|
||||
if (var29 >= -0.03125D)
|
||||
{
|
||||
@@ -395,7 +399,10 @@
|
||||
@@ -337,6 +356,11 @@
|
||||
this.ticksForFloatKick = 0;
|
||||
}
|
||||
|
||||
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
||||
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
this.playerEntity.updateFlyingState(this.playerEntity.posY - var3, par1Packet10Flying.onGround);
|
||||
@@ -395,7 +419,10 @@
|
||||
double var12 = this.playerEntity.posZ - ((double)var7 + 0.5D);
|
||||
double var14 = var8 * var8 + var10 * var10 + var12 * var12;
|
||||
|
||||
|
@ -41,7 +85,7 @@
|
|||
{
|
||||
return;
|
||||
}
|
||||
@@ -417,8 +424,9 @@
|
||||
@@ -417,8 +444,9 @@
|
||||
|
||||
if (par1Packet14BlockDig.status == 0)
|
||||
{
|
||||
|
@ -53,7 +97,7 @@
|
|||
this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var5, var6, var7, var2));
|
||||
}
|
||||
else
|
||||
@@ -479,7 +487,11 @@
|
||||
@@ -479,7 +507,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,7 +110,7 @@
|
|||
}
|
||||
else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit()))
|
||||
{
|
||||
@@ -497,7 +509,9 @@
|
||||
@@ -497,7 +529,9 @@
|
||||
var12 = var11;
|
||||
}
|
||||
|
||||
|
@ -77,7 +121,7 @@
|
|||
{
|
||||
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset());
|
||||
}
|
||||
@@ -798,7 +812,7 @@
|
||||
@@ -798,7 +832,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue