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

Paper Changes:
PaperMC/Paper@41bc31b Update paperweight to 1.7.3 (#11445)
PaperMC/Paper@e17eb6b Improve entity effect API (#11444)
PaperMC/Paper@7b03141 Add startingBrewTime (#11406)
PaperMC/Paper@355b1cb Add API for explosions to damage the explosion cause (#11180)
PaperMC/Paper@6d7a438 Call bucket events for cauldrons (#7486)

Gale Changes:
Dreeam-qwq/Gale@2c4cde4 Updated Upstream (Paper)
Dreeam-qwq/Gale@d4d81da [ci skip] Update paperweight
2024-09-29 11:39:11 -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 173e4a075078af67f030750c9a6294ab3f796677..88668656c8586d758b636561066d96dd883e6201 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3663,4 +3663,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
}