Hello Everyone,
I wish to create a method, with the Sponge 4.2.0 API, in which it checks to see if a player has a blue stained glass block in their inventory; if so, send them a message. I believed the code below would suffice, but when tested, nothing happens. I’ve had myself carry one blue stained glass block, a stack of them, and plain stained blocks, but nothing seems to trigger the message. Any thoughts? Thanks!
ItemStack BG = ItemStack.builder().itemType(ItemTypes.STAINED_GLASS).build();
BG.offer(Keys.DYE_COLOR, DyeColors.BLUE);
if(player.getInventory().contains(BG)){
player.sendMessage(Text.of(TextColors.BLUE, "You have a blue stained glass in your inventory my friend."));
}