Skip to content

Max durability component tag #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kqliber
Copy link

@Kqliber Kqliber commented Apr 25, 2025

Supports new max durability item component tag
Currently items with this tag will display with wrong value

return item.getType().getMaxDurability() - item.getDurability();
}

final Damageable meta = (Damageable) item.getItemMeta();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it unsafe to do such a cast here without checking if it actually is of type Damagable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, All ItemMeta implements Damageable https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java#172

Spigot is also doing the same in ItemStack#getDurability
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants