SpinCrates
SpinCrates
An advanced crate plugin



Commands & Permissions:
  • /spincrates or /crates: Admin command for SpinCrates.
  • SpinCrates.admin: Allows a player to use /spincrates.
Configuration files:
  • config.yml: The main configuration with the different crate tiers.
  • lang.yml: The language file containing all the messages.
  • rewards.yml: Automatic rewards configuration for SpinCrates.
Default configuration (config.yml):
Code (YAML):
# Configuration file for SpinCrates.
# For more information about the different configuration files,
# please visit: https://www.spigotmc.org/resources/spincrates.19574/

##### VOTE CRATE #####

vote:
duration: 10
title: '&5• &d&lVote Crate'
hologram: '&8&l<&d Vote&5-&dCrate &8&l>'
size: 9
finalslot: 4
torchslots: []
glassslots: []
spinnerslots: [0,1,2,3,4,5,6,7,8]
effect: 'Villager Happy'

nokeyvelo: 0.6 # 0 = No knockback, 1 = About about 6 to 7 blocks
nokeysound: 'BLOCK_CHEST_LOCKED 5 10'
opensound: 'BASS_GUITAR C Natural 1'
ticksound: 'UI_BUTTON_CLICK 1 5'
endsound: 'ENTITY_ARROW_HIT_PLAYER 10 10'

key:
type: TRIPWIRE_HOOK
amount: 1
data: 0
name: '&6&l>&b Vote Key &6&l<'
lore:
- '&7A key for a vote crate'
enchants:
DURABILITY: 1

items:
4tnt:
type: TNT
amount: 4
data: 0
chance: 30
lore:
- '&7&o(Found in a vote crate)'
broadcast: '&8{PLAYER}&7 has found &84 TNT&7 in a vote crate!'
message: '&7You found &84 TNT&7 in a vote crate!'
epickey:
type: NETHER_STAR
name: '&9&k|&b Epic Key &9&k|'
chance: 0 # This means this item will be disabled. Also works if this line is removed.
lore:
- '&7A key for an epic crate'
enchants:
DURABILITY: 1
broadcast: '&8{PLAYER}&7 has found an &8epic key&7 in a vote crate!'
message: '&7You found an &8epic key&7 in a vote crate!'

commands:
heal:
type: GOLDEN_APPLE
chance: 10
name: '&7Heal'
lore:
- '&7&o(Found in a vote crate)'
command:
- 'feed {PLAYER}' # For WorldEdit commands, use // at the beginning: //<command>
- 'heal {PLAYER}'
broadcast: '&8{PLAYER}&7 was &8healed&7 by a vote crate!'
message: '&7You were healed by a vote crate!'
kitdtools:
type: DIAMOND_PICKAXE
chance: 10
name: '&7Diamond Tools'
lore:
- '&7&o(Found in a vote crate)'
enchants:
DURABILITY: 1
command: 'kit {PLAYER} dtools'
broadcast: '&8{PLAYER}&7 has found a &8dtools kit&7 in a vote crate!'
message: '&7You found a &8dtools kit&7 in a vote crate!'
none:
type: STAINED_GLASS_PANE
data: 15
chance: 40
name: '&7Nothing'
lore:
- '&7&o(Found in a vote crate)'
broadcast: ''
message: '&7You didn''t win anything in this vote crate...'

##### REWARD CRATE #####

reward:
duration: 15
title: '&2• &a&lReward Crate'
hologram: '&2&k|&a Reward&2-&aCrate &2&k|'
size: 27
finalslot: 13
torchslots: [22]
glassslots: [0,1,2,3,4,5,6,7,8,18,19,20,21,23,24,25,26]
spinnerslots: [9,10,11,12,13,14,15,16,17]
effect: 'Flame'

nokeyvelo: 0.6
nokeysound: 'BLOCK_CHEST_LOCKED 5 10'
opensound: 'BASS_GUITAR C Natural 1'
ticksound: 'UI_BUTTON_CLICK 1 5'
endsound: 'ENTITY_ARROW_HIT_PLAYER 10 10'

