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

Greater custom item support (NBT, custom attributes, etc.) #252

Open
bow-official opened this issue Jun 13, 2024 · 3 comments
Open

Greater custom item support (NBT, custom attributes, etc.) #252

bow-official opened this issue Jun 13, 2024 · 3 comments
Labels
feature request New feature request

Comments

@bow-official
Copy link

NOTE: This may be more of a bug, but I chose feature request as I have seen other issues with this label that are requesting features included under the scope of this request.

Description of the feature
This involves allowing items to have custom properties (such as attributes, NBT, and custom model data) by storing more data. While I know the plugin already has custom abilities, as a developer who works with NBT in my own plugins, I can say it would greatly benefit me to have this method.

How the feature is useful
This would allow easier item integration with external plugins (eg. Oraxen), allow for custom textures, and cover the functionality of #136 as well. This may also be able to solve #250 due to this allowing items such as that to be directly integrated into the kit.

Implementations in other plugins
An example of a plugin that has a feature like this is SkyWarsReloaded. Here's an example of how it handles my Oraxen item (of course, this could be done in a number of different ways):

items:
    - ==: org.bukkit.inventory.ItemStack
      v: 3465
      type: BLUE_ICE
      meta:
        ==: ItemMeta
        meta-type: UNSPECIFIC
        display-name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"aqua","text":"Frost
          "},{"italic":false,"color":"gray","text":"Grenade"}],"text":""}'
        lore:
        - '{"extra":[{"text":" "}],"text":""}'
        - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"aqua","text":"Damage
          and slow all players in a 10 block radius."}],"text":""}'
        - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Right
          click to use."}],"text":""}'
        - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"30
          second cooldown"}],"text":""}'
        - '{"extra":[{"text":" "}],"text":""}'
        - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gold","text":"Rarity:
          "},{"italic":false,"color":"white","text":"ꐼ"}],"text":""}'
        custom-model-data: 1001
        PublicBukkitValues:
          oraxen:id: frost_grenade
          oraxen:original_name: §bFrost §7Grenade
          oraxen:unstackable: '[B;-127B,-92B,94B,-124B,-15B,79B,65B,124B,-115B,-68B,-110B,14B,43B,-10B,-81B,5B]'
@bow-official bow-official added the feature request New feature request label Jun 13, 2024
@bow-official
Copy link
Author

This could also be solved by just adding Oraxen support and directly using its API, but I feel the original solution would be superior, as it would support a range of plugins and methods of adding custom items.

@cervinakuy cervinakuy changed the title Greater custom item support Greater custom item support (NBT, custom attributes, etc.) Jun 14, 2024
@cervinakuy
Copy link
Owner

cervinakuy commented Jun 14, 2024

I wholeheartedly agree. However, I just do not have the freetime at this point to pursue such a feature.

I would support PRs that neatly implement NBT/etc. into the kit system. As you do mention you are a developer, I would encourage you to give it a shot! Or, for others interested in contributing this type of feature, I'd encourage looking at Bukkit's already built-in serialization (which the referenced SkyWarsReloaded implementation uses), or looking at well-maintained wrappers like XItemStack from XSeries. I believe it uses Bukkit's serialization under the hood and could be even more straightforward to integrate serializing/deserializing these custom attributes. KitPvP already uses a number of XSeries' great libraries.

@bow-official
Copy link
Author

I have some more time to dedicate to this project now, so I will start trying to make a pull request. Thanks for the resources.

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

No branches or pull requests

2 participants