Crystals
On this page(22)
Crystals are virtual sword modifiers a player keeps in the storage of /crystals. Each crystal has a value and an apply chance. Applying it is a gamble: it lands on the sword or it is destroyed. You use crystals for the biggest multipliers in the game, behind a real risk.
| Files | modules/crystals/config.yml, modules/crystals/types/ (one file per crystal type), modules/crystals/tiers/ (one file per Crystal Box tier), modules/crystals/guis/, modules/crystals/lang/messages_en.yml |
| Player command | /crystals (alias /crystal) |
| Admin commands | /dungeons admin crystals ... |
| Switch | enabled: (first key of modules/crystals/config.yml) + /dungeons reload |
How it works
- Open a Crystal Box. It picks a type by weight and rolls a value and an apply chance (2 decimals each). The crystal goes straight into the storage.
- Apply it. A click on a storage crystal rolls its apply chance for the first free sword slot. Success: the crystal is on the sword. Failure: the crystal is destroyed.
- The factor. The crystals of one booster target multiply that target, as one factor.
- Remove it. A click on an applied crystal takes it off and destroys it. It is never given back.
When you remove a crystal, the ones after it move down one slot. Applied crystals always fill the slots from the first. With no free slot nothing is rolled.
Confirmations
- With
apply.confirm: true, a crystal below 100% asks for a second click withinconfirm-seconds. - With
remove.confirm: true, removing an applied crystal asks for a second click too.
The factor and other boosters
The applied crystals of one target push one multiplicative booster crystals-<target>, named booster-name. Its factor is 1 plus the sum of their values.
| Applied crystals | Factor |
|---|---|
0.07x | x1.07 |
4.44x, 3.20x and 5.06x | x13.70 |
A target's total is base x multi. The base is 1 plus every additive bonus: perks, auras, totems, attributes, armors and additive admin boosters. The multi is the sum of every multiplicative factor, or 1 without any.
So crystals alone multiply the whole additive total. Next to an admin x200 booster on the same target, the multi becomes 200 + 13.70 = 213.70. See Boosters.
The factor is pushed again on a join, an apply, a removal, a change of slots and every reload. It goes when the module is switched off.
Slots
slots.unlocks lists the swings (the swings stat) each slot opens at, slot 1 first. Its length is the most slots anyone can have (up to 10). The shipped list opens 2 slots for free, then slots at 500K, 1M and 2M swings.
A player has the slots their swings reached, or the highest <n> of sndungeons.crystals.slots.<n>, whichever is more. Admin extra slots add to that, never past the length of slots.unlocks. A locked slot shows the swings it needs and the player's swings.
A player who has fewer slots than crystals applied (a rank lost) gets the extra crystals back in the storage, never destroyed. This happens with a chat line when they join or open /crystals.
Withdraw and deposit
Withdraw Mode takes a storage crystal out as a tradeable item. It keeps its id, type, tier, value and chance. A right click with it stores it again as it was.
Every crystal has a global id. An item whose id any player already has (a duplicate) is refused with a console warning and given back. An applied crystal cannot be withdrawn: it can only be destroyed.
Filtering and Bulk Delete
Crystal Filtering (the hopper) lists every loaded type. A click filters the type (its tile glows) or receives it again. Clear Filtering receives every type again. Filters are saved per player.
A Crystal Box roll of a filtered type is destroyed, and the box is used up. One chat line says how many were discarded. Admin and API gives and deposited items are never filtered.
Bulk Delete (the TNT) deletes storage crystals by bucket, after a second click within confirm-seconds:
- Five apply chance buckets, 0-20% up to 81-100%.
- Five boost quality buckets. The quality is where a crystal's value sits in its tier's range for its type: 0% the lowest, 100% the highest.
Applied crystals and crystals of a type that is not loaded are never deleted.
The sword
The shipped item.lore of modules/sword/config.yml shows the crystals with two kinds of placeholders:
%sndungeons_crystals_header%givessword-lore.header, likeCrystals (3).%sndungeons_crystal_<n>_line%givessword-lore.linefor slot n, like│ Money Crystal (18.59%).
A lore line whose placeholders show nothing (an empty slot) is left out. The sword is redrawn after every apply and removal. The /sword menu has a Sword Crystals button (C), and the Go Back button of /crystals opens the sword menu. See Sword.
When you switch the module off, take the crystals lines out of the sword lore too. PlaceholderAPI then shows them as written.
Configuration
General
| Key | Default | What it does |
|---|---|---|
enabled | true | The module switch. Off: /crystals and every crystal factor go. Crystals and extra slots stay stored. |
display-name | '&dCrystals' | The module's name in /dungeons admin modules. |
slots.unlocks | [0, 0, 500000, 1000000, 2000000] | The swings each sword slot opens at. [] = no slot at all. |
apply.confirm | true | A crystal below 100% asks a second click before it is rolled. |
remove.confirm | true | Removing an applied crystal (it is destroyed) asks a second click. |
confirm-seconds | 3 | How long a confirming click is waited for (1 to 300). |
box-cooldown-ticks | 4 | Ticks between two right clicks with a box or a crystal item (0 to 200; 0 = none). |
value-decimals | 2 | The most decimals of values and chances shown (0 to 6). Trailing zeros are dropped. |
booster-name | '&dCrystals' | The name /boosts shows for the crystal factor. |
sword-lore
| Key | Default | What it does |
|---|---|---|
sword-lore.header | '&d&lCrystals &8({count})' | The header line. {count} = the crystals applied. Empty without an applied crystal. |
sword-lore.line | '{color}│ &f{type} Crystal &7({value})' | One line per slot. Takes {color}, {type}, {name}, {value}, {chance} and {tier}. |
box-item
The Crystal Box item of every tier. Its head and gradient come from the tier file.
| Key | Default | What it does |
|---|---|---|
box-item.name | '{name} &8[&e{stars}&8]' | {name} = the tier's name in its gradient, {stars} = one star per star, {tier} = its number. |
box-item.star | '★' | The star character. |
box-item.lore | seven lines | The {types} line repeats once per type the box gives. |
box-item.type-line | '{color}{type} &7({min} - {max})' | One line of {types}. Takes {color}, {type}, {min}, {max} and {weight}. |
box-item.glow | false | Whether the box glows. |
crystal-item
How a crystal shows everywhere: in the menu and as an item.
| Key | Default | What it does |
|---|---|---|
crystal-item.name | '{name}' | The crystal's name. |
crystal-item.lore | six lines | Takes {name}, {type} (the label), {color}, {amount_color}, {chance_color}, {value}, {chance} and {tier}. |
crystal-item.deposit-lore | two lines | Added to a withdrawn item. |
crystal-item.unknown-name | '&7Unknown Crystal' | The name of a crystal whose type file is gone. |
crystal-item.unknown-material | GRAY_DYE | Its item. |
crystal-item.glow | false | Whether crystals glow. |
commands
| Key | Default | What it does |
|---|---|---|
commands.main.command | crystals | The command name. '' = no /crystals (crystals, boxes and the API keep working). |
commands.main.aliases | ['crystal'] | Other names of the command. |
commands.main.permission | '' | Needed for the command, every button of the crystals menus and the sword menu's Crystals button ('' = everyone). |
commands.main.menu | crystals | The menu /crystals opens (a file of modules/crystals/guis/). |
Crystal type files
Each file of modules/crystals/types/ is one type; its id is the file name. The shipped types are money, souls, damage and swings. The files are created once while the folder does not exist, and never merged.
| Key | Example | What it does |
|---|---|---|
target | currency:money | The booster target: damage, swings, enchants, currency:<id> or enchant:<id>. |
name | '&aMoney Crystal' | The crystal's name. |
label | 'Money' | The short word of the texts ({type}). |
color | '&a' | The color of the name and borders (& codes or #rrggbb). |
amount-color | '#07bf07' | The color of the value. |
chance-color | '&2' | The color of the apply chance. |
unit | '%' | How the value shows: x (3.20x) or % (times 100: 0.1859 shows 18.59%). Only the look changes. |
icon.material | FIREWORK_STAR | The crystal's item. |
icon.custom-model-data | 0 | Its custom model data (0 = none). |
icon.color | '#FFAA00' | The color of a FIREWORK_STAR icon (#RRGGBB or R,G,B). Ignored for other materials. |
A type whose target is unknown or switched off in boosters.yml does not load (one console warning). Its crystals are kept, add nothing and show "Unknown Crystal" until the file comes back.
Crystal Box tier files
Each file of modules/crystals/tiers/ is one Crystal Box; the file name is the tier number (1 to 1000). The shipped tiers are 1, 2 and 5.
| Key | Example | What it does |
|---|---|---|
name | 'T1 Crystal Box' | The box name ({name} of box-item.name). |
stars | 1 | Its stars ({stars}). |
gradient | ['#9e9e9e', '#e0e0e0'] | Two #rrggbb colors of the name. Remove the key for the name as written. |
box-texture | base64 text | A player head texture for the box item. '' = box-material instead. |
box-material | PLAYER_HEAD | The box item without a texture. |
apply-chance.min, .max | 10, 100 | The range the apply chance rolls in, in percent. |
types.<type>.weight | 25 | The type's weight among the types of this box. |
types.<type>.min, .max | 0.01, 0.03 | The range its value rolls in. For a % type, 0.15 shows 15%. |
A type the box names that is not loaded is skipped (one warning). A box with no type left does not load.
A right click opens one box, a shift right click the whole stack. One box answers like You have received a Money Crystal (18.59%)!. Several boxes answer one line per type, with how many and the best.
Give boxes with /dungeons admin crystals box or the reward tag [give-crystal-box] <tier> [amount] (amount 1 to 2304). It works in crates, milestones and shops. A broken line gives nothing, with one console warning.
Menus
| Menu id | File | Opened by |
|---|---|---|
crystals:crystals | modules/crystals/guis/crystals.yml | /crystals, "Sword Crystals" |
crystals:filter | modules/crystals/guis/filter.yml | The Crystal Filtering button |
crystals:bulk | modules/crystals/guis/bulk.yml | The Bulk Delete button |
Sword Crystals (crystals.yml):
| Letter | Tile |
|---|---|
A | The sword slots, left to right: slot-crystal, slot-free, slot-locked (with {need} and {swings}) or slot-none (past the length of slots.unlocks). |
S | The storage, paged: storage, storage-withdraw (in Withdraw Mode) or storage-empty. |
B | Back to the sword menu. |
< > | Previous and next page, each with a -none state. |
W | Withdraw Mode, on or off. |
D | Crystal Filtering. |
K | Bulk Delete. |
Crystal Filtering (filter.yml): one t tile per loaded type (type-off, type-on or type-none), C clears every filter, B goes back. Add t cells when you add types: the plugin warns once when there are more types than cells.
Bulk Delete (bulk.yml): a to e are the apply chance buckets, f to j the boost quality buckets, B goes back. The buckets are the actions [crystals] bulk chance <lo> <hi> and [crystals] bulk value <lo> <hi> (whole numbers 0 to 100). Add or change tiles freely.
Every button runs a [crystals] ... action (open, page next|previous, withdraw, filter, bulk) and needs the permission of /crystals. See Menus and Action Tags.
Commands
| Command | Permission | Description |
|---|---|---|
/crystals (alias /crystal) | commands.main.permission ('') | Opens the crystals menu. |
/dungeons admin crystals box <player> <tier> [amount] | sndungeons.admin.crystals.box | Gives an online player Crystal Boxes. |
/dungeons admin crystals give <player> <type> <tier> [amount] [value] [chance] | sndungeons.admin.crystals.give | Adds 1 to 64 crystals straight into a player's storage, also offline. |
/dungeons admin crystals slots <player> <add|set|take> <slots> | sndungeons.admin.crystals.slots | Changes the extra crystal slots of a player. |
/dungeons admin crystals list <player> | sndungeons.admin.crystals.list | Lists the slots, applied and stored crystals of an online player. |
The rank nodes sndungeons.crystals.slots.1 to .10 open slots (default false). slots.unlocks caps them.
Full lists: Commands and Permissions.
Placeholders
The crystals expose your slots, each applied crystal and the factor per target. Full list: Placeholders.
| Placeholder | Description |
|---|---|
%sndungeons_crystals_slots%, _slots_max | Your crystal slots and the most slots |
%sndungeons_crystals_applied%, _storage_count | Crystals on your sword and in your storage |
%sndungeons_crystals_factor_<target>% | The factor your crystals push on a target (1 without one) |
%sndungeons_crystals_header% | The sword lore header (empty without an applied crystal) |
%sndungeons_crystal_<n>_line%, _name, _value, _chance | The crystal of sword slot n (empty without one) |
Tips
- Because crystals multiply the additive total, small values matter a lot. The shipped tier 1 values stay between 0.01 and 0.25.
- The shipped apply chance rolls from 10% to 100% in every tier. Narrow it in high tiers if you want rare crystals to feel safer, or riskier.
- Test with
/dungeons admin crystals give <you> money 1 1 0.5 100: a sure apply of a known value. - Warn players in your menu lore that removing a crystal destroys it.
- The shipped sword lore has five crystal lines, one per shipped slot. Add a
%sndungeons_crystal_<n>_line%line when you lengthenslots.unlocks.
Default modules/crystals/config.yml
enabled: true
# ============================================================
# SnDungeons - crystals module
# Managed by SnLib: new keys are auto-merged on boot; your values and
# comments are preserved. Re-read on /dungeons reload.
# ============================================================
# Switch of the module (the key above): false turns the crystals off on
# /dungeons reload; /crystals disappears and every crystal factor goes. The
# crystals and extra slots every player has stay stored. Take the crystals
# lines out of item.lore of modules/sword/config.yml too (PlaceholderAPI then
# shows them as written).
# The crystal types live in types/ of this folder (one file each, created
# once), the Crystal Box tiers in tiers/ (one file per tier, named by its
# number). Deleting a file there really deletes it.
#
# A crystal has a type, a tier, a value and an apply chance (both rolled when
# its box is opened). Applying it from the storage of /crystals rolls its
# chance: it goes on the sword, or it is destroyed. Taking it off the sword
# destroys it too. The crystals of one booster target push ONE multiplicative
# factor of 1 + the sum of their values (/boosts shows it): 0.07x of crystals
# makes the target x1.07, 12.70x makes it x13.70.
# Name of the module in /dungeons admin modules (color codes allowed).
display-name: '&dCrystals'
slots:
# The swings (the swings stat) each sword slot opens at, slot 1 first; its
# length is the most slots a player can have (up to 10). A player has the
# slots their swings reached, or the highest n of the permissions
# sndungeons.crystals.slots.<n> they have, whichever is more, plus the extra
# slots an admin gave (/dungeons admin crystals slots); never more than this
# list has. A player who has fewer slots than crystals applied gets the extra
# crystals back in the storage (never destroyed) when they join or open
# /crystals. [] = no slot at all.
unlocks: [0, 0, 500000, 1000000, 2000000]
apply:
# true: a click on a storage crystal whose apply chance is below 100% asks a
# second click within confirm-seconds before it is rolled.
confirm: true
remove:
# true: a click on an applied crystal (it is destroyed) asks a second click
# within confirm-seconds.
confirm: true
# The seconds a confirming second click is waited for (1 to 300).
confirm-seconds: 3
# The ticks between two right clicks with a box or a crystal item (0 to 200);
# 0 = none.
box-cooldown-ticks: 4
# The most decimals of the values and the apply chances shown (0 to 6);
# trailing zeros are dropped (3.2x). A value and a chance are rolled with 2
# decimals.
value-decimals: 2
# The name /boosts shows for the factor of the crystals.
booster-name: '&dCrystals'
# The sword lore lines. Put them in item.lore of modules/sword/config.yml (a
# line whose placeholders show nothing is left out of the lore):
# '%sndungeons_crystals_header%' this header, '' without an applied crystal
# '%sndungeons_crystal_1_line%' this line for the crystal of slot 1 ('' for
# '%sndungeons_crystal_2_line%' an empty slot), one line per slot
sword-lore:
# {count}: the crystals applied.
header: '&d&lCrystals &8({count})'
# {color}, {type}, {name}, {value} (with its unit), {chance}, {tier}.
line: '{color}│ &f{type} Crystal &7({value})'
# The Crystal Box item of every tier (its head and gradient come from the tier
# file). {name}: the tier's name in its gradient, {stars}: star once per star
# of the tier, {tier}: its number. The {types} line of the lore is repeated
# once per type the box gives (type-line: {color}, {type}, {min}, {max},
# {weight}).
box-item:
name: '{name} &8[&e{stars}&8]'
star: '★'
lore:
- '&7Opening this box will give'
- '&7you a random crystal.'
- '&8&m '
- '{types}'
- '&8&m '
- '&eRight-click to open!'
- '&7Shift right-click to open the whole stack.'
type-line: '{color}{type} &7({min} - {max})'
glow: false
# A crystal, everywhere it shows (the menu, the item). {name}: its type's name,
# {type}: its label, {color}, {amount_color}, {chance_color}: its type's
# colors, {value}: its value with its unit, {chance}: its apply chance,
# {tier}: its tier. The menu adds the lines of its templates under the lore;
# deposit-lore is added to a withdrawn item. A crystal whose type file is
# gone keeps everything and shows unknown-name with unknown-material.
crystal-item:
name: '{name}'
lore:
- '&7Applies a passive {type} multiplier'
- '&7to your Sword.'
- ''
- '{color}INFORMATION:'
- '{color}│&f AMOUNT: {amount_color}{value}&7 {color}{type}{color} Multiplier'
- '{color}│&f APPLY CHANCE: {chance_color}{chance}%'
deposit-lore:
- ''
- '&eRight-click to deposit!'
unknown-name: '&7Unknown Crystal'
unknown-material: GRAY_DYE
glow: false
commands:
# /crystals alone opens the menu below (the console gets the help). If
# another plugin already has this name or an alias, SnDungeons takes it
# (command priority) and that plugin keeps answering as /<plugin>:<name>.
main:
# Command name; '' = no /crystals command at all (the crystals, the boxes
# and the API keep working).
command: crystals
# Other names of the command.
aliases: ['crystal']
# Permission needed to use the command and every button of its menu.
permission: ''
# The menu /crystals opens: a file of modules/crystals/guis/ without .yml.
menu: crystalsExample crystal type: modules/crystals/types/money.yml
# ============================================================
# SnDungeons - crystals module: the Money crystal type
# An owner file: created once while types/ does not exist, never merged.
# The file name (without .yml) is the type id the tier files name.
# ============================================================
# The booster target its crystals add their value to (a multiplicative
# factor of 1 + the sum of the values of the applied crystals of a target):
# damage, swings, enchants, currency:<id> or enchant:<id>. A target that is
# unknown or switched off in boosters.yml keeps this type from loading (its
# crystals are kept and boost nothing).
target: currency:money
# The crystal's name, and the short word of the texts ({type}).
name: '&aMoney Crystal'
label: 'Money'
# The colors of the lore: the name and borders, the value, the chance
# (&-codes or #rrggbb).
color: '&a'
amount-color: '#07bf07'
chance-color: '&2'
# How the value shows: x (3.20x) or % (the value times 100: 0.1859 shows
# 18.59%). The value inside is always the factor it adds.
unit: '%'
icon:
material: FIREWORK_STAR
# 0 = none.
custom-model-data: 0
# The color of a FIREWORK_STAR icon (hex #RRGGBB or R,G,B); ignored for
# other materials.
color: '#FFAA00'Example Crystal Box tier: modules/crystals/tiers/1.yml
# ============================================================
# SnDungeons - crystals module: the Crystal Box of tier 1
# An owner file: created once while tiers/ does not exist, never merged.
# The file name is the tier (1 to 1000): crystal-box-1,
# /dungeons admin crystals box <player> 1, [give-crystal-box] 1.
# ============================================================
# The box name ({name} of box-item.name in the module config) and its stars.
name: 'T1 Crystal Box'
stars: 1
# The two colors of the name's gradient (#rrggbb); remove the key for the name
# as written.
gradient: ['#9e9e9e', '#e0e0e0']
# The box item: a player head with this base64 texture (minecraft-heads.com,
# the Value field); '' = box-material instead.
box-texture: 'eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTI3NTcyOGFmN2U2YTI5Yzg4MTI1YjY3NWEzOWQ4OGFlOTkxOWJiNjFmZGMyMDAzMzdmZWQ2YWIwYzQ5ZDY1YyJ9fX0='
box-material: PLAYER_HEAD
# The range the apply chance of its crystals rolls in, in percent (2
# decimals).
apply-chance:
min: 10
max: 100
# The types it gives: the weight of each among them and the range its value
# rolls in (2 decimals; for a type in %, 0.15 shows 15%). A type that is not
# loaded is skipped; a box with no type left is not loaded.
types:
money:
weight: 25
min: 0.01
max: 0.03
souls:
weight: 25
min: 0.05
max: 0.25
damage:
weight: 25
min: 0.03
max: 0.1
swings:
weight: 25
min: 0.01
max: 0.05