EssentialsX

EssentialsX

2M Downloads

Handling of aliases in 1.13 and items.csv replacement.

dscalzi opened this issue ยท 3 comments

commented

Hello,

Version 1.13 is fast approaching. As you probably know, all data values are being removed from the game. With this, the deprecated methods in the Bukkit API allowing ItemStack manipulation with these values are being removed. That will render the items.csv file unusable since it is entirely based on the legacy values. One of my plugins relies on this file for alias referencing, and therefore I've been working on a script to convert the values into JSON format.

Below is an example conversion of a relatively simple item, charcoal.

charcoal,263,1
ccoal,263,1
    {
      "spigot": {
        "material": "COAL",
        "data": {
          "type": "CHARCOAL",
          "class": "org.bukkit.material.Coal"
        }
      },
      "legacy": {
        "id": 263,
        "data": 1
      },
      "aliases": [
        "charcoal",
        "ccoal"
      ]
    }

An example of a more involved item, Healing II Potion.

healingleveliipotion,373,8229
healleveliipotion,373,8229
healinglevel2potion,373,8229
heallevel2potion,373,8229
healingiipotion,373,8229
healiipotion,373,8229
healingleveliipot,373,8229
healleveliipot,373,8229
healinglevel2pot,373,8229
heallevel2pot,373,8229
healingiipot,373,8229
healiipot,373,8229
h2pot,373,8229
    {
      "spigot": {
        "material": "POTION",
        "data": {
          "type": "INSTANT_HEAL",
          "extended": false,
          "upgraded": true,
          "class": "org.bukkit.inventory.meta.PotionMeta"
        }
      },
      "legacy": {
        "id": 373,
        "data": 8229
      },
      "aliases": [
        "healingleveliipotion",
        "healleveliipotion",
        "healinglevel2potion",
        "heallevel2potion",
        "healingiipotion",
        "healiipotion",
        "healingleveliipot",
        "healleveliipot",
        "healinglevel2pot",
        "heallevel2pot",
        "healingiipot",
        "healiipot",
        "h2pot"
      ]
    }

The goal of this format is to enable item alias storage without depending on legacy values. I've explored ways to have the data version tagged, however each solution was either complicated to parse or messy in general. Unless anyone has any suggestions, this file should probably be version dependent.

Please let me know what you think of this format, and if it should be changed in any way. I have a fully complete file generated using my conversion plugin. I'll upload that to github and link that soon.

Conversion Util Repository

This is a continuation of #1448

commented

Update: Working on a new format for 1.13. The format will come with a library to parse file JSON file and perform any other common functions (searching by alias, etc).

New repo -> https://github.com/dscalzi/ItemCodex

At the moment I don't have any plans to backport this to 1.12, however that may be a future goal. One of my plugins will use this for 1.13 compatibility when it's done.

commented

Update:

  • Moved repo to https://github.com/dscalzi/ItemCodexLib
  • Library works, still working on the following:
    • Method for versioning & updating the items.json file during future updates. Added a field revision to the JSON file. If the internal revision is greater than the one in the existing file, it will be overriden and updated.
    • Adding new 1.13 items and aliases.

Feel free to submit any PRs or suggest changes. When it's solid and ready for production (based on our discretion), I'll push it to jcenter for use in maven/gradle.

@md678685 Let me know what you think.

commented

1.13 items added and existing items have been cleaned up https://github.com/dscalzi/ItemCodexLib