Tale of Kingdoms: A new Conquest

Tale of Kingdoms: A new Conquest

49.7k Downloads

Make shop items use json

SamB440 opened this issue ยท 2 comments

commented

Currently shop items are all individually defined in class files. This is very messy and is going to become a problem in the future.

It would be nice to store this data in json instead, so it is also modifiable.

I recommend something like the following format:

"BREAD": {
    "cost": 32,
    "name": "Bread" 
  }

Or, you could just have a simple key-value format and generate the name field automatically.

Another consideration to take into account is that the item type will have to be retrieved somehow.
Currently it is done like so:

@Override
public Item getItem() {
    return Items.BREAD;
}

Reflection in some way will likely have to be used.

commented

mentioned in commit bed17c3

commented

In GitLab by @JordanPlayz158 on Jun 6, 2021, 18:03

mentioned in commit 80219dd