key:
type: MAGMA_CREAM
amount: 1
data: 0
name: '&2&k|&a Reward Key &2&k|'
lore:
- '&7A key for a reward crate'
enchants:
DURABILITY: 2

items:
beacon:
type: BEACON
chance: 15
lore:
- '&7&o(Found in a reward crate)'
broadcast: '&8{PLAYER}&7 has found a &8beacon&7 in a reward crate!'
message: '&7You found a &8beacon&7 in a reward crate!'
3gapples:
type: GOLDEN_APPLE
data: 1
chance: 15
lore:
- '&7&o(Found in a reward crate)'
broadcast: '&8{PLAYER}&7 has found &83 notch apples&7 in a reward crate!'
message: '&7You found a &83 notch apples&7 in a reward crate!'
16diamonds:
type: DIAMOND
amount: 16
chance: 15
lore:
- '&7&o(Found in a reward crate)'
broadcast: '&8{PLAYER}&7 has found &816 diamonds&7 in a reward crate!'
message: '&7You found &816 diamonds&7 in a reward crate!'

commands:
vipkit:
type: GOLD_SWORD
chance: 15
name: '&7VIP Kit'
lore:
- '&7&o(Found in a reward crate)'
enchants:
DURABILITY: 1
command: 'kit {PLAYER} vip'
broadcast: '&8{PLAYER}&7 has found a &8VIP kit&7 in a reward crate!'
message: '&7You found a &8VIP kit&7 in a reward crate!'
viprank:
type: GOLD_CHESTPLATE
chance: 5
name: '&7VIP Rank'
lore:
- '&7&o(Found in a reward crate)'
enchants:
DURABILITY: 1
command: 'manuadd {PLAYER} VIP'
broadcast: '&8{PLAYER}&7 has found a &8VIP rank&7 in a reward crate!'
message: '&7You found a &8VIP kit&7 in a reward crate!'
none:
type: STAINED_GLASS_PANE
data: 15
chance: 35
name: '&7Nothing'
lore:
- '&7&o(Found in a reward crate)'
broadcast: ''
message: '&7You didn''t win anything in this reward crate...'

##### EPIC CRATE #####

epic:
duration: 20
title: '&9• &b&lEpic Crate'
hologram: '&6&k|&b Epic&9-&bCrate &6&k|'
size: 45
finalslot: 22
torchslots: [31]
glassslots: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44]
spinnerslots: [18,19,20,21,22,23,24,25,26]
effect: 'Lava'

nokeyvelo: 0.6
nokeysound: 'BLOCK_CHEST_LOCKED 5 10'
opensound: 'BASS_GUITAR C Natural 1'
ticksound: 'UI_BUTTON_CLICK 1 5'
endsound: 'ENTITY_ARROW_HIT_PLAYER 10 10'

key:
type: NETHER_STAR
amount: 1
data: 0
name: '&9&k|&b Epic Key &9&k|'
lore:
- '&7A key for an epic crate'
enchants:
DURABILITY: 3

items:
beacon:
type: BEACON
chance: 20
lore:
- '&7&o(Found in an epic crate)'
broadcast: '&8{PLAYER}&7 has found a &8beacon&7 in an epic crate!'
message: '&7You found a &8beacon&7 in an epic crate!'
3gapples:
type: GOLDEN_APPLE
data: 1
chance: 20
lore:
- '&7&o(Found in an epic crate)'
broadcast: '&8{PLAYER}&7 has found &83 notch apples&7 in an epic crate!'
message: '&7You found a &83 notch apples&7 in an epic crate!'
16diamonds:
type: DIAMOND
amount: 16
chance: 20
lore:
- '&7&o(Found in an epic crate)'
broadcast: '&8{PLAYER}&7 has found &816 diamonds&7 in an epic crate!'
message: '&7You found &816 diamonds&7 in an epic crate!'

