mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Fixed 1.20+ skull texture application
This commit is contained in:
parent
3c043babd5
commit
22744b181b
@ -40,6 +40,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -89,7 +90,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
|
||||
if (config.contains("display.texture") && icon.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) {
|
||||
ItemMeta meta = icon.getItemMeta();
|
||||
UtilityMethods.setTextureValue(meta, config.getString("display.texture"));
|
||||
UtilityMethods.setTextureValue((SkullMeta) meta, config.getString("display.texture"));
|
||||
icon.setItemMeta(meta);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ public abstract class InventoryItem<T extends GeneratedInventory> {
|
||||
final ItemMeta meta = item.getItemMeta();
|
||||
meta.setCustomModelData(modelData);
|
||||
if (texture != null && meta instanceof SkullMeta)
|
||||
UtilityMethods.setTextureValue(meta, texture);
|
||||
UtilityMethods.setTextureValue((SkullMeta) meta, texture);
|
||||
|
||||
if (hasName()) meta.setDisplayName(placeholders.apply(effectivePlayer, getName()));
|
||||
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public abstract class AbstractItemBuilder {
|
||||
private final ConfigItem configItem;
|
||||
@ -42,11 +42,7 @@ public abstract class AbstractItemBuilder {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && configItem.getTexture() != null)
|
||||
try {
|
||||
UtilityMethods.setTextureValue(meta, configItem.getTexture());
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not load texture of config item called '" + configItem.getId() + "'");
|
||||
}
|
||||
UtilityMethods.setTextureValue((SkullMeta) meta, configItem.getTexture());
|
||||
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName(applyPlaceholders(configItem.getName()));
|
||||
|
Loading…
Reference in New Issue
Block a user