feat: add NativePluginManager

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-03-01 15:19:43 +08:00
parent 488eecba07
commit 6b7a729e65
6 changed files with 50 additions and 4 deletions

View File

@ -2,9 +2,16 @@ import { server } from '@ms/api'
import { provideSingleton } from '@ms/container';
let Nukkit: cn.nukkit.Server = base.getInstance().getServer();
const File = Java.type("java.io.File");
@provideSingleton(server.Server)
export class NukkitServer implements server.Server {
private pluginsFolder: string;
constructor() {
this.pluginsFolder = new File(base.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getCanonicalPath()
}
getPlayer(name: string) {
return Nukkit.getPlayer(name)
}
@ -29,6 +36,12 @@ export class NukkitServer implements server.Server {
dispatchConsoleCommand(command: string): boolean {
return Nukkit.dispatchCommand(Nukkit.getConsoleSender(), command)
}
getPluginsFolder(): string {
return this.pluginsFolder;
}
getNativePluginManager() {
throw new Error("Method not implemented.");
}
sendJson(sender: string | any, json: object | string): void {
throw new Error("Method not implemented.");
}