From 9156dee69be0f134f4fbcd90946340b3d39ca082 Mon Sep 17 00:00:00 2001 From: Jeremy Valentine <38669521+valentine195@users.noreply.github.com> Date: Sat, 4 Jun 2022 22:29:52 -0400 Subject: [PATCH] Update main.ts --- src/main.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index ecd4b53b..1e21e96d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -57,15 +57,22 @@ export default class InitiativeTracker extends Plugin { .getPlugin("obsidian-dice-roller") .parseDice(text, "initiative-tracker"); } - async getRoller(str: string) { + getRoller(str: string) { if (!this.canUseDiceRoller) return; - const roller = await this.app.plugins + const roller = this.app.plugins .getPlugin("obsidian-dice-roller") - .getRoller(str, "statblock", true); + .getRollerSync(str, "statblock", true); return roller; } get canUseDiceRoller() { - return this.app.plugins.getPlugin("obsidian-dice-roller") != null; + if (this.app.plugins.getPlugin("obsidian-dice-roller") != null) { + if (! this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync) { + new Notice("Please update Dice Roller to the latest version to use with Initiative Tracker."); + } else { + return true; + } + } + return false; } async getInitiativeValue(modifier: number = 0): Promise {