CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
403 stars 126 forks source link

[XMaterial] - Parse material return incorrect material. #194

Closed reussy closed 2 years ago

reussy commented 2 years ago

Description I've been using the library for a while, specifically more XMaterial, but now it fails to deliver the desired material (at least in older versions like 1.8).

I'm trying to use "PLAYER_HEAD" to get the player's skull with its texture but the material is always "SKULL" (skeleton skull).

image

Version: v9.1.0 Code:

public Material parseMaterial(String material) {

        if (material != null) {
            XMaterial xMaterial = XMaterial.matchXMaterial(material.toUpperCase()).orElse(XMaterial.STONE);
            return xMaterial.parseMaterial();
        }
        return null;
    }

🎯 Important Note: If I use something like XMaterial.PLAYER_HEAD.parseItem() it does return the material of a player head. I'm probably using the wrong method, but as I said above, I always did it this way and it worked without problems.

image

I am not sure if this is caused by other plugins, I have tried on different servers and the same problem.

Version Server Version: 1.8.8

image

HSGamer commented 2 years ago

Surely because parseItem does not just change the material, it also change the durability of the item.

CryptoMorin commented 2 years ago

Like mentioned above, if you need an ItemStack, you have to use parseItem(). As you can see in your own screenshot the data values for the items are different.