Skip to content

Commit

Permalink
overload update
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Dec 10, 2021
1 parent a21b2e0 commit ed48757
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ import StatblockSettingTab from "./settings/settings";

import "./main.css";
import { sort } from "fast-sort";
import type { Plugins } from "../../obsidian-overload";
declare module "obsidian" {
interface App {
plugins: {
plugins: {
"obsidian-dice-roller": DiceRollerPlugin;
};
getPlugin<T extends keyof Plugins>(plugin: T): Plugins[T];
};
}
interface Workspace {
Expand Down Expand Up @@ -80,13 +79,13 @@ export default class StatBlockPlugin extends Plugin {
CR = CR;
private _sorted: Monster[] = [];
get canUseDiceRoller() {
return "obsidian-dice-roller" in this.app.plugins.plugins;
return this.app.plugins.getPlugin("obsidian-dice-roller") != null;
}
getRoller(str: string) {
if (!this.canUseDiceRoller) return;
const roller = this.app.plugins.plugins[
"obsidian-dice-roller"
].getRoller(str, "statblock", true);
const roller = this.app.plugins
.getPlugin("obsidian-dice-roller")
.getRoller(str, "statblock", true);
return roller;
}
get sorted() {
Expand Down

0 comments on commit ed48757

Please sign in to comment.