HomeJavaModsSimple Random Crates
Simple Random Crates
Introduction to the Skript:
This skript was made to make crate creations easier for my server setup. No config edits needed, they are fully in-game command/gui based.

Make an infinite amount of crates with up to 24 winning items. These items have no chances set as they are randomly drawn. Lots of fun features to mess around with and can be customised.

Required Addons:
Skellett https://www.spigotmc.org/resources/skript-java-addon-skellett.34361/
SkQuery https://www.spigotmc.org/resources/skquery-1-9-1-15.36631/
SkRayFall https://sk.rayfall.net/
Tuske https://www.spigotmc.org/resources/tuske.25136/

Installation:
Drag and drop ARandomCrates.sk into Skript/scripts/
run the command " /sk reload ARandomCrates "
enjoy

Config Section:
Code (Text):

    # Created By: 3asel
    # Version: 1.1

    prefix: &a&lCrates
    command: crate
    aliases: crates
    permission: crates.admin

    # If the crate open msg is sent for skript code winnings.
    skriptOpenMsg: false
    primaryColour: &a
 
Commands:
Code (Text):
/crate create <name> - Create a new crate
/crate edit - Edit a crate
/crate add <item/skript> <code> - Add an item or skript to a crate
/crate move <name> - Move a crate to a new location
/crate rename <name> - Rename a crate
/crate reload - Reload all crates (fixes holograms/blocks)
/crate list <page> - List and teleport to crates
/crate key <name> <amount> <player> - Give a player a crate key

When running crate creation/editing commands, you must be looking at a crate or new block.
Spoiler: Tutorials
1. Create a new crate
While looking at a solid block (such as chest, ender chest or enchant table) run the following command: /crate create <name>
Replace <name> with the name of the crate, such as: &6Legend

2. Add Items To Winnings
To add an item to a crate, looking at the crate and holding the item, run the following command: /crate add item
To add a skript code to a crate, looking at the crate, run the following command: /crate add skript <code>
Replace <code> with a skript code such as: add 1 to player's balance

3. Remove/Edit Winnings

To remove items from a crate, while looking at the crate, run the following command: /crate edit
Click the "Crate Winnings" item, this will open the crate winnings menu. You can click these items to remove them from the crate or edit the look of them.

4. Change Crate Block

While looking at the crate, run the following command: /crate edit
Drag and drop a solid block (such as a chest, ender chest or enchant table) onto the "Crate Block" item in the menu, this will swap the crate block to the new block.

5. Move A Crate

While looking at a new solid block (such as a chest, ender chest or enchant table) run the following command: /crate move <name>
replace <name> with the name of the crate you want to move.

6. Rename A Crate

While looking at the crate, run the following command: /crate rename <name>
Replace <name> with the new name of the crate, such as: &bLegend

7. Find A Crate

Run the following command: /crate list <page>
This will open the menu of all created crates. You can click to teleport to any of the crates.

8. Give Crate Keys

Run the following command: /crate key <name> <amount> <player>
Replace <name> with the name of the crate, such as: &bLegend
Replace <amount> with the amount of keys you want to give
Replace <player> with the name of the player you want to give the key to, you can leave this blank to give to yourself.

9. Delete A Crate

While looking at the crate, run the following command: /crate edit
Click on the "Delete Crate" item then click the confirmation item in the deletion menu. The second menu is to make sure hat you are sure.

10. Chat edit messages visible

If messages are visible when editing name/descriptions of winnings, make sure the script is above all scripts with an on chat: event in it, to override it. Reload any scripts with an on chat: event following the reload of the crates script.
If the messages are still visible, for other scripts with an on chat: event, add a "if event is not canceled" to it:
Code (Text):
on chat:
    if event is not canceled:
        # do stuff

TODO:
Make all messages configurable
Create a toggle for what kind of UI is wanted for key opening
Add a choice to add chances to items
Add more crate types (maybe players can create simple crates for selling off items?)
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Simple Random Crates is a free Minecraft Java mod. Compatible with Minecraft 1.15. Downloaded 867 times (via Spigot). Download it and open it directly in the game.

Explore more