Close #12213 by handle two cases where this can happen.
- You try pass the displayname to a component for chat
ItemStack itemStack = new ItemStack(Material.STICK, 200);
player.sendMessage(Component.text("Item1").appendSpace().append(itemStack.displayName()));
- You try to pass an item for the hover event
ItemStack itemStack = new ItemStack(Material.STICK, 200);
player.sendMessage(Component.text("Item2").hoverEvent(itemStack));
for the first case the only "easy" way is just mention in javadocs about how use this for chat messages can cause issues because mess with precontitions breaks others "normal" behaviours, the second case is more easy add a Precondition and the mention in javadocs about this.