From 8788b79a48a324130c400658c13f8176787d742a Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 5 Sep 2016 17:33:28 +1000 Subject: SPIGOT-2639: Better state validation --- nms-patches/PlayerConnection.patch | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 02efdea8..8a7ef1f0 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -228,7 +228,7 @@ + double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2); + float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch()); + -+ if ((delta > 1f / 256 || deltaAngle > 10f) && !this.player.dead) { ++ if ((delta > 1f / 256 || deltaAngle > 10f) && !this.player.cj()) { + this.lastPosX = to.getX(); + this.lastPosY = to.getY(); + this.lastPosZ = to.getZ(); @@ -273,7 +273,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - if (!this.player.viewingCredits) { -+ if (!this.player.viewingCredits && !this.player.dead) { // CraftBukkit - Added ' && !this.player.dead' ++ if (!this.player.viewingCredits && !this.player.cj()) { // CraftBukkit // PAIL: rename if (this.e == 0) { this.d(); } @@ -366,7 +366,7 @@ + double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2); + float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch()); + -+ if ((delta > 1f / 256 || deltaAngle > 10f) && !this.player.dead) { ++ if ((delta > 1f / 256 || deltaAngle > 10f) && !this.player.cj()) { + this.lastPosX = to.getX(); + this.lastPosY = to.getY(); + this.lastPosZ = to.getZ(); @@ -511,7 +511,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); @@ -613,7 +613,7 @@ public void a(PacketPlayInUseItem packetplayinuseitem) { PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); @@ -635,7 +635,7 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinblockplace.a(); ItemStack itemstack = this.player.b(enumhand); @@ -785,7 +785,7 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit if (packetplayinhelditemslot.a() >= 0 && packetplayinhelditemslot.a() < PlayerInventory.getHotbarSize()) { + PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.a()); + this.server.getPluginManager().callEvent(event); @@ -1013,7 +1013,7 @@ public void a(PacketPlayInArmAnimation packetplayinarmanimation) { PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit this.player.resetIdleTimer(); + // CraftBukkit start - Raytrace to look for 'rogue armswings' + float f1 = this.player.pitch; @@ -1078,7 +1078,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); @@ -1171,7 +1171,7 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); + -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit + CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit + this.player.s(); @@ -1179,7 +1179,7 @@ public void a(PacketPlayInWindowClick packetplayinwindowclick) { PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { - if (this.player.isSpectator()) { @@ -1473,7 +1473,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit 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()); @@ -1531,7 +1531,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit 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()) { @@ -1539,7 +1539,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); -+ if (this.player.dead) return; // CraftBukkit ++ if (this.player.cj()) return; // CraftBukkit this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -- cgit v1.2.3