Files and Reloads
On this page(14)
SnDungeons keeps everything in plugins/SnDungeons/. Each file belongs to one of a few kinds, and
each kind updates differently when you install a newer jar. Most edits apply with
/dungeons reload, with no restart.
| Folder | plugins/SnDungeons/ |
| Apply an edit | /dungeons reload (permission sndungeons.admin.reload) |
| Needs a restart | database: of config.yml, a new jar |
| Merge switch | update-configs: of config.yml |
The folder after the first start
plugins/SnDungeons/
license.yml your license key
config.yml global settings (managed)
boosters.yml boost targets, booster items, events (managed)
stats.yml /swings and /dmg (managed)
settings.yml the defaults of /settings (managed)
luck.yml luck effects and /luck (managed)
database.db the SQLite database (type: sqlite)
lang/
messages_en.yml global messages (managed)
currencies/ one file per currency (owner folder)
money.yml souls.yml experience.yml perk-tickets.yml rebirth-points.yml
levelings/ one file per leveling track (owner folder)
level.yml rebirth.yml
guis/ the core menus (menus)
boosts.yml booster-backpack.yml booster-storage.yml luck.yml rebirth.yml tops.yml
settings-hud.yml settings-visuals.yml settings-chat.yml settings-auto.yml
shop-souls.yml the souls shop (owner file)
upgrades-rebirth.yml the rebirth upgrades (owner file)
objectives/
custom-events.yml events of other plugins (owner file)
modules/
<id>/config.yml one per module, enabled: first (managed)
<id>/lang/messages_en.yml the module's messages (managed)
<id>/guis/*.yml the module's menus (menus)
zones/zones/ one file per zone (owner folder)
sword/enchants/ sword/presets/ (owner folders)
sword/tiers.yml attributes/levels.yml (owner files)
... the content folder of each module (owner folders)Every module gets its config.yml at startup. Its menus, messages and content folder appear the
first time the module enables. A module that never ran, such as companions without SnCompanions,
only has its config.yml.
The content folders of the modules:
| Module | Content |
|---|---|
| zones | zones/ |
| sword | enchants/, presets/, tiers.yml |
| perks | perks/ |
| auras | types/ |
| milestones | categories/ |
| totems | types/, skins/ |
| attributes | levels.yml |
| crystals | types/, tiers/ |
| armors | sets/, skins/ |
| heroes | heroes/, hero-enchants/ |
| contests | variants/ |
| companions | pools/ |
| hunts | hunts/ |
| cookies | cookies/ |
The afk, autofighter and anticheat modules have no content folder: their config.yml holds
everything.
The kinds of files
| Kind | Files | Who owns it | On a new jar |
|---|---|---|---|
| Managed | config.yml, boosters.yml, stats.yml, settings.yml, luck.yml, every modules/<id>/config.yml, the language files | The plugin keeps the keys, you keep the values | New keys are merged in, your values and comments stay |
| Menus | guis/*.yml, every modules/<id>/guis/*.yml | Shared: the items are yours | New keys are merged in, new tiles do not arrive |
| Owner folders | currencies/, levelings/, each module's content folder | You | Never touched again |
| Owner files | modules/sword/tiers.yml, modules/attributes/levels.yml, objectives/custom-events.yml, guis/shop-<currency>.yml, guis/upgrades-<track>.yml | You | Never touched again |
| Jar-only | apidebug/api-docs.yml, shop/shop-template.yml, upgrades/upgrades-template.yml | The plugin | Read from the jar, never extracted |
Managed files
On every start, SnLib compares each managed file with the one in the jar. It inserts every missing key with its comments, at its place in the file.
- Your values, your comments and the keys you added stay as they are.
- A key that a newer jar no longer uses stays in your file, unused. Remove it by hand if you want.
- Before it writes a merge, SnLib copies the file to
old-<file>-<yyyyMMdd-HHmmss>.ymlnext to it. It keeps the 3 newest copies. - A file that is not valid YAML is moved to
<file>.backup-Nand created again from the jar, with one warning. - A managed file you delete is created again from the jar.
The update-configs switch
update-configs: at the top of config.yml controls the merge of every other managed file and
every menu.
update-configs: true| Value | What happens |
|---|---|
true (default) | Every managed file and menu gets the new keys of a newer jar |
false | No key is inserted. A missing file is still created. The console names each file with missing keys |
Three things merge whatever update-configs says: config.yml itself, the snlib.* messages and
the commands: block of lang/messages_en.yml.
With update-configs: false, a message a newer jar added shows as <missing:key> in game, with one
console warning per key. Add the key by hand, or switch the merge back on for one start.
Sections marked sn:extensible
Some sections of a managed file hold your own entries. They carry the comment # sn:extensible on
the line above the key.
# sn:extensible
bars:
rebirth:
leveling: rebirthThe merge never inserts into those sections and never removes from them. An entry you delete there stays deleted. A new entry that a newer jar ships there reaches new installations only.
Examples: every menu's items:, mobs.rarities and hud.bars of modules/zones/config.yml,
targets.currencies of boosters.yml, and rarities: of modules/perks/config.yml.
You can add # sn:extensible above any section yourself to freeze it. A marker only ever adds
protection: removing one the jar ships does not switch the merge back on.
Menus
Menus merge like managed files, but their items: section is yours (# sn:extensible). So a newer
jar brings new top-level keys, but never a new tile into an installed menu.
When a release reshapes a menu, the plugin moves your old file aside once. It is renamed
old-<file>-<yyyyMMdd-HHmmss>.yml, the new menu is written in its place, and the console prints one
line naming the file.
Copy your changes from the old-... copy into the new menu soon. SnLib keeps only the 3 newest
old-* copies of a file, so later merges can delete it.
A file in guis/ whose name starts with old- and ends with a date stamp is never loaded as a
menu. See Menus and Action Tags for how a menu file works.
Owner folders
An owner folder is created with its example files only while the folder does not exist. That is the first start, or the first time its module enables. After that, every file in it is yours.
- Add, edit or delete files freely. A deleted file stays deleted.
- The plugin never merges or rewrites these files.
- A new or changed example file in a newer jar reaches new installations only.
- Delete the whole folder and restart to get every example back. Your own files in it are lost.
Each file is read on its own, so one broken file never stops the others from loading. The console names the file and the problem.
Owner files
An owner file is created once from the jar while it does not exist, then read as you wrote it.
| File | Created |
|---|---|
modules/sword/tiers.yml | When the sword module enables |
modules/attributes/levels.yml | When the attributes module enables |
objectives/custom-events.yml | At startup |
guis/shop-<currency>.yml | For each currency with shop: true, at startup and on each reload |
guis/upgrades-<track>.yml | For each track with upgrades.enabled: true, at startup and on each reload |
To get the shipped default back, delete the file and restart. For the shop and upgrades menus a
/dungeons reload is enough.
Copying a new example file out of the jar
Owner folders and owner files never receive the examples of a newer jar. To get one:
- Open
SnDungeons-x.y.z.jarwith any zip tool (a jar is a zip file). - Find the file. Its path inside the jar is the same as under
plugins/SnDungeons/, for examplemodules/sword/enchants/critical.yml. - Copy it into the same folder under
plugins/SnDungeons/. - Run
/dungeons reload.
The same works for one block of a file, such as the pouches: block of currencies/money.yml.
Copy the block into your file, then reload.
What /dungeons reload does
/dungeons reload reads again:
config.yml, every other managed file and the language files.- Every menu, the owner folders and the owner files.
- The currencies and levelings, and their commands.
- The packet layer settings.
- Every module: its config, content, commands, menus and messages.
The reload is selective. Each component compares what it read with what it had, and acts only on the difference. A reload with no edited file changes nothing in game.
| Part | What a reload keeps |
|---|---|
| Zone mobs | They stay with their health and rarity, unless what a player sees changed (zone, stage, mob area, mob type or health, mobs.facing, a rarity's look) |
| Mob names and rewards | Applied to the mobs already in place |
| Fights | They end only when a fight display key of the zones config changed (mobs.bossbar, mobs.damage-hologram, mobs.hurt-flash, mobs.leave-area-distance) |
| HUD and isolation | Restarted only when hud: or isolation: changed |
| Enchant effects | Cut only when an enchant or preset file, or the enchants: block of the sword config, changed |
| Swords in inventories | Rebuilt only when tiers.yml, the sword config or an enchant file changed |
| Packet layer and boosters | Left alone when nms: and boosters.yml did not change |
| Number format | A change redraws the swords and armor pieces at once, other texts on their next draw |
The console gets one line that says what changed, for example:
Reload: nms: unchanged; boosters: unchanged; pouches: unchanged; tops: unchanged; shops: unchanged; zones: mobs of barn: respawned for 3 players, changed in place for 0; sword: unchangedSnLib closes the open menus of the plugin on every reload.
The ground of a mob area is read once and kept, and a reload does not read it again. After you edit
the terrain inside an area, run /dungeons admin zones respawn <zone>. Without a zone, it reads
every zone.
What needs a restart
database:ofconfig.yml: the connection is made at startup only.- A new jar: stop the server, replace the jar, start it.
Switching a module on or off
Each module's switch is the first key of its config:
modules/perks/config.yml
enabled: trueSet it to false and run /dungeons reload. No restart is needed.
- A module switched off loses its commands, menus, messages, placeholders, settings and action tags on that reload.
- Its stored data stays in the database for when you switch it back on.
/dungeons admin moduleslists every module and its state.
enabled: takes true or false, and a missing key counts as true. Any other value leaves the
module off, with one console line on each start and reload:
modules/perks/config.yml: enabled 'flase' is not true or false; the module stays offA module that needs another plugin, such as companions without SnCompanions, stays off with one
warning: Module 'companions' stays off: <reason>. The plugin checks again on every reload.
Broken values and console warnings
The plugin never refuses a whole file for one bad value. It reads each key on its own:
- A missing key uses its default, silently.
- A refused value uses its default (or the nearest allowed value), with one warning.
- A broken optional part (a mob area, an NPC, rewards, an icon) is a warning, and that part is off.
Each warning names the file, the key, the value, the problem and what happens instead:
<file>: <key> '<value>' <problem>; <consequence>For example: config.yml: api-debug.read-only 'yes please' is not true or false; false is used.
Quote the words in a YAML list. YAML reads a bare no, yes, on or off as true or false, so
write ['no'], not [no].
Tips
- Keep a copy of
plugins/SnDungeons/before you install a new jar. The merge is safe, but a copy costs nothing. - After a jar update, search the console for
[update-configs]andmoved to old-to see which files changed. - Run
/dungeons reloadafter every edit and read theReload:line: it confirms what applied. - Use
/dungeons admin inspect player <player>to check the result on a real player.