Crates

Description

The Crates addon adds the ability to create crates that will give players certain rewards when they use keys to open them.

The crates have a fair amount of customization. Each crate can have many rewards and each reward can run any number of commands. Rewards are weighted so you can make certain rewards rarer than others.

Players can right click a crate with the correct key and it will open it once. Alternatively they can crouch and right click to use all the keys in their hand to open the crate that amount of times.

Commands

  • /crate chest [crate id] – Gives the player the Crate’s chest
  • /crate key [crate id] – Gives the player a single key for the Crate
  • /crate key [crate id] [qty] – Gives the player a certain amount of keys for the Crate
  • /crate key [crate id] [players] – gives another player/players a single key for a Crate
  • /crate key [crate id] [players] [qty] – gives another player/players a certain amount of keys for a Crate
  • /crate reload – Reloads the configs for Crates.

Crate

Name

This is the display name of the crate, used on keys/chests/messages/etc. It can use formatting codes (as well as SU color codes)

Id

The id of the crate should match the name of the json file. This should be a unique id to prevent conflicts with other crates.

Firework

This is the de-serialized firework item that will be spawned when the player opens the crate.
To put it plainly, this is the data of the rocket to spawn.

I would recommend to change what is there but don’t rewrite it completely unless you know what you are doing.

The colors can be changed fairly easily however, they use decimal format. I would suggest using a site like this to get the decimal format (don’t use hexadecimal in this config) for the colors you want:

https://www.mathsisfun.com/hexadecimal-decimal-colors.html

Locations

The locations for this crate is simply a list of where on the server your crates are located.
You shouldn’t have to change this manually unless there are issues.

When you place the Crate it will save the location that you placed it.
When you break it, it will remove the location from the file.
Keep in mind that to break a Crate you need to be in creative.

Rewards

Each reward has the same structure:

    {
      "name": "Testing Reward",
      "weight": 1,
      "commands": []
    }

Name

This is simply the display name of the reward. You can use color codes (as well as SU color codes) to format the name.

Weight

The weight is used to figure out which reward to give the player. The math is: weight / total weight = chance.

For example, if you have 2 rewards where one has a weight of 9 and the other has a weight of 1 then there is a 90% chance to get the first one and a 10% chance to get the second one.

Commands

All of the commands in a reward are run when the reward is given and will replace {player} with the player’s name.
To add a reward to the list, insert the command surrounded with quotes. Don’t include the slash.

For example, to have a reward give a player a diamond and heal them you would have this:

    {
      "name": "Testing Reward",
      "weight": 1,
      "commands": [
        "give {player} diamond",
        "heal {player}"
      ]
    }