mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 17:09:29 +00:00
45 lines
2.0 KiB
Diff
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 ab454a7c53b074c8c60bab38c0544aa3b69d5c6d..8c7f2e8a07a55b5e0ac7ddc955ca2f3376f85af5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -3702,4 +3702,31 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa
|
|
this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundPlayerCombatKillPacket(getEntityId(), io.papermc.paper.adventure.PaperAdventure.asVanilla(message)));
|
|
}
|
|
// Purpur end - Death screen API
|
|
+
|
|
+ // 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
|
|
}
|