@@ -8,7 +8,7 @@
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
@@ -18,6 +17,49 @@
|
||||
@@ -17,6 +16,49 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -28,7 +70,10 @@
|
||||
@@ -27,7 +69,10 @@
|
||||
private int f;
|
||||
private long g;
|
||||
private long h;
|
||||
@@ -70,7 +70,7 @@
|
||||
private int j;
|
||||
private final IntHashMap<Short> k = new IntHashMap();
|
||||
private double l;
|
||||
@@ -53,6 +98,7 @@
|
||||
@@ -52,6 +97,7 @@
|
||||
private int E;
|
||||
private int F;
|
||||
private int G;
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||
this.minecraftServer = minecraftserver;
|
||||
@@ -60,7 +106,32 @@
|
||||
@@ -59,7 +105,32 @@
|
||||
networkmanager.setPacketListener(this);
|
||||
this.player = entityplayer;
|
||||
entityplayer.playerConnection = this;
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
public void c() {
|
||||
this.d();
|
||||
@@ -112,15 +183,21 @@
|
||||
@@ -111,15 +182,21 @@
|
||||
}
|
||||
|
||||
this.minecraftServer.methodProfiler.b();
|
||||
@@ -133,7 +133,7 @@
|
||||
this.disconnect("You have been idle for too long!");
|
||||
}
|
||||
|
||||
@@ -140,19 +217,37 @@
|
||||
@@ -139,19 +216,37 @@
|
||||
}
|
||||
|
||||
public void disconnect(String s) {
|
||||
@@ -174,7 +174,7 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
|
||||
@@ -191,7 +286,34 @@
|
||||
@@ -190,7 +285,34 @@
|
||||
double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ;
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved too quickly! " + d6 + "," + d7 + "," + d8);
|
||||
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -229,6 +351,62 @@
|
||||
@@ -228,6 +350,62 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
this.minecraftServer.getPlayerList().d(this.player);
|
||||
this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2);
|
||||
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.d(entity.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
|
||||
@@ -263,7 +441,7 @@
|
||||
@@ -262,7 +440,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
if (this.e == 0) {
|
||||
this.d();
|
||||
}
|
||||
@@ -273,13 +451,21 @@
|
||||
@@ -272,13 +450,21 @@
|
||||
this.A = this.e;
|
||||
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
|
||||
}
|
||||
@@ -305,7 +305,7 @@
|
||||
double d0 = this.player.locX;
|
||||
double d1 = this.player.locY;
|
||||
double d2 = this.player.locZ;
|
||||
@@ -298,15 +484,33 @@
|
||||
@@ -297,15 +483,33 @@
|
||||
++this.F;
|
||||
int i = this.F - this.G;
|
||||
|
||||
@@ -332,8 +332,8 @@
|
||||
+ speed = player.abilities.walkSpeed * 10f;
|
||||
+ }
|
||||
+
|
||||
if (!this.player.K() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cB())) {
|
||||
float f2 = this.player.cB() ? 300.0F : 100.0F;
|
||||
if (!this.player.K() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cC())) {
|
||||
float f2 = this.player.cC() ? 300.0F : 100.0F;
|
||||
|
||||
- if (d11 - d10 > (double) (f2 * (float) i) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) {
|
||||
+ if (d11 - d10 > Math.max(100, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) {
|
||||
@@ -341,7 +341,7 @@
|
||||
PlayerConnection.LOGGER.warn(this.player.getName() + " moved too quickly! " + d7 + "," + d8 + "," + d9);
|
||||
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
|
||||
return;
|
||||
@@ -352,6 +556,69 @@
|
||||
@@ -351,6 +555,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,8 +410,8 @@
|
||||
+
|
||||
this.B = d12 >= -0.03125D;
|
||||
this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly;
|
||||
this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cB() && !worldserver.d(this.player.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
|
||||
@@ -368,15 +635,79 @@
|
||||
this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cC() && !worldserver.d(this.player.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
|
||||
@@ -367,15 +634,79 @@
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
@@ -496,7 +496,7 @@
|
||||
float f2 = f;
|
||||
float f3 = f1;
|
||||
|
||||
@@ -388,6 +719,14 @@
|
||||
@@ -387,6 +718,14 @@
|
||||
f3 = f1 + this.player.pitch;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
if (++this.teleportAwait == Integer.MAX_VALUE) {
|
||||
this.teleportAwait = 0;
|
||||
}
|
||||
@@ -399,37 +738,61 @@
|
||||
@@ -398,37 +737,61 @@
|
||||
|
||||
public void a(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x());
|
||||
@@ -579,7 +579,7 @@
|
||||
this.player.clearActiveItem();
|
||||
itemstack = this.player.getItemInMainHand();
|
||||
if (itemstack != null && itemstack.count == 0) {
|
||||
@@ -438,9 +801,9 @@
|
||||
@@ -437,9 +800,9 @@
|
||||
|
||||
return;
|
||||
|
||||
@@ -592,7 +592,7 @@
|
||||
double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
|
||||
double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
|
||||
double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D);
|
||||
@@ -455,7 +818,15 @@
|
||||
@@ -454,7 +817,15 @@
|
||||
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b());
|
||||
} else {
|
||||
@@ -608,7 +608,7 @@
|
||||
}
|
||||
} else {
|
||||
if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
|
||||
@@ -475,10 +846,12 @@
|
||||
@@ -474,10 +845,12 @@
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid player action");
|
||||
}
|
||||
@@ -621,7 +621,7 @@
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
EnumHand enumhand = packetplayinuseitem.c();
|
||||
ItemStack itemstack = this.player.b(enumhand);
|
||||
@@ -492,6 +865,13 @@
|
||||
@@ -491,6 +864,13 @@
|
||||
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage));
|
||||
} else if (this.teleportPos == null && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||
@@ -635,7 +635,7 @@
|
||||
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f());
|
||||
}
|
||||
|
||||
@@ -507,19 +887,55 @@
|
||||
@@ -506,19 +886,55 @@
|
||||
|
||||
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x());
|
||||
@@ -696,7 +696,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,8 +946,8 @@
|
||||
@@ -529,8 +945,8 @@
|
||||
WorldServer[] aworldserver = this.minecraftServer.worldServer;
|
||||
int i = aworldserver.length;
|
||||
|
||||
@@ -707,7 +707,7 @@
|
||||
|
||||
if (worldserver != null) {
|
||||
entity = packetplayinspectate.a(worldserver);
|
||||
@@ -544,6 +960,8 @@
|
||||
@@ -543,6 +959,8 @@
|
||||
if (entity != null) {
|
||||
this.player.setSpectatorTarget(this.player);
|
||||
this.player.stopRiding();
|
||||
@@ -716,7 +716,7 @@
|
||||
if (entity.world != this.player.world) {
|
||||
WorldServer worldserver1 = this.player.x();
|
||||
WorldServer worldserver2 = (WorldServer) entity.world;
|
||||
@@ -569,12 +987,19 @@
|
||||
@@ -568,12 +986,19 @@
|
||||
} else {
|
||||
this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ);
|
||||
}
|
||||
@@ -737,7 +737,7 @@
|
||||
|
||||
public void a(PacketPlayInBoatMove packetplayinboatmove) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x());
|
||||
@@ -587,14 +1012,29 @@
|
||||
@@ -586,14 +1011,29 @@
|
||||
}
|
||||
|
||||
public void a(IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -769,7 +769,7 @@
|
||||
if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
this.minecraftServer.safeShutdown();
|
||||
@@ -616,6 +1056,15 @@
|
||||
@@ -615,6 +1055,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +785,7 @@
|
||||
try {
|
||||
this.networkManager.sendPacket(packet);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -637,17 +1086,32 @@
|
||||
@@ -636,17 +1085,32 @@
|
||||
|
||||
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x());
|
||||
@@ -820,7 +820,7 @@
|
||||
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
|
||||
|
||||
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
|
||||
@@ -660,39 +1124,249 @@
|
||||
@@ -659,39 +1123,249 @@
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||
@@ -1078,7 +1078,7 @@
|
||||
this.player.resetIdleTimer();
|
||||
IJumpable ijumpable;
|
||||
|
||||
@@ -762,6 +1436,7 @@
|
||||
@@ -761,6 +1435,7 @@
|
||||
|
||||
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x());
|
||||
@@ -1086,7 +1086,7 @@
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||
|
||||
@@ -778,22 +1453,72 @@
|
||||
@@ -777,22 +1452,72 @@
|
||||
EnumHand enumhand;
|
||||
ItemStack itemstack;
|
||||
|
||||
@@ -1160,7 +1160,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -809,7 +1534,8 @@
|
||||
@@ -808,7 +1533,8 @@
|
||||
case 1:
|
||||
if (this.player.viewingCredits) {
|
||||
this.player.viewingCredits = false;
|
||||
@@ -1170,7 +1170,7 @@
|
||||
} else {
|
||||
if (this.player.getHealth() > 0.0F) {
|
||||
return;
|
||||
@@ -835,14 +1561,20 @@
|
||||
@@ -834,14 +1560,20 @@
|
||||
|
||||
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x());
|
||||
@@ -1192,7 +1192,7 @@
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
|
||||
for (int i = 0; i < this.player.activeContainer.c.size(); ++i) {
|
||||
@@ -851,8 +1583,275 @@
|
||||
@@ -850,8 +1582,275 @@
|
||||
|
||||
this.player.a(this.player.activeContainer, (List) arraylist);
|
||||
} else {
|
||||
@@ -1469,7 +1469,7 @@
|
||||
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true));
|
||||
this.player.f = true;
|
||||
@@ -881,6 +1880,7 @@
|
||||
@@ -880,6 +1879,7 @@
|
||||
|
||||
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x());
|
||||
@@ -1477,7 +1477,7 @@
|
||||
this.player.resetIdleTimer();
|
||||
if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||
this.player.activeContainer.a(this.player, packetplayinenchantitem.b());
|
||||
@@ -915,8 +1915,48 @@
|
||||
@@ -913,8 +1913,48 @@
|
||||
}
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45;
|
||||
@@ -1527,7 +1527,7 @@
|
||||
|
||||
if (flag1 && flag2 && flag3) {
|
||||
if (itemstack == null) {
|
||||
@@ -940,6 +1980,7 @@
|
||||
@@ -938,6 +1978,7 @@
|
||||
|
||||
public void a(PacketPlayInTransaction packetplayintransaction) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x());
|
||||
@@ -1535,7 +1535,7 @@
|
||||
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
||||
|
||||
if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||
@@ -950,6 +1991,7 @@
|
||||
@@ -948,6 +1989,7 @@
|
||||
|
||||
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x());
|
||||
@@ -1543,11 +1543,11 @@
|
||||
this.player.resetIdleTimer();
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
BlockPosition blockposition = packetplayinupdatesign.a();
|
||||
@@ -966,14 +2008,30 @@
|
||||
@@ -964,14 +2006,30 @@
|
||||
|
||||
if (!tileentitysign.b() || tileentitysign.c() != this.player) {
|
||||
if (!tileentitysign.c() || tileentitysign.d() != this.player) {
|
||||
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
|
||||
+ this.sendPacket(new PacketPlayOutUpdateSign(tileentity.world, packetplayinupdatesign.a(), tileentitysign.lines)); // CraftBukkit
|
||||
+ this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1575,7 +1575,7 @@
|
||||
|
||||
tileentitysign.update();
|
||||
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -996,11 +2054,27 @@
|
||||
@@ -994,11 +2052,27 @@
|
||||
|
||||
public void a(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x());
|
||||
@@ -1604,7 +1604,7 @@
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
|
||||
|
||||
@@ -1334,12 +2408,34 @@
|
||||
@@ -1332,12 +2406,34 @@
|
||||
packetdataserializer.release();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user