add Player#showCreditScreen

This commit is contained in:
granny 2022-08-26 22:02:16 -07:00
parent 2934d19b9f
commit 6b00f11161
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@pl3x.net>
Date: Fri, 26 Aug 2022 21:45:01 -0700
Subject: [PATCH] add Player#showCreditScreen
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5e06858d68f725508e0055de3f5d8c0f6a56601b..8ab346562c23ff2c14727408e61e75e324885e67 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2375,6 +2375,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void showDemoScreen();
+ /**
+ * Shows the credits to the player, this screen is normally only seen after
+ * going into the end portal for the first time.
+ * <br>
+ * Servers can modify the text on this screen using a resource pack.
+ */
+ public void showCreditScreen();
+
/**
* Gets whether the player has the "Allow Server Listings" setting enabled.
*

View File

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@pl3x.net>
Date: Fri, 26 Aug 2022 21:45:00 -0700
Subject: [PATCH] add Player#showCreditScreen
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 284624683d0e593bc7996fa90a6eee2b6a22ad9e..9fbac26b30f89b94f1ac686fce14c7d1c78d7043 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2610,6 +2610,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, ClientboundGameEventPacket.DEMO_PARAM_INTRO));
}
+ @Override
+ public void showCreditScreen() {
+ if (this.getHandle().connection == null) return;
+
+ this.getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F));
+ }
+
@Override
public boolean isAllowingServerListings() {
return this.getHandle().allowsListing();