Cookies
On this page(12)
A cookie is an item a player eats with a right click. While it lasts, it gives Luck, fixed luck effect bonuses and boosters. Use cookies as store items, crate rewards or event prizes that boost a whole play session.
| Files | modules/cookies/config.yml, modules/cookies/cookies/ (one file per cookie) |
| Player command | none (players eat the item) |
| Admin commands | /dungeons admin cookies ... |
| Switch | enabled: (first key of modules/cookies/config.yml) + /dungeons reload |
With the module off, an active cookie stays stored and gives nothing until the module is on again.
How it works
Eating a cookie
A right click eats the cookie in the main hand. The off hand eats only while the main hand is empty. A click on a chest or another usable block opens it as usual, unless the player sneaks.
While it lasts, a cookie gives:
| Part | Key | Where it shows |
|---|---|---|
| Luck points | luck: | Luck. Needs the luck target on in boosters.yml. |
| Fixed luck effect bonuses | effects: | /luck, by the cookie's name. They apply in full, beyond each effect's max. |
Boosters (additive, 0.5 = +50%) | boosters: | /boosts. |
One cookie at a time
Each player has one active cookie. Eating a second one is refused with the time left, and nothing is used. Two keys change that:
| Setting | Result |
|---|---|
stack.enabled: true | The same cookie adds its duration, up to stack.max. At the cap it is refused. |
stack.other-type: replace | Another cookie ends the active one WITHOUT its on-expire lines, and starts. |
Time
time: | How the time runs |
|---|---|
online (default) | Only while the player is online: the cookie pauses offline. |
always | The wall clock. A cookie that ended offline ends at the next join, with its on-expire. |
Relogs, restarts and /dungeons reload keep the cookie and its effects. A rebirth ([reset-boosters] included) never touches it.
When it ends, every boost and bonus goes and its on-expire lines run.
Configuration
| Key | Default | What it does |
|---|---|---|
time | online | online (pauses offline) or always (runs offline too). |
stack.enabled | false | true = eating the same cookie again adds its duration. false = refused while one is active. |
stack.max | 7d | The most time left a stack can reach: 1m to 365d (s, m, h, d). |
stack.other-type | refuse | Eating another cookie type while one is active: refuse or replace. |
messages-on-activate | true | true = the activated message is sent when a cookie is eaten. |
sound | 'ENTITY_PLAYER_BURP 1 1' | The sound of an eaten cookie ('SOUND [volume] [pitch]', '' = none). |
item-cooldown-ticks | 10 | Ticks after an eat in which another click does nothing (1 to 200). One click can fire for both hands. |
The sound follows each player's core.sounds setting. The display-name key ('&6Cookies') is the module's name in /dungeons admin modules.
Cookie files
Each file of modules/cookies/cookies/ is one cookie type. The file name is its id: lowercase letters, digits and -, at most 57. Its item is cookie-<id>.
The folder is created ONCE with three examples:
| Cookie | Duration | Gives |
|---|---|---|
super-cookie | 24h | 50 Luck, +5% Double Rebirth, +50% money, +100% souls |
booster-cookie | 24h | 25 Luck, +60% money, +75% souls, +10% enchants |
lucky-cookie | 24h | 100 Luck and six luck effect bonuses |
Add, edit or delete files freely.
| Key | Super Cookie value | What it does |
|---|---|---|
name | '&#EA80FC&lEnhanced Super Cookie' | The cookie's name ({cookie}), at most 128 characters. |
duration | 24h | How long it lasts once eaten: 1m to 30d (s, m, h, d). |
item.material | COOKIE | The item's material. |
item.glow | true | true = the item glows. |
item.model-data | 0 | Custom model data of the item. |
item.lore | the buff list | The item's lore. {duration} is the duration above. |
luck | 50 | Luck points while active. 0 = none. |
effects | 'double-level-up:rebirth': 5 | Luck effect key (luck.yml; <effect>:<track> for one leveling track) to a percent (above 0, at most 100). |
boosters | money: 0.5, souls: 1.0 | Booster target to an additive bonus (0.5 = +50%). |
on-activate | one line | Action lines run when it is eaten. |
on-expire | one line | Action lines run when it ends. |
The booster targets are money and the other currency ids, damage, swings, enchants and enchant:<id>. Never put luck in boosters:: use luck:.
The action lines take {cookie}, {duration} and {player}. A replaced cookie does not run its on-expire.
modules/cookies/cookies/lucky-cookie.yml (effects)
luck: 100
effects:
double-enchant-level: 5
double-totem-box: 5
free-perk-ticket: 5
double-pity: 10
double-milestone-reward: 10
double-objective: 15
boosters: {}A cookie whose file you delete ends for its player at the next join, without on-expire. A file that does not load keeps the player's cookie stored, giving nothing until you fix it.
A line that names an unknown luck effect or a booster target switched off in boosters.yml is ignored, with one console warning.
Giving cookies
| Way | Use |
|---|---|
/dungeons admin cookies give <player> <cookie> [amount] | From the console, crates, vouchers or a store. |
[give-cookie] <cookie> [amount] | A reward tag for crates, milestones, hunts and shops. Amount 1 to 2304. |
The tag exists only while the module is on. Both ways drop the items that do not fit at the player's feet.
Commands
| Command | Permission | Description |
|---|---|---|
/dungeons admin cookies give <player> <cookie> [amount] | sndungeons.admin.cookies.give | Gives cookie items to an online player. |
/dungeons admin cookies activate <player> <cookie> [duration] | sndungeons.admin.cookies.activate | Activates a cookie for a player (also offline), replacing any active one. |
/dungeons admin cookies clear <player> | sndungeons.admin.cookies.clear | Ends the active cookie of a player, also offline. |
/dungeons admin cookies time <player> <set|add> <time> | sndungeons.admin.cookies.time | Sets or adds to the time left of a player's cookie, also offline. |
/dungeons admin cookies info <player> | sndungeons.admin.cookies.info | Shows the active cookie of a player, also offline. |
activate does not run on-activate. time takes 1m to 30d. Full lists: Commands and Permissions.
Placeholders
The cookie placeholders are listed in Placeholders:
| Placeholder | Value |
|---|---|
%sndungeons_cookie_active% | true while a cookie runs |
%sndungeons_cookie_id%, _name | The active cookie's id and name |
%sndungeons_cookie_time_left% | Its time left (like 3h 20m) |
%sndungeons_cookie_time_left_ms% | The same in milliseconds (0 without a cookie) |
Tips
- The lore only fills
{duration}. Keep its buff list in line withluck,effectsandboostersby hand. - With
time: online, a 24h cookie means 24 hours of play. Usealwaysfor real-time store items. - Test a cookie with
/dungeons admin cookies activate <player> <cookie> 1m, then watch/boostsand/luck.
Default modules/cookies/config.yml
enabled: true
# ============================================================
# SnDungeons - cookies 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 cookies off on
# /dungeons reload; an active cookie stays stored and gives nothing while
# the module is off.
# The cookies are the files of cookies/ in this folder: one file per cookie
# type, created once with examples; add, edit or delete them freely (a
# deleted file stays deleted, and a player whose cookie lost its file loses
# that cookie at the next join). A player eats a cookie item with a right
# click (main hand, or the off hand while the main hand is empty); while it
# lasts it gives Luck, fixed luck effect bonuses and boosters. One active
# cookie per player.
# Name of the module in /dungeons admin modules (color codes allowed).
display-name: '&6Cookies'
# How the time of a cookie runs: online = only while the player is online
# (it pauses offline) | always = the wall clock (it runs offline too).
time: online
stack:
# true = eating the same cookie again adds its duration (up to max);
# false = it is refused while one is active (with the time left).
enabled: false
# The most time left a stack can reach: 1m to 365d (s, m, h, d).
max: 7d
# Eating another cookie type while one is active: refuse | replace (the
# active one ends without its on-expire lines and the new one starts).
other-type: refuse
# true = the activated message is sent when a cookie is eaten.
messages-on-activate: true
# The sound of an eaten cookie ('SOUND [volume] [pitch]', '' = none; under
# the core sounds setting of each player).
sound: 'ENTITY_PLAYER_BURP 1 1'
# The ticks after an eat in which another click of the same player does
# nothing (1 to 200): one click can fire for both hands.
item-cooldown-ticks: 10Example cookie: modules/cookies/cookies/super-cookie.yml
# ============================================================
# A cookie type of the cookies module (the file name is its id: lowercase
# letters, digits and '-', at most 57). Created once; edit it freely.
# The item is cookie-<id> in /dungeons admin cookies give.
# ============================================================
# Name of the cookie (color codes allowed): {cookie} in the lines below.
name: '&#EA80FC&lEnhanced Super Cookie'
# How long it lasts once eaten: 1m to 30d (s, m, h, d).
duration: 24h
# The item ({duration} in the lore is the duration above).
item:
material: COOKIE
glow: true
model-data: 0
lore:
- '&7Upon consumption, you will gain a'
- '&7list of buffs for {duration}.'
- ''
- '&dBuff List:'
- '&d - &fGain a &a5% &fChance to &dRebirth Twice'
- '&d - &fGain a &a+50% &fBoost for &aMoney'
- '&d - &fGain a &a+100% &fBoost for &aSouls'
- '&d - &fGain &a+50 &a☘ Luck'
- ''
- '&eRight-click to consume!'
# Luck points while it is active (0 = none; needs the luck target on in
# boosters.yml).
luck: 50
# Fixed bonuses of luck effects while it is active: effect key (luck.yml;
# '<effect>:<track>' for one leveling track) -> percent (above 0, at most
# 100). They apply in full, beyond the max of each effect.
effects:
'double-level-up:rebirth': 5
# Boosters while it is active: target (money and the other currency ids,
# damage, swings, enchants, enchant:<id>) -> additive bonus (0.5 = +50%).
# The Luck goes in luck: above, never here.
boosters:
money: 0.5
souls: 1.0
# Action lines run when it is eaten and when it ends ({cookie}, {duration},
# {player}). A replaced cookie does not run its on-expire.
on-activate:
- '[title] &6&lCOOKIE &fActivated!'
on-expire:
- '[message] &cYour {cookie} &cexpired.'