@@ -65,6 +65,10 @@ export default class ScenePacker {
6565 allowImportPrompts = true ,
6666 } = { } ,
6767 ) {
68+ if ( ! game . user . isGM ) {
69+ return null ;
70+ }
71+
6872 // Return the existing instance if it has been configured already.
6973 if ( moduleName ) {
7074 let instance = globalScenePacker . instances [ moduleName ] ;
@@ -226,6 +230,10 @@ export default class ScenePacker {
226230 journalFlag = FLAGS_JOURNALS ,
227231 macroFlag = FLAGS_MACROS ,
228232 ) {
233+ if ( ! game . user . isGM ) {
234+ return false ;
235+ }
236+
229237 try {
230238 if ( scene . getFlag ( moduleName , tokenFlag ) ) {
231239 return true ;
@@ -1596,6 +1604,10 @@ export default class ScenePacker {
15961604 * @param {String } moduleName The name of the module that owns the compendiums to be updated
15971605 */
15981606 static async SetModuleCompendiumLockState ( locked , moduleName ) {
1607+ if ( ! game . user . isGM ) {
1608+ return ;
1609+ }
1610+
15991611 locked = ! ! locked ;
16001612 const compendiums = game . packs . filter (
16011613 ( p ) => p . metadata . package === moduleName ,
@@ -1632,6 +1644,10 @@ export default class ScenePacker {
16321644 * @param {Boolean } dryRun Whether to do a dry-run (no changes committed, just calculations and logs)
16331645 */
16341646 static async RelinkJournalEntries ( moduleName , { dryRun = false } = { } ) {
1647+ if ( ! game . user . isGM ) {
1648+ return ;
1649+ }
1650+
16351651 // Get all of the compendium packs that belong to the requested module
16361652 const allPacks = game . packs . filter (
16371653 ( p ) => p . metadata . package === moduleName ,
@@ -1904,6 +1920,10 @@ export default class ScenePacker {
19041920 * @see RelinkJournalEntries
19051921 */
19061922 static async PromptRelinkJournalEntries ( ) {
1923+ if ( ! game . user . isGM ) {
1924+ return ;
1925+ }
1926+
19071927 let activeModules = Object . keys ( globalScenePacker . instances ) ;
19081928 if ( ! activeModules . length ) {
19091929 ui . notifications . info (
@@ -1946,6 +1966,10 @@ export default class ScenePacker {
19461966 * @returns {Promise<null|ScenePacker> }
19471967 */
19481968 static PromptForInstance ( ) {
1969+ if ( ! game . user . isGM ) {
1970+ return null ;
1971+ }
1972+
19491973 return new Promise ( ( resolve , reject ) => {
19501974 const modulesRegistered = Object . keys ( globalScenePacker . instances ) ;
19511975 if ( ! modulesRegistered . length ) {
@@ -1998,6 +2022,10 @@ export default class ScenePacker {
19982022 * @returns {null|ScenePacker }
19992023 */
20002024 static GetInstanceForScene ( scene ) {
2025+ if ( ! game . user . isGM ) {
2026+ return null ;
2027+ }
2028+
20012029 if ( ! scene ) {
20022030 return null ;
20032031 }
@@ -2118,6 +2146,10 @@ Hooks.once('setup', () => {
21182146 } ) ;
21192147
21202148 Hooks . on ( 'canvasReady' , async ( readyCanvas ) => {
2149+ if ( ! game . user . isGM ) {
2150+ return ;
2151+ }
2152+
21212153 const instance = ScenePacker . GetInstanceForScene ( readyCanvas . scene ) ;
21222154 if ( ! instance ) {
21232155 // No instance for the requested module
@@ -2206,5 +2238,9 @@ globalThis.ScenePacker = new Proxy(globalScenePacker, {
22062238 * Trigger scenePackerReady once the game is ready to give consuming modules time to bind any dependencies they need.
22072239 */
22082240Hooks . on ( 'ready' , ( ) => {
2241+ if ( ! game . user . isGM ) {
2242+ return ;
2243+ }
2244+
22092245 Hooks . callAll ( 'scenePackerReady' , globalThis . ScenePacker ) ;
22102246} ) ;
0 commit comments