9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-23 08:59:23 +00:00
Files
Leaf/patches/server/0020-KeYi-Player-Skull-API.patch
Dreeam 337a94cda9 Updated Upstream (Paper/Gale/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@d1a72ea Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11405)
PaperMC/Paper@0a53f1d Set default drop behavior for player deaths (#11380)
PaperMC/Paper@951e7dd Fix TrialSpawner forgetting assigned mob when placed by player (#11381)
PaperMC/Paper@13a2395 Fix enable-player-collisions playing sounds when set to false (#11390)
PaperMC/Paper@1348e44 Prevent NPE when serializing unresolved profile (#11407)

Gale Changes:
Dreeam-qwq/Gale@f346681 Updated Upstream (Paper)
Dreeam-qwq/Gale@bba1737 Updated Upstream (Paper)

Purpur Changes:
PurpurMC/Purpur@88352c3 Updated Upstream (Paper)
PurpurMC/Purpur@dee41bc Updated Upstream (Paper)
PurpurMC/Purpur@fdfc12e Updated Upstream (Paper)
PurpurMC/Purpur@bc7bcbb Fix elytra durability setting not working properly (#1589)
PurpurMC/Purpur@8af4ea6 Updated Upstream (Paper)
PurpurMC/Purpur@8332fa4 Updated Upstream (Paper)
2024-09-17 01:38:58 -04:00

45 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Sun, 20 Nov 2022 00:20:00 +0800
Subject: [PATCH] KeYi: Player Skull API
Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ceca8c1bb41a9c258f004863ea8ff76961e6b4f0..7afbcd8f44ec11b8ba77e0cbc7b084d92ab43239 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3648,4 +3648,31 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundPlayerCombatKillPacket(getEntityId(), io.papermc.paper.adventure.PaperAdventure.asVanilla(message)));
}
// Purpur end
+
+ // Leaf start - KeYi - Player Skull API
+ @Override
+ public ItemStack getSkull() {
+ ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1);
+ org.bukkit.inventory.meta.SkullMeta meta = (org.bukkit.inventory.meta.SkullMeta) skull.getItemMeta();
+
+ meta.setOwningPlayer(this);
+ skull.setItemMeta(meta);
+
+ return skull;
+ }
+
+ @Override
+ @Deprecated(forRemoval = true)
+ public CompletableFuture<ItemStack> getSkullAsynchronously() {
+ org.apache.logging.log4j.LogManager.getLogger("Leaf")
+ .warn("You should not use this method: Player#getSkullAsynchronously(), cause low performance, " +
+ "and will be removed in the future.");
+ java.util.concurrent.ExecutorService executorService = java.util.concurrent.Executors.newCachedThreadPool();
+
+ CompletableFuture<ItemStack> future = (CompletableFuture<ItemStack>) executorService.submit(this::getSkull);
+ executorService.shutdown();
+
+ return future;
+ }
+ // Leaf end - KeYi - Player Skull API
}