diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 977fca9c54..da30860a4a 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/PlayerConnection.java 2015-04-15 17:35:03.688828804 +0100 -+++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-15 17:35:03.692828804 +0100 +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerConnection.java 2015-04-17 11:54:58.464656095 +0100 ++++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-17 11:54:58.468656095 +0100 @@ -17,6 +17,48 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -116,7 +116,7 @@ if (this.m > 0) { --this.m; -@@ -77,19 +152,31 @@ +@@ -77,19 +152,37 @@ } public void disconnect(String s) { @@ -149,12 +149,17 @@ - Futures.getUnchecked(this.minecraftServer.postToMainThread(new Runnable() { - public void run() { - PlayerConnection.this.networkManager.l(); -- } ++ // CraftBukkit - Don't wait ++ this.minecraftServer.postToMainThread(new Runnable() { ++ public void run() { ++ PlayerConnection.this.networkManager.l(); + } - })); ++ }); } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -99,6 +186,17 @@ +@@ -99,6 +192,17 @@ public void a(PacketPlayInFlying packetplayinflying) { PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u()); @@ -172,7 +177,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); this.h = true; -@@ -117,8 +215,66 @@ +@@ -117,8 +221,66 @@ this.checkMovement = true; } } @@ -240,7 +245,7 @@ this.f = this.e; double d7; double d8; -@@ -146,6 +302,7 @@ +@@ -146,6 +308,7 @@ this.minecraftServer.getPlayerList().d(this.player); if (this.player.vehicle != null) { @@ -248,7 +253,7 @@ if (d3 > 4.0D) { Entity entity = this.player.vehicle; -@@ -153,7 +310,7 @@ +@@ -153,7 +316,7 @@ this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); } @@ -257,7 +262,7 @@ } if (this.checkMovement) { -@@ -212,12 +369,14 @@ +@@ -212,12 +375,14 @@ double d11 = d7 - this.player.locX; double d12 = d8 - this.player.locY; double d13 = d9 - this.player.locZ; @@ -276,7 +281,7 @@ PlayerConnection.c.warn(this.player.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d14 + ", " + d15 + ", " + d16 + ")"); this.a(this.o, this.p, this.q, this.player.yaw, this.player.pitch); return; -@@ -286,10 +445,53 @@ +@@ -286,10 +451,53 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -331,7 +336,7 @@ this.checkMovement = false; this.o = d0; this.p = d1; -@@ -323,32 +525,49 @@ +@@ -323,32 +531,49 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u()); @@ -387,7 +392,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); -@@ -363,7 +582,15 @@ +@@ -363,7 +588,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -403,7 +408,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -383,11 +610,22 @@ +@@ -383,11 +616,22 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -426,7 +431,7 @@ ItemStack itemstack = this.player.inventory.getItemInHand(); boolean flag = false; BlockPosition blockposition = packetplayinblockplace.a(); -@@ -399,7 +637,50 @@ +@@ -399,7 +643,50 @@ return; } @@ -478,7 +483,7 @@ } else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && (enumdirection == EnumDirection.UP || blockposition.getY() >= this.minecraftServer.getMaxBuildHeight())) { ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}); -@@ -407,8 +688,19 @@ +@@ -407,8 +694,19 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage)); flag = true; } else { @@ -499,7 +504,7 @@ } flag = true; -@@ -432,7 +724,8 @@ +@@ -432,7 +730,8 @@ this.player.activeContainer.b(); this.player.g = false; @@ -509,7 +514,7 @@ this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand())); } } -@@ -446,8 +739,8 @@ +@@ -446,8 +745,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -520,7 +525,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -460,6 +753,8 @@ +@@ -460,6 +759,8 @@ if (entity != null) { this.player.e((Entity) this.player); this.player.mount((Entity) null); @@ -529,7 +534,7 @@ if (entity.world != this.player.world) { WorldServer worldserver1 = this.player.u(); WorldServer worldserver2 = (WorldServer) entity.world; -@@ -484,6 +779,9 @@ +@@ -484,6 +785,9 @@ } else { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } @@ -539,7 +544,7 @@ } } -@@ -492,14 +790,29 @@ +@@ -492,14 +796,29 @@ public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} public void a(IChatBaseComponent ichatbasecomponent) { @@ -571,7 +576,7 @@ if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) { PlayerConnection.c.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -521,6 +834,15 @@ +@@ -521,6 +840,15 @@ } } @@ -587,7 +592,7 @@ try { this.networkManager.handle(packet); } catch (Throwable throwable) { -@@ -541,18 +863,34 @@ +@@ -541,18 +869,34 @@ } public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { @@ -624,7 +629,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -565,39 +903,249 @@ +@@ -565,39 +909,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -882,7 +887,7 @@ this.player.z(); switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) { case 1: -@@ -618,7 +1166,7 @@ +@@ -618,7 +1172,7 @@ case 5: this.player.a(false, true, true); @@ -891,7 +896,7 @@ break; case 6: -@@ -640,6 +1188,7 @@ +@@ -640,6 +1194,7 @@ } public void a(PacketPlayInUseEntity packetplayinuseentity) { @@ -899,7 +904,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -654,18 +1203,67 @@ +@@ -654,18 +1209,67 @@ } if (this.player.h(entity) < d0) { @@ -968,7 +973,7 @@ } } } -@@ -680,7 +1278,8 @@ +@@ -680,7 +1284,8 @@ switch (PlayerConnection.SyntheticClass_1.c[packetplayinclientcommand_enumclientcommand.ordinal()]) { case 1: if (this.player.viewingCredits) { @@ -978,7 +983,7 @@ } else if (this.player.u().getWorldData().isHardcore()) { if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) { this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); -@@ -711,15 +1310,21 @@ +@@ -711,15 +1316,21 @@ } public void a(PacketPlayInCloseWindow packetplayinclosewindow) { @@ -1001,7 +1006,7 @@ ArrayList arraylist = Lists.newArrayList(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -728,7 +1333,270 @@ +@@ -728,7 +1339,270 @@ this.player.a(this.player.activeContainer, (List) arraylist); } else { @@ -1273,7 +1278,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); -@@ -789,8 +1657,48 @@ +@@ -789,8 +1663,48 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); @@ -1323,7 +1328,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) { -@@ -813,6 +1721,7 @@ +@@ -813,6 +1727,7 @@ } public void a(PacketPlayInTransaction packetplayintransaction) { @@ -1331,7 +1336,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u()); Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); -@@ -823,6 +1732,7 @@ +@@ -823,6 +1738,7 @@ } public void a(PacketPlayInUpdateSign packetplayinupdatesign) { @@ -1339,7 +1344,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u()); this.player.z(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); -@@ -839,14 +1749,30 @@ +@@ -839,14 +1755,30 @@ if (!tileentitysign.b() || tileentitysign.c() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1371,7 +1376,7 @@ tileentitysign.update(); worldserver.notify(blockposition); -@@ -869,11 +1795,27 @@ +@@ -869,11 +1801,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u()); @@ -1400,7 +1405,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); -@@ -913,13 +1855,16 @@ +@@ -913,13 +1861,16 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1417,7 +1422,7 @@ return; } finally { packetdataserializer.release(); -@@ -942,16 +1887,21 @@ +@@ -942,16 +1893,21 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { @@ -1439,7 +1444,7 @@ return; } finally { packetdataserializer.release(); -@@ -968,11 +1918,12 @@ +@@ -968,11 +1924,12 @@ } } catch (Exception exception2) { PlayerConnection.c.error("Couldn\'t select trade", exception2); @@ -1453,7 +1458,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1008,6 +1959,7 @@ +@@ -1008,6 +1965,7 @@ } } catch (Exception exception3) { PlayerConnection.c.error("Couldn\'t set command block", exception3); @@ -1461,7 +1466,7 @@ } finally { packetdataserializer.release(); } -@@ -1033,6 +1985,7 @@ +@@ -1033,6 +1991,7 @@ } } catch (Exception exception4) { PlayerConnection.c.error("Couldn\'t set beacon", exception4); @@ -1469,7 +1474,7 @@ } } } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) { -@@ -1048,7 +2001,28 @@ +@@ -1048,7 +2007,28 @@ containeranvil.a(""); } }