Hi! Im beginner programming in java, this is for a minecraft plugin
I need to compare if one head is legacy and another is modern, what do I mean? In current versions the head is represented by the id PLAYER_HEAD, but in older versions it is represented by SKULL_ITEM so I need to know how can I know if a head is legacy or not?
I am trying to make an event, where if the user places a special head, a message will appear in the chat.
I have some "examples" of the idea im trying to implement on events. is something like this
try {
// if both of these succeed, then we are running
// in a legacy api, but on a modern (1.13+) server.
Material.class.getDeclaredField("PLAYER_HEAD");
Material.valueOf("SKULL");
if (!warningPosted) {
Bukkit.getLogger().warning("SKULLCREATOR API - Using the legacy bukkit API with 1.13+ bukkit versions is not supported!");
warningPosted = true;
}
} catch (NoSuchFieldException | IllegalArgumentException ignored) {}
}```
How can I determine the material and proceed with my event?