diff --git a/module/utils/databases/Database.mjs b/module/utils/databases/Database.mjs index e9400d7..4a1c3d1 100644 --- a/module/utils/databases/Database.mjs +++ b/module/utils/databases/Database.mjs @@ -3,7 +3,20 @@ export class Database { // MARK: Table Ops static createTable(tableConfig) { - throw new Error(`createTable() must be defined`); + if (!game.user.isGM) { + ui.notifications.error(`You do not have the required permission to create a new table`); + return false; + }; + + const tables = game.settings.get(__ID__, `tables`); + if (tables[tableConfig.name]) { + ui.notifications.error(`Cannot create table that already exists`); + return false; + }; + + tables[tableConfig.name] = tableConfig; + game.settings.set(__ID__, `tables`, tables); + return true; }; /** @returns {Array