I am creating a plugin, with Bukkit in Minecraft : 1.19.4 and I need to see if there is a specific Music Disc in a JukeBox when the player right clicks on the block but I can't find a way to do that.
So I tried:
public class TestCD implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
ItemStack it = event.getItem();
Block block = event.getClickedBlock();
BlockData blockD = block.getBlockData();
if (it != null && action == Action.LEFT_CLICK_BLOCK && block.getType().equals(Material.JUKEBOX) && blockD.getMaterial().isRecord() = true) {
player.sendMessage("Hello World");
}
}
Then I tried several other things but I don't remember them.