From a05aa6832793215c9a12579a2a1e576aced07336 Mon Sep 17 00:00:00 2001 From: okx-code Date: Wed, 29 Apr 2026 23:01:36 +0100 Subject: [PATCH] load profile better --- .../simpleadminhacks/hacks/basic/BrewIndex.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/simpleadminhacks-paper/src/main/java/com/programmerdan/minecraft/simpleadminhacks/hacks/basic/BrewIndex.java b/plugins/simpleadminhacks-paper/src/main/java/com/programmerdan/minecraft/simpleadminhacks/hacks/basic/BrewIndex.java index 97ff1b516..5abe2d9ee 100644 --- a/plugins/simpleadminhacks-paper/src/main/java/com/programmerdan/minecraft/simpleadminhacks/hacks/basic/BrewIndex.java +++ b/plugins/simpleadminhacks-paper/src/main/java/com/programmerdan/minecraft/simpleadminhacks/hacks/basic/BrewIndex.java @@ -6,6 +6,7 @@ import co.aikar.commands.annotation.CommandCompletion; import co.aikar.commands.annotation.Default; import co.aikar.commands.annotation.Description; import co.aikar.commands.annotation.Subcommand; +import com.destroystokyo.paper.profile.PlayerProfile; import com.dre.brewery.Brew; import com.dre.brewery.api.events.brew.BrewDrinkEvent; import com.dre.brewery.recipe.BRecipe; @@ -53,6 +54,9 @@ public final class BrewIndex extends BasicHack { private final CommandManager commands; private boolean breweryEnabled; + private PlayerProfile profile; + private volatile boolean profileLoaded = false; + public BrewIndex(final SimpleAdminHacks plugin, final BasicHackConfig config) { super(plugin, config); this.drunkBrewsKey = new NamespacedKey(plugin, "drunk_brews"); @@ -75,6 +79,12 @@ public final class BrewIndex extends BasicHack { if (PlayerSettingAPI.getSetting(UNIQUE_BREWS_DRUNK_SETTING) == null) { PlayerSettingAPI.registerSetting(this.uniqueBrewsDrunk, null); } + + Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { + this.profile = Bukkit.getServer().createProfile(UUID.fromString("82569b12-c44c-4864-8a73-85a9192ee8f9"), "RedDevel"); + this.profile.complete(); + this.profileLoaded = true; + }); this.commands.init(); } @@ -226,7 +236,9 @@ public final class BrewIndex extends BasicHack { final MultiPageView view = new MultiPageView(player, clickables, title, true); final ItemStack topBrewers = new ItemStack(Material.PLAYER_HEAD); final SkullMeta topBrewersMeta = (SkullMeta) topBrewers.getItemMeta(); - topBrewersMeta.setPlayerProfile(Bukkit.getServer().createProfile(UUID.fromString("82569b12-c44c-4864-8a73-85a9192ee8f9"), "RedDevel")); + if (profileLoaded) { + topBrewersMeta.setPlayerProfile(profile); + } topBrewersMeta.displayName(Component.text("Top Brewers") .color(NamedTextColor.GOLD) .decoration(TextDecoration.ITALIC, false));