commands:
mvpkit:
type: DIAMOND_SWORD
chance: 15
name: '&7MVP Kit'
lore:
- '&7&o(Found in an epic crate)'
enchants:
DURABILITY: 1
command: 'kit {PLAYER} mvp'
broadcast: '&8{PLAYER}&7 has found a &8MVP kit&7 in an epic crate!'
message: '&7You found a &8MVP kit&7 in an epic crate!'
mvprank:
type: DIAMOND_CHESTPLATE
chance: 5
name: '&7VIP Rank'
lore:
- '&7&o(Found in an epic crate)'
enchants:
DURABILITY: 1
command: 'manuadd {PLAYER} MVP'
broadcast: '&8{PLAYER}&7 has found a &8MVP rank&7 in an epic crate!'
message: '&7You found a &8MVP kit&7 in an epic crate!'
none:
type: STAINED_GLASS_PANE
data: 15
chance: 20
name: '&7Nothing'
lore:
- '&7&o(Found in a epic crate)'
broadcast: ''
message: '&7You didn''t win anything in this epic crate...'

This configuration contains all the crate tiers with all the information for each one. Here is the model:
Code (YAML):
<string>: # The name of the crate that will be used for giving keys...
duration: <int> # The duration in ticks of the opening
title: '<string>' # The title of the GUI (max. 24 characters). Use & for colors
hologram: '<string>' # The hologram on top of the crate. Use & for colors
size: <int> # The size of the crate while opening (MUST be a multiple of 9)
finalslot: <int> # The slot containing the item that will be considered as the reward
torchslots: [<int>] # The slots where a redstone torch should be
glassslots: [<int>, <int>, <int>...] # The slots where there should be random glass panes (Note: the inventory slots start at 0, the first slot)
spinnerslots: [<int>, <int>, <int>...] # The slots where the items will spin (Note: they are in the reverse order: the last slot is where the new items pop)
effect: <effect> # The effect played around the crate (EXPLOSION_NORMAL,EXPLOSION_LARGE,EXPLOSION_HUGE,FIREWORKS_SPARK,WATER_BUBBLE,WATER_SPLASH,WATER_WAKE,SUSPENDED,SUSPENDED_DEPTH,CRIT,CRIT_MAGIC,SMOKE_NORMAL,SMOKE_LARGE,SPELL,SPELL_INSTANT,SPELL_MOB,SPELL_MOB_AMBIENT,SPELL_WITCH,DRIP_WATER,DRIP_LAVA,VILLAGER_ANGRY,VILLAGER_HAPPY,TOWN_AURA,NOTE,PORTAL,ENCHANTMENT_TABLE,FLAME,LAVA,FOOTSTEP,CLOUD,REDSTONE,SNOWBALL,SNOW_SHOVEL,SLIME,HEART,BARRIER,ITEM_CRACK,BLOCK_CRACK,BLOCK_DUST,WATER_DROP,ITEM_TAKE,MOB_APPEARANCE)

nokeyvelo: <double> # The velocity at which the player will be thrown if he doesn't have a key.
nokeysound: '<string> <int> <int>' # The sound played to the player if he doesn't have a key.
opensound: '<string> <string> <string> <int>' # The sound played to the player when he opens the crate.
ticksound: '<string> <int> <int>' # The sound played to the player each time the items change slot.
endsound: '<string> <int> <int>' # The sound played to the player when the crate opening ends.

key:
type: <item> # The item type of the key (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html)
amount: <int> # The amount of items that will be displayed
data: <int> # The durability of the item (color of wool/clay/glass, notch apple...)
name: '<string>' # The display name of the key item
lore: # The lore of the key item, displayed below the enchantments
- '<string>' # Each string here is a different line.
- '<string>'
- '...'
enchants: # The different enchantments with their level
<enchantment>: <int> # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html

items:
<string>: # The name of the reward, you can actually put anything (MUST be unique in the items section)
chance: <int> # The chance of getting this item (this is relative to other items so they can add up to anything you want but making them out of 100 is clearer)
# Here you can put the same values as in the "key" section (you MUST specify an item type)
broadcast: '<string>' # The message broadcasted when a player (you can use {PLAYER}) receives this reward
message: '<string>' # The message sent only to the player who received this reward

commands:
<string>: # The name of the reward, you can actually put anything (MUST be unique in the commands section)
# Here you can put the same values as in a sub-section in "items"
command: '<string>' # The command to be executed when the player receives this reward (without the slash at the beginning unless it's a WorldEdit command)
Language file (lang.yml):
Code (YAML):
# Language file for SpinCrates.

