forked from Upstream/mmocore
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.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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()) {
|
if (config.contains("display.texture") && icon.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) {
|
||||||
ItemMeta meta = icon.getItemMeta();
|
ItemMeta meta = icon.getItemMeta();
|
||||||
UtilityMethods.setTextureValue(meta, config.getString("display.texture"));
|
UtilityMethods.setTextureValue((SkullMeta) meta, config.getString("display.texture"));
|
||||||
icon.setItemMeta(meta);
|
icon.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public abstract class InventoryItem<T extends GeneratedInventory> {
|
|||||||
final ItemMeta meta = item.getItemMeta();
|
final ItemMeta meta = item.getItemMeta();
|
||||||
meta.setCustomModelData(modelData);
|
meta.setCustomModelData(modelData);
|
||||||
if (texture != null && meta instanceof SkullMeta)
|
if (texture != null && meta instanceof SkullMeta)
|
||||||
UtilityMethods.setTextureValue(meta, texture);
|
UtilityMethods.setTextureValue((SkullMeta) meta, texture);
|
||||||
|
|
||||||
if (hasName()) meta.setDisplayName(placeholders.apply(effectivePlayer, getName()));
|
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.ItemStack;
|
||||||
import org.bukkit.inventory.meta.Damageable;
|
import org.bukkit.inventory.meta.Damageable;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public abstract class AbstractItemBuilder {
|
public abstract class AbstractItemBuilder {
|
||||||
private final ConfigItem configItem;
|
private final ConfigItem configItem;
|
||||||
@ -42,11 +42,7 @@ public abstract class AbstractItemBuilder {
|
|||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && configItem.getTexture() != null)
|
if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && configItem.getTexture() != null)
|
||||||
try {
|
UtilityMethods.setTextureValue((SkullMeta) meta, configItem.getTexture());
|
||||||
UtilityMethods.setTextureValue(meta, configItem.getTexture());
|
|
||||||
} catch (IllegalArgumentException exception) {
|
|
||||||
MMOCore.log(Level.WARNING, "Could not load texture of config item called '" + configItem.getId() + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
meta.addItemFlags(ItemFlag.values());
|
meta.addItemFlags(ItemFlag.values());
|
||||||
meta.setDisplayName(applyPlaceholders(configItem.getName()));
|
meta.setDisplayName(applyPlaceholders(configItem.getName()));
|
||||||
|
Loading…
Reference in New Issue
Block a user