Hebbinkpro / MagicCrates

Add customizable crates to your server
GNU General Public License v3.0
4 stars 6 forks source link

Configuration is unclear #30

Closed TrinitroToluen0 closed 5 months ago

TrinitroToluen0 commented 6 months ago

So i can't configure the chance and the amount separately? Your plugin has dynamic chances, but it is not clear how to set static chances (if possible)

The default configuration format is also weird, look at dirt, it has two "amount" properties, also, i think the "rewards" property should be an array of objects and not an object of objects, since you don't need a key-value system there.

Consider refactoring the configuration because its so confusing

  "common": {
    "name": "§cCommon §6Crate",
    "rewards": {
      "iron": {
        "name": "Common Iron",
        "amount": 5,
        "item": {
          "id": "iron_ingot"
        }
      },
      "dirt": {
        "name": "Dirt",
        "amount": 15,
        "item": {
          "id": "dirt",
          "amount": 2
        }
      }
    }
  },
Hebbinkpro commented 6 months ago

Hi, I understand your confusion about the configuration, but this was the best I came up with as the logic is also quite complex. I'm happy to receive your feedback to make it clearer.

For creating dynamic rewards (rewards with probabilities that can change depending on how many times the reward is receive by the player or the whole server) the properties and options are listed in the Crate Reward section of the Documentation. If you have any further questions about how to create dynamic rewards feel free to ask.

About the amount properties, each reward has an amount property which indicates how much of the reward is inside the crate. E.g. if you have rewards with amounts 5, 2 and 3, the total amount of rewards inside the crate is 5+2+3=10 and the probabilities to get each of the rewards is 5/10=0.5=50%, 20% and 30% respectively. The other amount you are referring to is item.amount which is the amount of the item you receive when you receive the reward. E.g. If you receive the reward dirt (from your provided JSON) you will always receive 2 dirt blocks. That is why there are both reward.amount and reward.item.amount, but if you have a suggestion about more distinct names, feel free to mention them.

Your suggestion about changing the rewards object-object structure into an list-object structure is currently possible (as stated in the docs), but it will probably be removed in a future version. Because of the way dynamic rewards work it is safer to use an object-object structure as each reward should be uniquely identified, as all rewards are stored in the database identified by their key. Using a list-object structure will give you less control about the unique key as they are dependent on the order inside the list. When you insert a new reward in between already existing rewards, the keys of all rewards after the inserted reward will change (as the order of the list changed) which can break some of the systems as the entries in the database will not match their corresponding rewards. Using an object-object structure fixes these issues as they have static keys which makes it also easier for you to view the contents of the database or alter the amount of a certain reward a player has received.

If you have any further questions or improvements, feel free to mention them.