diff options
author | Noah van der Aa <[email protected]> | 2021-12-01 02:31:13 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-30 17:31:13 -0800 |
commit | cd9fe9ca642322f8ba560a8c0f86c877af2cd10f (patch) | |
tree | 0099ebdd316d7b54e32fde7c5039011555b330ad /patches/server/0533-Add-API-for-quit-reason.patch | |
parent | effa3bad36df91b9cca1920e357b963806f62ff6 (diff) | |
download | Paper-cd9fe9ca642322f8ba560a8c0f86c877af2cd10f.tar.gz Paper-cd9fe9ca642322f8ba560a8c0f86c877af2cd10f.zip |
Port flat bedrock (generator settings) to 1.18 (#6960)
Diffstat (limited to 'patches/server/0533-Add-API-for-quit-reason.patch')
-rw-r--r-- | patches/server/0533-Add-API-for-quit-reason.patch | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/patches/server/0533-Add-API-for-quit-reason.patch b/patches/server/0533-Add-API-for-quit-reason.patch deleted file mode 100644 index 6ea3012532..0000000000 --- a/patches/server/0533-Add-API-for-quit-reason.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm <[email protected]> -Date: Sat, 14 Nov 2020 16:19:52 +0100 -Subject: [PATCH] Add API for quit reason - - -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index d30bc3f1da336b421d9a42070184e07169dd14e4..a6eadf71957b37e2acc5d09f0ce4ee961810891f 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -142,12 +142,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { - - this.handlingFault = true; - if (this.channel.isOpen()) { -+ net.minecraft.server.level.ServerPlayer player = this.getPlayer(); // Paper - if (throwable instanceof TimeoutException) { - Connection.LOGGER.debug("Timeout", throwable); -+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - this.disconnect(new TranslatableComponent("disconnect.timeout")); - } else { - TranslatableComponent chatmessage = new TranslatableComponent("disconnect.genericReason", new Object[]{"Internal Exception: " + throwable}); - -+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - if (flag) { - Connection.LOGGER.debug("Failed to sent packet", throwable); - ConnectionProtocol enumprotocol = this.getCurrentProtocol(); -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 968b8180f92066a43f06bff8dd1d49b03bd08f5b..257942084d988cac5f87ff998ea637fa263a3fe9 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -257,6 +257,7 @@ public class ServerPlayer extends Player { - - public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks - public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper -+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event - - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { - super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2dd47eab63cf9322a5844e748709e220272a8cfe..c0a685cfe62aeda3583763ecc1e4fa127f8fb0d4 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -442,6 +442,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure - // CraftBukkit end - -+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> { - this.connection.disconnect(ichatbasecomponent); - }); -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a1077445ab7d416dc61db85742e447193642b919..38f0f98c2191bfe36c3547501e49680faef50403 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -596,7 +596,7 @@ public abstract class PlayerList { - entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - } - -- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); -+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason - if (entityplayer.didPlayerJoinEvent) this.cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit - entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); - |