From b082d8970b67ac5b1cba9b12d9a9e026a28c49e6 Mon Sep 17 00:00:00 2001 From: Andreas Prues <68807218+Lama06@users.noreply.github.com> Date: Sun, 22 Jan 2023 14:21:45 +0100 Subject: [PATCH] Win Screen API (#8802) --- patches/api/0427-Win-Screen-API.patch | 29 ++++++++++++++++++++++++ patches/server/0958-Win-Screen-API.patch | 26 +++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 patches/api/0427-Win-Screen-API.patch create mode 100644 patches/server/0958-Win-Screen-API.patch diff --git a/patches/api/0427-Win-Screen-API.patch b/patches/api/0427-Win-Screen-API.patch new file mode 100644 index 0000000000..12985872b3 --- /dev/null +++ b/patches/api/0427-Win-Screen-API.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lama06 +Date: Sat, 21 Jan 2023 13:45:22 +0100 +Subject: [PATCH] Win Screen API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index de960716478477ce199526b8f860cfafa1541ee9..204bdc65e8d8bbfe462a0b5180c55beae8cb181d 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -822,6 +822,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void sendMap(@NotNull MapView map); + ++ // Paper start ++ /** ++ * Shows the player the win screen that normally is only displayed after one kills the ender dragon ++ * and exits the end for the first time. ++ * In vanilla, the win screen starts with a poem and then continues with the credits but its content can be ++ * changed by using a resource pack. ++ * ++ * @see https://minecraft.fandom.com/wiki/End_Poem#Technical_details ++ */ ++ public void showWinScreen(); ++ // Paper end ++ + // Paper start + /** + * Permanently Bans the Profile and IP address currently used by the player. diff --git a/patches/server/0958-Win-Screen-API.patch b/patches/server/0958-Win-Screen-API.patch new file mode 100644 index 0000000000..7e6b5c7205 --- /dev/null +++ b/patches/server/0958-Win-Screen-API.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lama06 +Date: Sat, 21 Jan 2023 13:53:23 +0100 +Subject: [PATCH] Win Screen API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index b32f44beab2c9790ee2da8403e362e8b3ecc6175..2687f9e2764343c4a0d582ab65ff45b04a470057 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1162,6 +1162,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + this.getHandle().connection.send(packet); + } + ++ // Paper start ++ @Override ++ public void showWinScreen() { ++ if (getHandle().connection == null) return; ++ var packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1); ++ getHandle().connection.send(packet); ++ } ++ // Paper end ++ + @Override + public void setRotation(float yaw, float pitch) { + // Paper start - Teleport API