fix: server method error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-10-02 16:43:18 +08:00
parent 00a84fb58a
commit 0fea6b5537
2 changed files with 11 additions and 14 deletions

View File

@ -16,13 +16,13 @@ export class BukkitServer extends server.ReflectServer {
}
getPlayer(name: string) {
return Bukkit.getPlayer(name)
return Bukkit.getPlayerExact(name)
}
getVersion(): string {
return Bukkit.getVersion()
}
getOnlinePlayers() {
return Bukkit.getOnlinePlayers() as unknown as any[]
return Bukkit.getOnlinePlayers()
}
getConsoleSender() {
return Bukkit.getConsoleSender()

View File

@ -1,25 +1,25 @@
import { server } from '@ccms/api'
import { provideSingleton } from '@ccms/container';
import { provideSingleton } from '@ccms/container'
let Nukkit: cn.nukkit.Server = base.getInstance().getServer();
const File = Java.type("java.io.File");
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;
private pluginsFolder: string
constructor() {
this.pluginsFolder = new File(base.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getCanonicalPath()
}
getPlayer(name: string) {
return Nukkit.getPlayer(name)
return Nukkit.getPlayerExact(name)
}
getVersion(): string {
return Nukkit.getVersion()
}
getOnlinePlayers() {
return Nukkit.getOnlinePlayers() as unknown as any[]
return Nukkit.getOnlinePlayers().values()
}
getConsoleSender() {
return Nukkit.getConsoleSender()
@ -37,18 +37,15 @@ export class NukkitServer implements server.Server {
return Nukkit.dispatchCommand(Nukkit.getConsoleSender(), command)
}
getPluginsFolder(): string {
return this.pluginsFolder;
return this.pluginsFolder
}
getNativePluginManager() {
return Nukkit.getPluginManager() as any;
return Nukkit.getPluginManager() as any
}
getNettyPipeline() {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
getRootLogger() {
return Packages.org.apache.logging.log4j.LogManager.getRootLogger()
}
sendJson(sender: string | any, json: object | string): void {
throw new Error("Method not implemented.");
}
}