nikosgram / gringotts

Gringotts is an item-based economy plugin for the Bukkit Minecraft server platform. Unlike earlier economy plugins, all currency value and money transactions are based on actual items in Minecraft, per default emeralds.
https://www.spigotmc.org/resources/gringotts.42071/
BSD 2-Clause "Simplified" License
42 stars 35 forks source link

Issues with adding custom items #153

Closed dentatar closed 1 year ago

dentatar commented 1 year ago

Describe the bug I'm trying to add denominations for Slimefun items, for example Carbon and Synthetic diamond. Currency configuration (i also tried with double quotes and no quotes in displayname without any luck):

currency:
  name:
    singular: Diamond
    plural: Diamonds
  digits: 9
  named-denominations: false
  denominations:
    - material: coal
      value: 0.001953125
    - material: player_head
      value: 0.015625
      displayname: '&eCarbon'
    - material: diamond
      value: 1

Coal and regular diamond are working fine, but the Carbon and Synthetic diamond isn't… Here are their data:

{id: "minecraft:player_head", tag: {display: {Name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"yellow","text":"Carbon"}],"text":""}'}, PublicBukkitValues: {"slimefun:slimefun_item": "CARBON"}, SkullOwner: {Name: "CS-CoreLib", Id: [I; 1271302063, 432027983, -1620355014, 1090500715], Properties: {textures: [{Value: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGIzYTA5NWI2YjgxZTZiOTg1M2ExOTMyNGVlZGYwYmI5MzQ5NDE3MjU4ZGQxNzNiOGVmZjg3YTA4N2FhIn19fQ=="}]}}}, Count: 1b}
{id: "minecraft:diamond", tag: {display: {Name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"aqua","text":"Synthetic Diamond"}],"text":""}', Lore: ['{"text":""}', '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"This item can be used in a"}],"text":""}', '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"workbench and acts like a normal Diamond"}],"text":""}']}, PublicBukkitValues: {"slimefun:slimefun_item": "SYNTHETIC_DIAMOND"}}, Count: 1b}

I can even see yellow Carbon in /gringotts denominations but when i hold one or have one in my vault /balance displays zero. I guess it has to do something with NBT, because Synthetic diamonds are regular diamonds just with some tags and i expect them to match with material: diamond. Also tried to use meta for Carbon but it seems like partial match is broken too?

- material: player_head
  value: 0.015625
  meta:
    ==: ItemMeta
    meta-type: SKULL
    PublicBukkitValues:
      slimefun:slimefun_item: CARBON

To Reproduce Steps to reproduce the behavior:

  1. Install Slimefun and Gringotts
  2. Paste my currency configuration
  3. /sf give <player name> CARBON /sf give <player name> SYNTHETIC_DIAMOND
  4. /balance

Expected behavior /balance should display 0.015625 Diamonds for every carbon and 1 for every regular OR synthetic diamond.

Screenshots 2023-06-29_07 00 28 2023-06-29_06 59 30

Desktop (please complete the following information):

Additional context I'm not sure if this is a bug or maybe i'm doing something wrong…

nikosgram commented 1 year ago

Thank you for reporting this issue :) I haven't try Slimefun before so I will need a bit more time understanding how it's working and why it's not properly working with Gringotts :)

dentatar commented 1 year ago

I end up adding items by their full data, for example Carbon works like that:

- material: PLAYER_HEAD
  value: 0.015625
  meta:
    ==: ItemMeta
    meta-type: SKULL
    display-name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"yellow","text":"Carbon"}],"text":""}'
    PublicBukkitValues:
      slimefun:slimefun_item: CARBON
    skull-owner:
      ==: PlayerProfile
      uniqueId: 4bc687af-19c0-394f-9f6b-583a40ffb86b
      name: CS-CoreLib
      properties:
      - name: textures
        value: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGIzYTA5NWI2YjgxZTZiOTg1M2ExOTMyNGVlZGYwYmI5MzQ5NDE3MjU4ZGQxNzNiOGVmZjg3YTA4N2FhIn19fQ==

And for Synthetic diamond:

- material: DIAMOND
  value: 1
  meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC
    display-name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"aqua","text":"Synthetic
      Diamond"}],"text":""}'
    lore:
    - '{"text":""}'
    - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"This
      item can be used in a"}],"text":""}'
    - '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"workbench
      and acts like a normal Diamond"}],"text":""}'
    PublicBukkitValues:
      slimefun:slimefun_item: SYNTHETIC_DIAMOND

My main concern is should't partial match by name/meta work as i expect? Or i am wrong with understanding it? Will be glad if you look into it, thx!

nikosgram commented 1 year ago

I recommend you use custom_model_data for identification, as display-name and lore are not as reliable for custom items.

For example:

  denominations:
    - material: emerald
      value: 1
          unit-name: Emeralde
          unit-name-plural: Emeraldes
          custom_model_data: 1
          ...