Fixed our onCreate methods unintentionally being run on all clients

This commit is contained in:
WBHarry 2025-07-24 12:47:57 +02:00
parent 4551a2bcfe
commit 967b3ba2ab
6 changed files with 15 additions and 4 deletions

View file

@ -75,6 +75,9 @@ export default class DHClass extends BaseDataItem {
_onCreate(data, options, userId) {
super._onCreate(data, options, userId);
if (userId !== game.user.id) return;
if (options.parent?.type === 'character') {
const path = `system.${data.system.isMulticlass ? 'multiclass.value' : 'class.value'}`;
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });