diff options
Diffstat (limited to 'nms-patches/PlayerConnection.patch')
-rw-r--r-- | nms-patches/PlayerConnection.patch | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index fa397aae..3ce25e59 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -51,8 +51,8 @@ private static final Logger LOGGER = LogManager.getLogger(); @@ -25,7 +68,10 @@ - private int f; - private long g; + private long f; + private boolean g; private long h; - private int chatThrottle; + // CraftBukkit start - multithreaded fields @@ -97,7 +97,7 @@ public void e() { this.syncPosition(); -@@ -110,15 +183,21 @@ +@@ -116,15 +189,21 @@ } this.minecraftServer.methodProfiler.b(); @@ -119,7 +119,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -137,18 +216,48 @@ +@@ -143,18 +222,48 @@ return this.networkManager; } @@ -174,7 +174,7 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -187,7 +296,34 @@ +@@ -193,7 +302,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("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -225,6 +361,62 @@ +@@ -231,6 +367,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.c(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -283,7 +475,7 @@ +@@ -289,7 +481,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -282,7 +282,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -293,13 +485,21 @@ +@@ -299,13 +491,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; -@@ -324,15 +524,33 @@ +@@ -330,15 +530,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -341,7 +341,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -378,6 +596,69 @@ +@@ -384,6 +602,69 @@ } } @@ -411,7 +411,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cP() && !worldserver.c(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -395,10 +676,76 @@ +@@ -401,10 +682,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -489,7 +489,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; -@@ -415,6 +762,14 @@ +@@ -421,6 +768,14 @@ f3 = f1 + this.player.pitch; } @@ -504,7 +504,7 @@ if (++this.teleportAwait == Integer.MAX_VALUE) { this.teleportAwait = 0; } -@@ -426,6 +781,7 @@ +@@ -432,6 +787,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); @@ -512,7 +512,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); -@@ -435,7 +791,15 @@ +@@ -441,7 +797,15 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -529,7 +529,7 @@ this.player.a(EnumHand.MAIN_HAND, itemstack); } -@@ -443,6 +807,21 @@ +@@ -449,6 +813,21 @@ case DROP_ITEM: if (!this.player.isSpectator()) { @@ -551,7 +551,7 @@ this.player.a(false); } -@@ -476,7 +855,15 @@ +@@ -482,7 +861,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -567,7 +567,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -496,10 +883,12 @@ +@@ -502,10 +889,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -580,7 +580,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); -@@ -513,6 +902,13 @@ +@@ -519,6 +908,13 @@ chatmessage.getChatModifier().setColor(EnumChatFormat.RED); this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, ChatMessageType.GAME_INFO)); } else if (this.teleportPos == null && this.player.d((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)) { @@ -594,7 +594,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f()); } -@@ -522,13 +918,52 @@ +@@ -528,13 +924,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); @@ -648,7 +648,7 @@ } } -@@ -539,8 +974,8 @@ +@@ -545,8 +980,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -659,7 +659,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -553,6 +988,8 @@ +@@ -559,6 +994,8 @@ if (entity != null) { this.player.setSpectatorTarget(this.player); this.player.stopRiding(); @@ -668,7 +668,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -578,12 +1015,20 @@ +@@ -584,12 +1021,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -690,7 +690,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -596,14 +1041,29 @@ +@@ -602,14 +1047,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -721,7 +721,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(); -@@ -625,6 +1085,15 @@ +@@ -631,6 +1091,15 @@ } } @@ -737,7 +737,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -646,17 +1115,32 @@ +@@ -652,17 +1121,32 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -772,7 +772,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -669,39 +1153,249 @@ +@@ -675,39 +1159,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1029,7 +1029,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -773,6 +1467,7 @@ +@@ -779,6 +1473,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1037,7 +1037,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -788,20 +1483,68 @@ +@@ -794,20 +1489,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1107,7 +1107,7 @@ } } } -@@ -817,7 +1560,8 @@ +@@ -823,7 +1566,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1117,7 +1117,7 @@ CriterionTriggers.u.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -840,14 +1584,20 @@ +@@ -846,14 +1590,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1134,13 +1134,13 @@ this.player.resetIdleTimer(); - if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { - if (this.player.isSpectator()) { -+ if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player) && this.player.activeContainer.a(this.player)) { // CraftBukkit ++ if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player) && this.player.activeContainer.canUse(this.player)) { // CraftBukkit + boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if + if (false/*this.player.isSpectator()*/) { // CraftBukkit NonNullList nonnulllist = NonNullList.a(); - for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -856,8 +1606,274 @@ + for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { +@@ -862,8 +1612,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1416,7 +1416,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -894,6 +1910,7 @@ +@@ -900,6 +1916,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1424,7 +1424,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()); -@@ -927,7 +1944,45 @@ +@@ -933,7 +1950,45 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1471,7 +1471,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -951,6 +2006,7 @@ +@@ -957,6 +2012,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1479,7 +1479,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()) { -@@ -961,6 +2017,7 @@ +@@ -967,6 +2023,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1487,7 +1487,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -977,14 +2034,30 @@ +@@ -983,14 +2040,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1519,7 +1519,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1007,11 +2080,27 @@ +@@ -1016,11 +2089,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1548,7 +1548,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1037,6 +2126,13 @@ +@@ -1046,6 +2135,13 @@ ItemStack itemstack1; if ("MC|BEdit".equals(s)) { @@ -1562,7 +1562,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1055,15 +2151,25 @@ +@@ -1064,15 +2160,25 @@ } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1588,7 +1588,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1097,10 +2203,11 @@ +@@ -1106,10 +2212,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1601,7 +1601,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1112,6 +2219,7 @@ +@@ -1121,6 +2228,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1609,7 +1609,7 @@ } } else { TileEntity tileentity; -@@ -1161,6 +2269,7 @@ +@@ -1170,6 +2278,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1617,7 +1617,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1228,6 +2337,7 @@ +@@ -1237,6 +2346,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1625,7 +1625,7 @@ } } else { int k; -@@ -1251,6 +2361,7 @@ +@@ -1260,6 +2370,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1633,7 +1633,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1337,6 +2448,7 @@ +@@ -1346,6 +2457,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1641,7 +1641,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1349,11 +2461,49 @@ +@@ -1358,11 +2470,49 @@ this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); |