Skip to content

Items do not have rarity and rarity disappears when set. #11040

@TauCu

Description

@TauCu

Expected behavior

ItemMeta#hasRarity to return true for items with rarity and for set rarity to persist.

Observed/Actual behavior

ItemMeta#hasRarity returns false for items with rarity and set rarity does not persist.

Steps/models to reproduce

var testStack = ItemType.PLAYER_HEAD.createItemStack();
var testMeta = testStack.getItemMeta();

// this should print true as PLAYER_HEAD has uncommon rarity. It prints false.
System.out.println(testMeta.hasRarity());

testMeta.setRarity(ItemRarity.UNCOMMON);

// this should (and does) print true.
System.out.println(testMeta.hasRarity());

testStack.setItemMeta(testMeta);

// this should print true as we have set the rarity to uncommon. It prints false.
System.out.println(testStack.getItemMeta().hasRarity());

Plugin and Datapack List

[23:10:54 INFO]: Server Plugins (7):
[23:10:54 INFO]: Bukkit Plugins:
[23:10:54 INFO]:  - client-crasher, LuckPerms, test-plugin, MoDispenserMechanics, PlugManX, spark, SystemChat
[23:10:59 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[23:10:59 INFO]: There are no more data packs available

Paper version

[23:10:51 INFO]: Checking version, please wait...
[23:10:52 INFO]: This server is running Paper version 1.21-47-master@62ed302 (2024-07-07T17:34:15Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21-44-8d91b85 (MC: 1.21)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.type: bugSomething doesn't work as it was intended to.version: 1.21Game version 1.21

    Type

    No fields configured for Bug.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions