Skip to content

Commit

Permalink
v2.0.4 Allow opt-out of copying settings
Browse files Browse the repository at this point in the history
* Allow module developers to opt out of settings being copied.
* Re-added bug reporter compatibility since 0.8.2.
  • Loading branch information
sneat authored Jun 10, 2021
2 parents 3e8d28d + 4b90de6 commit 0fe2aed
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ Go to Settings tab in Sidebar and **right click** on data **below** "General Inf

*Please note that importing 'world' scope settings en masse as GM might cause some issues to connected players. I advise players should logout before attempting to import World Settings*

## Info for Module Developers

### How do I opt out?

Perhaps you have a module that you don't want the settings being copied between worlds. You can add the following to your module manifest file to opt out of having the settings copied. The `active` state of your module will still be copied, just the settings won't.

1. Add `noCopyEnvironmentSettings: true` to your manifest json inside of the `flags` field of the manifest.

module.json
```md
"flags": {
"noCopyEnvironmentSettings": true
}
```

## Contact

[League of Foundry Developers](https://discord.gg/gzemMfHURH) ~~If you wish to contact me for any reason, reach me out on Discord using my tag: `Forien#2130`~~
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### v2.0.4

* Allow module developers to opt out of settings being copied.
* Re-added bug reporter compatibility since 0.8.2.

### v2.0.3

* Added 0.8.4 compatibility
Expand Down
9 changes: 6 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "forien-copy-environment",
"title": "Forien's Copy Environment",
"description": "Allows for copying TXT/JSON list of system/modules and versions, and gives ability to export/import game and player settings",
"version": "2.0.3",
"version": "2.0.4",
"library": "false",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.8.4",
"compatibleCoreVersion": "0.8.6",
"author": "Forien — Forien#2130",
"authors": [
{
Expand Down Expand Up @@ -41,5 +41,8 @@
"download": "https://github.com/League-of-Foundry-Developers/foundryvtt-forien-copy-environment/releases/latest/download/module.zip",
"bugs": "https://github.com/League-of-Foundry-Developers/foundryvtt-forien-copy-environment/issues",
"changelog": "https://github.com/League-of-Foundry-Developers/foundryvtt-forien-copy-environment/blob/master/changelog.md",
"flags": {
"allowBugReporter": true
},
"allowBugReporter": true
}
}
4 changes: 3 additions & 1 deletion scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ export default class Core extends FormApplication {
}

static exportGameSettings() {
const excludeModules = game.data.modules.filter(m => m.data?.flags?.noCopyEnvironmentSettings).map(m => m.id) || [];

// Return an array with both the world settings and player settings together.
let data = Array.prototype.concat(
game.data.settings.map((s) => ({
game.data.settings.filter(s => !excludeModules.some(e => s.key.startsWith(`${e}.`))).map((s) => ({
key: s.key,
value: s.value,
})),
Expand Down

1 comment on commit 0fe2aed

@IamWarHead
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you @sneat 👍

Please sign in to comment.