diff options
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/PlayerConnection.patch | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 5aa853ed..19719624 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-14 10:14:05.807811715 +0100 -+++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-14 10:14:05.811811715 +0100 +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerConnection.java 2015-04-15 16:24:44.436922448 +0100 ++++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-04-15 16:24:44.440922447 +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,37 @@ +@@ -77,19 +152,31 @@ } public void disconnect(String s) { @@ -147,17 +147,14 @@ + this.a(chatcomponenttext); // CraftBukkit - fire quit instantly this.networkManager.k(); - Futures.getUnchecked(this.minecraftServer.postToMainThread(new Runnable() { -+ // CraftBukkit - Don't wait -+ this.minecraftServer.postToMainThread(new Runnable() { - public void run() { - PlayerConnection.this.networkManager.l(); - } +- public void run() { +- PlayerConnection.this.networkManager.l(); +- } - })); -+ }); } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -99,6 +192,17 @@ +@@ -99,6 +186,17 @@ public void a(PacketPlayInFlying packetplayinflying) { PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u()); @@ -175,7 +172,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); this.h = true; -@@ -117,8 +221,66 @@ +@@ -117,8 +215,66 @@ this.checkMovement = true; } } @@ -219,7 +216,8 @@ + this.player.playerConnection.sendPacket(new PacketPlayOutPosition(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.<PacketPlayOutPosition.EnumPlayerTeleportFlags>emptySet())); + return; + } -+ + +- if (this.checkMovement) { + /* If a Plugin has changed the To destination then we teleport the Player + there to avoid any 'Moved wrongly' or 'Moved too quickly' errors. + We only do this if the Event was not cancelled. */ @@ -227,8 +225,7 @@ + this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + return; + } - -- if (this.checkMovement) { ++ + /* Check to see if the Players Location has some how changed during the call of the event. + This can happen due to a plugin teleporting the player instead of using .setTo() */ + if (!from.equals(this.getPlayer().getLocation()) && this.justTeleported) { @@ -243,7 +240,7 @@ this.f = this.e; double d7; double d8; -@@ -212,12 +374,14 @@ +@@ -212,12 +368,14 @@ double d11 = d7 - this.player.locX; double d12 = d8 - this.player.locY; double d13 = d9 - this.player.locZ; @@ -262,7 +259,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 +450,53 @@ +@@ -286,10 +444,53 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -317,7 +314,7 @@ this.checkMovement = false; this.o = d0; this.p = d1; -@@ -323,32 +530,49 @@ +@@ -323,32 +524,49 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u()); @@ -373,7 +370,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 +587,15 @@ +@@ -363,7 +581,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -389,7 +386,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -383,11 +615,22 @@ +@@ -383,11 +609,22 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -412,7 +409,7 @@ ItemStack itemstack = this.player.inventory.getItemInHand(); boolean flag = false; BlockPosition blockposition = packetplayinblockplace.a(); -@@ -399,7 +642,50 @@ +@@ -399,7 +636,50 @@ return; } @@ -464,7 +461,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 +693,19 @@ +@@ -407,8 +687,19 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage)); flag = true; } else { @@ -485,7 +482,7 @@ } flag = true; -@@ -432,7 +729,8 @@ +@@ -432,7 +723,8 @@ this.player.activeContainer.b(); this.player.g = false; @@ -495,7 +492,7 @@ this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand())); } } -@@ -446,8 +744,8 @@ +@@ -446,8 +738,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -506,7 +503,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -460,6 +758,8 @@ +@@ -460,6 +752,8 @@ if (entity != null) { this.player.e((Entity) this.player); this.player.mount((Entity) null); @@ -515,7 +512,7 @@ if (entity.world != this.player.world) { WorldServer worldserver1 = this.player.u(); WorldServer worldserver2 = (WorldServer) entity.world; -@@ -484,6 +784,9 @@ +@@ -484,6 +778,9 @@ } else { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } @@ -525,7 +522,7 @@ } } -@@ -492,14 +795,29 @@ +@@ -492,14 +789,29 @@ public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} public void a(IChatBaseComponent ichatbasecomponent) { @@ -557,7 +554,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 +839,15 @@ +@@ -521,6 +833,15 @@ } } @@ -573,7 +570,7 @@ try { this.networkManager.handle(packet); } catch (Throwable throwable) { -@@ -541,18 +868,34 @@ +@@ -541,18 +862,34 @@ } public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { @@ -610,7 +607,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -565,39 +908,249 @@ +@@ -565,39 +902,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -868,7 +865,7 @@ this.player.z(); switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) { case 1: -@@ -618,7 +1171,7 @@ +@@ -618,7 +1165,7 @@ case 5: this.player.a(false, true, true); @@ -877,7 +874,7 @@ break; case 6: -@@ -640,6 +1193,7 @@ +@@ -640,6 +1187,7 @@ } public void a(PacketPlayInUseEntity packetplayinuseentity) { @@ -885,7 +882,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -654,18 +1208,71 @@ +@@ -654,18 +1202,71 @@ } if (this.player.h(entity) < d0) { @@ -958,7 +955,7 @@ } } } -@@ -680,7 +1287,8 @@ +@@ -680,7 +1281,8 @@ switch (PlayerConnection.SyntheticClass_1.c[packetplayinclientcommand_enumclientcommand.ordinal()]) { case 1: if (this.player.viewingCredits) { @@ -968,7 +965,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 +1319,21 @@ +@@ -711,15 +1313,21 @@ } public void a(PacketPlayInCloseWindow packetplayinclosewindow) { @@ -991,7 +988,7 @@ ArrayList arraylist = Lists.newArrayList(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -728,7 +1342,270 @@ +@@ -728,7 +1336,270 @@ this.player.a(this.player.activeContainer, (List) arraylist); } else { @@ -1263,7 +1260,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); -@@ -789,8 +1666,48 @@ +@@ -789,8 +1660,48 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); @@ -1313,7 +1310,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) { -@@ -813,6 +1730,7 @@ +@@ -813,6 +1724,7 @@ } public void a(PacketPlayInTransaction packetplayintransaction) { @@ -1321,7 +1318,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u()); Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); -@@ -823,6 +1741,7 @@ +@@ -823,6 +1735,7 @@ } public void a(PacketPlayInUpdateSign packetplayinupdatesign) { @@ -1329,7 +1326,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u()); this.player.z(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); -@@ -839,14 +1758,30 @@ +@@ -839,14 +1752,30 @@ if (!tileentitysign.b() || tileentitysign.c() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1361,7 +1358,7 @@ tileentitysign.update(); worldserver.notify(blockposition); -@@ -869,11 +1804,27 @@ +@@ -869,11 +1798,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u()); @@ -1390,7 +1387,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); -@@ -913,13 +1864,16 @@ +@@ -913,13 +1858,16 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1407,7 +1404,7 @@ return; } finally { packetdataserializer.release(); -@@ -942,16 +1896,21 @@ +@@ -942,16 +1890,21 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { @@ -1429,7 +1426,7 @@ return; } finally { packetdataserializer.release(); -@@ -968,11 +1927,12 @@ +@@ -968,11 +1921,12 @@ } } catch (Exception exception2) { PlayerConnection.c.error("Couldn\'t select trade", exception2); @@ -1443,7 +1440,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1008,6 +1968,7 @@ +@@ -1008,6 +1962,7 @@ } } catch (Exception exception3) { PlayerConnection.c.error("Couldn\'t set command block", exception3); @@ -1451,7 +1448,7 @@ } finally { packetdataserializer.release(); } -@@ -1033,6 +1994,7 @@ +@@ -1033,6 +1988,7 @@ } } catch (Exception exception4) { PlayerConnection.c.error("Couldn\'t set beacon", exception4); @@ -1459,7 +1456,7 @@ } } } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) { -@@ -1048,7 +2010,28 @@ +@@ -1048,7 +2004,28 @@ containeranvil.a(""); } } |