notcrate: '&cThis block isn''t a crate!'
usage: '&cUsage: /spincrates <create/delete/key/reload/list/playtime>'
usagecreate: '&cUsage: /spincrates create <type>'
usagekey: '&cUsage: /spincrates key <player> <type>'
usageplaytime: '&cUsage: /spincrates playtime <player>'
alreadycrate: '&cThis block is already crate!'
console: '&cYou cannot use this in the console!'
nokey: '&cYou need a &4{CRATE} key&c to open this!'
permission: '&cYou don''t have permission to do this!'
notplayer: '&cThe player you specified doesn''t exist!'
invalid: '&cThe crate type you specified isn''t valid!'
looking: '&cYou must be looking towards a solid block!'
notype: '&cYou haven''t created any crate type yet!'

prefix: '&8&l<&d Spin&5-&dCrates &8&l>&r '
given: '&aYou gave &2{PLAYER}&a a &2{CRATE} key&a.'
received: '&2{PLAYER}&a gave you a &2{CRATE} key&a.'
selfgive: '&aYou received a &2{CRATE} key&a.'
deleted: '&aYou successfully deleted a &2{TYPE}&a crate.'
created: '&aYou successfully created a &2{TYPE}&a crate.'
reloaded: '&aConfiguration files and crates have been reloaded!'
listhead: '&aYou''ve created {AMOUNT} crate types ({VALID} loaded, &c{INVALID} invalid&a):'
playstats: '&aActivity report on the player &2{PLAYER}&a:\n&2First Login: &a{FIRST_JOIN}\n&2Last Login: &a{LAST_JOIN}\n&2Total PlayTime: &a{TOTAL_TIME}\n&2Average PlayTime: &a{AVERAGE_TIME} hours/day'

This should be straightforward especially with the default messages.
To use special characters, get their Unicode value and use:
Code (YAML):
langname: "Your message with a \u1F642"
If you need more in-depth help, please PM me.

Rewards configuration (rewards.yml):
Code (YAML):
# Automatic rewards configuration for SpinCrates.

# This section is to configure where SpinCrates is going to save statistics about your players.
# If enabled is false, it will only read the database and never write data to it.
# If you don't have an available database or if you prefer file storage, use sqlite: true.
# Be careful, if you turn off sqlite (false), your database information must be correct.
onlinestats:
enabled: true
sqlite: true
host: '127.0.0.1'
port: '3306'
user: 'username'
pass: 'password'
base: 'spincrates_db'

# Give crate keys when the server reaches a certain number of votes.
# To disable this, just remove all the vote section or put vote: {}
# The recurrent option will make it so it is EVERY <amount> and not AT <amount>.
vote:
basic:
amount: 3
period: 24h
recurrent: true
crate: vote
progress: '&7Next &8vote key&7 giveall in &8{LEFT}&7 votes!'
broadcast: '&7The server reached &83&7 votes! You received a &8vote key&7.'
common:
amount: 5
period: 24h
crate: reward
progress: '&aNext &2reward key&a giveall in &2{LEFT}&a votes!'
broadcast: '&aThe server reached &25&a votes! You received a &2reward key&a.'
rare:
amount: 5
period: 5m
keys: 2
crate: reward
broadcast: '&aThere was &25&a votes in &25 min.&a! You received &22 reward keys&a.'
legendary:
amount: 10
period: 24h
crate: epic
broadcast: '&bThe server reached &610&b votes! You received &6an epic key&b.'

