fix: replace usage of deleted SkullUtils class with XSkull

Updating the Core also updated XSeries which got rid of
SkullUtils in favor of new methods in XSkull
This commit is contained in:
Christian Koop 2024-06-22 15:44:30 +02:00
parent 65ed424163
commit 0d5d4eb3a4
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
2 changed files with 15 additions and 27 deletions

View File

@ -1,12 +1,12 @@
package com.craftaro.epicspawners.api.utils;
import com.craftaro.core.utils.HeadType;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerData;
import com.craftaro.epicspawners.api.spawners.spawner.SpawnerTier;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.EnumMap;
import java.util.Map;
@ -34,13 +34,7 @@ public class HeadUtils {
}
private static ItemStack createSkullForSkinHash(String textureHash) {
ItemStack head = XMaterial.PLAYER_HEAD.parseItem();
SkullMeta meta = (SkullMeta) head.getItemMeta();
SkullUtils.applySkin(meta, textureHash);
head.setItemMeta(meta);
return head;
return XSkull.createItem().profile(new Profileable.StringProfileable(textureHash, ProfileInputType.TEXTURE_HASH)).apply();
}
private static HeadType getHeadTypeOrDefault(String name) {

View File

@ -5,31 +5,28 @@ import com.craftaro.core.database.DataManager;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.hooks.EconomyManager;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.third_party.org.apache.commons.lang3.math.NumberUtils;
import com.craftaro.third_party.org.apache.commons.text.WordUtils;
import com.craftaro.third_party.org.jooq.Record;
import com.craftaro.third_party.org.jooq.Result;
import com.craftaro.third_party.org.jooq.impl.DSL;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.TextUtils;
import com.craftaro.epicspawners.EpicSpawners;
import com.craftaro.epicspawners.api.spawners.spawner.PlacedSpawner;
import com.craftaro.epicspawners.boost.types.BoostedSpawnerImpl;
import com.craftaro.epicspawners.settings.Settings;
import com.craftaro.ultimatestacker.api.stack.item.ItemMergeCallback;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType;
import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable;
import com.craftaro.third_party.org.apache.commons.lang3.math.NumberUtils;
import com.craftaro.third_party.org.apache.commons.text.WordUtils;
import com.craftaro.third_party.org.jooq.Record;
import com.craftaro.third_party.org.jooq.Result;
import com.craftaro.third_party.org.jooq.impl.DSL;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
public class SpawnerBoostGui extends CustomizableGui {
private final EpicSpawners plugin;
@ -111,11 +108,8 @@ public class SpawnerBoostGui extends CustomizableGui {
});
if (this.amount < Settings.MAX_PLAYER_BOOST.getInt()) {
ItemStack head = Objects.requireNonNull(XMaterial.PLAYER_HEAD.parseItem());
ItemStack head = XSkull.createItem().profile(new Profileable.StringProfileable("19bf3292e126a105b54eba713aa1b152d541a1d8938829c56364d178ed22bf", ProfileInputType.TEXTURE_HASH)).apply();
AdventureUtils.formatItemName(head, "&6&l+1");
ItemMeta meta = head.getItemMeta();
SkullUtils.applySkin(meta, "19bf3292e126a105b54eba713aa1b152d541a1d8938829c56364d178ed22bf");
head.setItemMeta(meta);
setButton("plus1", 8, head, event -> {
this.amount++;