From c4129c259b5913333efed76975c345d2afff6acd Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 6 Dec 2014 20:53:57 +0000 Subject: Disconnect old players before firing PlayerLoginEvent and fire a PlayerQuitEvent straight after a PlayerKickEvent --- nms-patches/PlayerConnection.patch | 75 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'nms-patches/PlayerConnection.patch') diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 624d4f58..5f84678f 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerConnection.java 2014-12-05 15:03:49.462262206 +0000 -+++ src/main/java/net/minecraft/server/PlayerConnection.java 2014-12-05 15:03:44.490262316 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerConnection.java 2014-12-06 20:53:31.195313494 +0000 ++++ src/main/java/net/minecraft/server/PlayerConnection.java 2014-12-06 20:50:54.967316961 +0000 @@ -16,6 +16,48 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -115,7 +115,7 @@ if (this.m > 0) { --this.m; -@@ -76,11 +151,27 @@ +@@ -76,11 +151,28 @@ } public void disconnect(String s) { @@ -137,6 +137,7 @@ + // CraftBukkit end ChatComponentText chatcomponenttext = new ChatComponentText(s); ++ this.a(chatcomponenttext); // CraftBukkit - fire quit instantly this.networkManager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new PlayerConnectionFuture(this, chatcomponenttext), new GenericFutureListener[0]); this.networkManager.k(); - Futures.getUnchecked(this.minecraftServer.postToMainThread(new PlayerConnectionDisconnector(this))); @@ -144,7 +145,7 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -90,6 +181,13 @@ +@@ -90,6 +182,13 @@ public void a(PacketPlayInFlying packetplayinflying) { PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u()); @@ -158,7 +159,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); this.h = true; -@@ -108,8 +206,65 @@ +@@ -108,8 +207,65 @@ this.checkMovement = true; } } @@ -225,7 +226,7 @@ this.f = this.e; double d7; double d8; -@@ -203,12 +358,14 @@ +@@ -203,12 +359,14 @@ double d11 = d7 - this.player.locX; double d12 = d8 - this.player.locY; double d13 = d9 - this.player.locZ; @@ -244,7 +245,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; -@@ -281,6 +438,49 @@ +@@ -281,6 +439,49 @@ } public void a(double d0, double d1, double d2, float f, float f1, Set set) { @@ -294,7 +295,7 @@ this.checkMovement = false; this.o = d0; this.p = d1; -@@ -314,32 +514,49 @@ +@@ -314,32 +515,49 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u()); @@ -350,7 +351,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); -@@ -354,7 +571,15 @@ +@@ -354,7 +572,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -366,7 +367,7 @@ } } else { if (packetplayinblockdig.c() == EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -374,11 +599,22 @@ +@@ -374,11 +600,22 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -389,7 +390,7 @@ ItemStack itemstack = this.player.inventory.getItemInHand(); boolean flag = false; BlockPosition blockposition = packetplayinblockplace.a(); -@@ -390,7 +626,18 @@ +@@ -390,7 +627,18 @@ return; } @@ -409,7 +410,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())}); -@@ -398,9 +645,21 @@ +@@ -398,9 +646,21 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage)); flag = true; } else { @@ -432,7 +433,7 @@ flag = true; } -@@ -423,7 +682,8 @@ +@@ -423,7 +683,8 @@ this.player.activeContainer.b(); this.player.g = false; @@ -442,7 +443,7 @@ this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand())); } } -@@ -437,8 +697,8 @@ +@@ -437,8 +698,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -453,7 +454,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -455,6 +715,7 @@ +@@ -455,6 +716,7 @@ WorldServer worldserver1 = this.player.u(); WorldServer worldserver2 = (WorldServer) entity.world; @@ -461,7 +462,7 @@ this.player.dimension = entity.dimension; this.sendPacket(new PacketPlayOutRespawn(this.player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldData().getType(), this.player.playerInteractManager.getGameMode())); worldserver1.removeEntity(this.player); -@@ -472,6 +733,9 @@ +@@ -472,6 +734,9 @@ this.player.playerInteractManager.a(worldserver2); this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); @@ -471,7 +472,7 @@ } else { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } -@@ -483,14 +747,29 @@ +@@ -483,14 +748,29 @@ public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} public void a(IChatBaseComponent ichatbasecomponent) { @@ -503,7 +504,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(); -@@ -511,6 +790,15 @@ +@@ -511,6 +791,15 @@ return; } } @@ -519,7 +520,7 @@ try { this.networkManager.handle(packet); -@@ -524,18 +812,34 @@ +@@ -524,18 +813,34 @@ } public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { @@ -556,7 +557,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -548,39 +852,247 @@ +@@ -548,39 +853,247 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -812,7 +813,7 @@ this.player.z(); switch (SwitchHelperCommandActionType.b[packetplayinentityaction.b().ordinal()]) { case 1: -@@ -601,7 +1113,7 @@ +@@ -601,7 +1114,7 @@ case 5: this.player.a(false, true, true); @@ -821,7 +822,7 @@ break; case 6: -@@ -623,6 +1135,7 @@ +@@ -623,6 +1136,7 @@ } public void a(PacketPlayInUseEntity packetplayinuseentity) { @@ -829,7 +830,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -637,18 +1150,72 @@ +@@ -637,18 +1151,72 @@ } if (this.player.h(entity) < d0) { @@ -903,7 +904,7 @@ } } } -@@ -663,7 +1230,8 @@ +@@ -663,7 +1231,8 @@ switch (SwitchHelperCommandActionType.c[enumclientcommand.ordinal()]) { case 1: if (this.player.viewingCredits) { @@ -913,7 +914,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!"); -@@ -694,11 +1262,17 @@ +@@ -694,11 +1263,17 @@ } public void a(PacketPlayInCloseWindow packetplayinclosewindow) { @@ -931,7 +932,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.u()); this.player.z(); if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { -@@ -711,7 +1285,269 @@ +@@ -711,7 +1286,269 @@ this.player.a(this.player.activeContainer, (List) arraylist); } else { @@ -1202,7 +1203,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); -@@ -772,8 +1608,50 @@ +@@ -772,8 +1609,50 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); @@ -1254,7 +1255,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) { -@@ -796,6 +1674,7 @@ +@@ -796,6 +1675,7 @@ } public void a(PacketPlayInTransaction packetplayintransaction) { @@ -1262,7 +1263,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u()); Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); -@@ -806,6 +1685,7 @@ +@@ -806,6 +1686,7 @@ } public void a(PacketPlayInUpdateSign packetplayinupdatesign) { @@ -1270,7 +1271,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u()); this.player.z(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); -@@ -822,10 +1702,24 @@ +@@ -822,10 +1703,24 @@ if (!tileentitysign.b() || tileentitysign.c() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1296,7 +1297,7 @@ tileentitysign.update(); worldserver.notify(blockposition); } -@@ -847,11 +1741,28 @@ +@@ -847,11 +1742,28 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u()); @@ -1326,7 +1327,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); -@@ -891,13 +1802,15 @@ +@@ -891,13 +1803,15 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1343,7 +1344,7 @@ return; } finally { packetdataserializer.release(); -@@ -909,27 +1822,31 @@ +@@ -909,27 +1823,31 @@ try { itemstack = packetdataserializer.i(); @@ -1387,7 +1388,7 @@ return; } finally { packetdataserializer.release(); -@@ -946,6 +1863,7 @@ +@@ -946,6 +1864,7 @@ } } catch (Exception exception2) { PlayerConnection.c.error("Couldn\'t select trade", exception2); @@ -1395,7 +1396,7 @@ } } else if ("MC|AdvCdm".equals(packetplayincustompayload.a())) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -986,6 +1904,7 @@ +@@ -986,6 +1905,7 @@ } } catch (Exception exception3) { PlayerConnection.c.error("Couldn\'t set command block", exception3); @@ -1403,7 +1404,7 @@ } finally { packetdataserializer.release(); } -@@ -1011,6 +1930,7 @@ +@@ -1011,6 +1931,7 @@ } } catch (Exception exception4) { PlayerConnection.c.error("Couldn\'t set beacon", exception4); @@ -1411,7 +1412,7 @@ } } } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) { -@@ -1026,6 +1946,27 @@ +@@ -1026,6 +1947,27 @@ containeranvil.a(""); } } -- cgit v1.2.3