# Give crate keys when a player stays a certain amount of time on the server.
# To disable this, just remove all the playtime section or put playtime: {}
# The type can be TOTAL (total time spent on the server),
# CONSECUTIVE (the time since his last join),
# SINCEFIRST (the time since his first join),
# JOINED (number of times the player joined)
playtime:
basic:
amount: 1h
type: CONSECUTIVE
recurrent: false
crate: reward
broadcast: '&a{PLAYER} won a &2reward key&a for playing &21h&a!'
message: '&aYou received a &2reward key&a for playing &21h&a! &2Thanks&a!'
common:
amount: 3h
type: TOTAL
recurrent: true
crate: reward
broadcast: '&a{PLAYER} won a &2reward key&a for playing &23h&a!'
message: '&aYou received a &2reward key&a for playing &23h&a! &2Thanks&a!'
rare:
amount: 5d
type: TOTAL
recurrent: false
crate: epic
broadcast: '&b{PLAYER} won an &6epic key&b for playing &65 days&b!'
message: '&bYou received an &6epic key&b for playing &65 days&b! &6Thanks&b!'
legendary:
amount: 10d
type: TOTAL
recurrent: true
crate: epic
keys: 2
broadcast: '&b{PLAYER} won &62 epic keys&b for playing &610 days&b!'
message: '&bYou received &62 epic keys&b for playing &610 days&b! &6Thanks&b!'
veteran:
amount: 1y
type: SINCEFIRST
recurrent: false
crate: epic
keys: 3
broadcast: '&b{PLAYER} won &63 epic keys&b for staying &61 year&b!'
message: '&bYou received &63 epic keys&b for staying &61 year&b! &6Thanks&b!'
This configuration file contains two parts: the vote and the playtime rewards.
To use the vote configuration section, you must have installed and setup Votifier.
Code (YAML):
# This section is to configure where SpinCrates is going to save statistics about your players.
# If enabled is false, it will only read the database and never write data to it.
# If you don't have an available database or if you prefer file storage, use sqlite: true.
# Be careful, if you turn off sqlite (false), your database information must be correct.
onlinestats:
enabled: <boolean> # If SpinCrates should save the online stats information or simply read it (always set this to true unless you know what you're doing).
sqlite: <boolean> # If it should use a file for the database or the following database.
host: <string> # The host to connect to for the database.
port: <int> # The port to connect to for the database.
user: <string> # The user to connect to the database.
pass: <string> # The password of the user above.
base: <string> # What database to select for SpinCrates.

# Give crate keys when the server reaches a certain number of votes.
# To disable this, just remove all the vote section or put vote: {}
# The recurrent option will make it so it is EVERY <amount> and not AT <amount>.
vote:
<string>: # The name of the automatic reward, you can actually put anything (MUST be unique in the playtime section)
amount: 3
period: <time> # This must be a number followed by s (seconds), m (minutes), h (hours), d (day) or y (year) ; you can put a space and start again
recurrent: <boolean> # The recurrent option will make it so it is EVERY <amount> and not AT <amount>
crate: <cratetype> # The crate name (used in config.yml) that will be given
keys: <int> # The amount of keys that will be given
progress: '<string>' # The message broadcasted each time a vote is made before the server reaches this ; use {LEFT} for the amount of votes left before the reward
broadcast: '<string>' # The message broadcasted when the server reaches this amount of votes
The second part, playtime, doesn't require any other plugin, as these statistics are counted internally.
Code (YAML):
# Give crate keys when a player stays a certain amount of time on the server.
# To disable this, just remove all the playtime section or put playtime: {}
# The type can be TOTAL (total time spent on the server),
# CONSECUTIVE (the time since his last join),
# SINCEFIRST (the time since his first join),
# JOINED (number of times the player joined)
playtime:
<string>: # The name of the automatic reward, you can actually put anything (MUST be unique in the playtime section)
amount: <time> # This is the same format as above in the period of the vote section
type: <rewardtype> # See above for the list of available values and their description
recurrent: <boolean> # This is the same option as recurrent in the vote section above
crate: <cratetype> # This is the same option as crate in the vote section above
keys: <int> # This is the same option as keys in the vote section above
broadcast: '<string>' # The message broadcasted when a player (you can use {PLAYER}) reaches this
message: '<string>' # The message sent only to the player who reaches this
Incoming Features:

  • Multiple opening of the same crate at the same time (always for a specific crate, or the player chooses in a GUI).
  • Advanced debugging help for crate types (tells you what's wrong and where).
Author
MikeyBoy
Downloads
128
Views
847
Extention type
jar
File size
55.8 KB
Hash
9fe5f137a4c1859eb8dc4fe2f4fdfd11
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from MikeyBoy

Share this resource

Top