davelens / fvtt-party-resources

A simple module for FoundryVTT to manage (and track) custom party-wide numeric values.
MIT License
6 stars 16 forks source link

Error thrown for all logged in players when changing gold #74

Open RaaviArda opened 1 year ago

RaaviArda commented 1 year ago

I have the following setup: Party Resources set to track gold across all players Whenever any player changes their gold (or I change it) all players get a red error notification saying: Uncaught (in promise) Error: User lacks permission to update Setting [ai2WtiaeaY04G3g7]

Setting with ID ai2WtiaeaY04G3g7 is: key: "fvtt-party-resources.gp" value: 244.9 (current party gold)

Disabling tracking of the resource removes the error. Same issue is for objects tracked by the module, ie. I'm tracking all rations across all characters and if any character has his/her rations changed all players get relevant error just with ID of a different setting.

Players are NOT suposed to change the values and the setting "Allow players to manage this resource" is NOT checked for any of those.

davelens commented 1 year ago

@RaaviArda Am I right in assuming the gold and/or item count still works, even though it throws this error? If so, I was able to reproduce this:

The module listens for changes to gold, or items in your inventory, to add up all numbers across all players. When it does that, it works the same way a regular resource works when it receives an update. That means it will attempt to write something to Foundry's centralized setting database (i.e. game.settings), but it does not actually write a value that's visualized in the module. This means you see the error message that the player lacks permission to do so (which is correct), but it doesn't matter when it accounts for gold or items because it just sums player data instead of showing a stored value from game.settings.

In a way I've abused my own module to add this functionality, but the permission error itself is not intended. 😄 I'll see about getting rid of the error so no one sees this. Pending an update on the module itself though, there's an easy way to get rid of the errors for your players right now, by pressing the button marked with red as shown in the screenshot below. Pressing that button will not allow players to adjust resources (hence the separate checkbox), but it will allow their client to do writes in the background, so they won't receive the error anymore.

modify-config-settings

Thank you for reporting this!

RaaviArda commented 1 year ago

Thanks for verifying and yes - everything works as intended except for the error thrown. It's just annoying, especially when I give out ie. quest rewards and everyone starts updating their gold. I don't want to give players ability to modify configuration because I have a ton of modules they could abuse with such power :-D So I'll have to live with the error spam until you fix it.