Source

SlayTheSpireAPI/APIComponents/AbstractAPIComponent.ts

import java from 'java';

/**
 * Generic API Component that uses the Slay the Spire game files
 * @abstract
 * @example
 * class MyAPIComponent extends AbstractAPIComponent {
 *     public constructor(stsJarPath: string)
 *     {
 *         super(stsJarPath);
 *     }
 * }
 */
export abstract class AbstractAPIComponent {
    /**
     * Create an API Component with access to Slay the Spire game files
     * @param {string} stsJarPath Path to the `desktop-1.0.jar` Slay the Spire game file
     */
    public constructor(stsJarPath?: string) {
        if (!stsJarPath) return;

        if (java.classpath.includes(stsJarPath)) return;

        java.classpath.push(stsJarPath);
    }
}