Skip to content
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

Support for ItemFlags #45

Open
ImBas opened this issue Jun 21, 2024 · 1 comment
Open

Support for ItemFlags #45

ImBas opened this issue Jun 21, 2024 · 1 comment
Assignees
Labels
+ Enhancement A feature request. ✓ Implemented A fix has been implemented. Issue will remain open pending code merge into master branch

Comments

@ImBas
Copy link

ImBas commented Jun 21, 2024

Hi there,

As mentioned on the Discord, it would be amazing to see support for ItemFlags added to OtherDrops
(reference: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html)

For example, this would allow to create an item like the one below, and hide the unbreaking X enchant:
ITEM@!UNBREAKING#10@!~&aItem name;&7Item lore;

Possible idea to implement this while respecting the current format could be to have it after enchants, like:
ITEM@!UNBREAKING#10!HIDE_ENCHANTS#true!HIDE_ATTRIBUTES#true@!~&aItem name;&7Item lore;
(or 1 for true 0 for false, just an idea though)

Thanks!

EDIT: If anyone stumbles upon this post, it's now possible to do it like below:

    # Example with hide enchant and hide attributes flags, showing usage with enchantments and custom name/lore
    drop: diamond_sword@hide_enchants;HIDE_ATTRIBUTES;unbreaking#2!sharpness#3!~name?;lore?;testing attribute in lore;hide_enchants
@ImBas ImBas added ❓ Question Question about the plugin. 🔍 Investigating Issue that is being investigated (attempting replication). labels Jun 21, 2024
@CoolLord22 CoolLord22 self-assigned this Jun 21, 2024
@CoolLord22 CoolLord22 added + Enhancement A feature request. and removed 🔍 Investigating Issue that is being investigated (attempting replication). ❓ Question Question about the plugin. labels Jun 21, 2024
CoolLord22 referenced this issue Jun 24, 2024
Adds support for adding item flags https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html to item drops. Formatting for flags is very specific, please see usage below:

```yaml
    # Example without any flags, showing enchantment and name/lore specifications
    drop: diamond_sword@!unbreaking#2!sharpness#3!~name?;lore?;no flags

    # Example with hide enchant and hide attributes flags, showing usage with enchantments and custom name/lore
    drop: diamond_sword@hide_enchants;HIDE_ATTRIBUTES;unbreaking#2!sharpness#3!~name?;lore?;testing attribute in lore;hide_enchants```

Important notes: Item flags **MUST** be defined **before** all item *enchantments, custom name, and lore* specifications, and must be separated with a `;` which is also now **required before** the enchantment/name string begins.
@CoolLord22 CoolLord22 added the ✓ Implemented A fix has been implemented. Issue will remain open pending code merge into master branch label Jun 24, 2024
@CoolLord22
Copy link
Owner

TODO: Look into adding item flag specification for tools as well, to allow restriction for items with item flags on interaction/use triggers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
+ Enhancement A feature request. ✓ Implemented A fix has been implemented. Issue will remain open pending code merge into master branch
Projects
None yet
Development

No branches or pull requests

2 participants