fix: server method error
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
00a84fb58a
commit
0fea6b5537
@ -16,13 +16,13 @@ export class BukkitServer extends server.ReflectServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPlayer(name: string) {
|
getPlayer(name: string) {
|
||||||
return Bukkit.getPlayer(name)
|
return Bukkit.getPlayerExact(name)
|
||||||
}
|
}
|
||||||
getVersion(): string {
|
getVersion(): string {
|
||||||
return Bukkit.getVersion()
|
return Bukkit.getVersion()
|
||||||
}
|
}
|
||||||
getOnlinePlayers() {
|
getOnlinePlayers() {
|
||||||
return Bukkit.getOnlinePlayers() as unknown as any[]
|
return Bukkit.getOnlinePlayers()
|
||||||
}
|
}
|
||||||
getConsoleSender() {
|
getConsoleSender() {
|
||||||
return Bukkit.getConsoleSender()
|
return Bukkit.getConsoleSender()
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import { server } from '@ccms/api'
|
import { server } from '@ccms/api'
|
||||||
import { provideSingleton } from '@ccms/container';
|
import { provideSingleton } from '@ccms/container'
|
||||||
|
|
||||||
let Nukkit: cn.nukkit.Server = base.getInstance().getServer();
|
let Nukkit: cn.nukkit.Server = base.getInstance().getServer()
|
||||||
const File = Java.type("java.io.File");
|
const File = Java.type("java.io.File")
|
||||||
|
|
||||||
@provideSingleton(server.Server)
|
@provideSingleton(server.Server)
|
||||||
export class NukkitServer implements server.Server {
|
export class NukkitServer implements server.Server {
|
||||||
private pluginsFolder: string;
|
private pluginsFolder: string
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.pluginsFolder = new File(base.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getCanonicalPath()
|
this.pluginsFolder = new File(base.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getCanonicalPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayer(name: string) {
|
getPlayer(name: string) {
|
||||||
return Nukkit.getPlayer(name)
|
return Nukkit.getPlayerExact(name)
|
||||||
}
|
}
|
||||||
getVersion(): string {
|
getVersion(): string {
|
||||||
return Nukkit.getVersion()
|
return Nukkit.getVersion()
|
||||||
}
|
}
|
||||||
getOnlinePlayers() {
|
getOnlinePlayers() {
|
||||||
return Nukkit.getOnlinePlayers() as unknown as any[]
|
return Nukkit.getOnlinePlayers().values()
|
||||||
}
|
}
|
||||||
getConsoleSender() {
|
getConsoleSender() {
|
||||||
return Nukkit.getConsoleSender()
|
return Nukkit.getConsoleSender()
|
||||||
@ -37,18 +37,15 @@ export class NukkitServer implements server.Server {
|
|||||||
return Nukkit.dispatchCommand(Nukkit.getConsoleSender(), command)
|
return Nukkit.dispatchCommand(Nukkit.getConsoleSender(), command)
|
||||||
}
|
}
|
||||||
getPluginsFolder(): string {
|
getPluginsFolder(): string {
|
||||||
return this.pluginsFolder;
|
return this.pluginsFolder
|
||||||
}
|
}
|
||||||
getNativePluginManager() {
|
getNativePluginManager() {
|
||||||
return Nukkit.getPluginManager() as any;
|
return Nukkit.getPluginManager() as any
|
||||||
}
|
}
|
||||||
getNettyPipeline() {
|
getNettyPipeline() {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.")
|
||||||
}
|
}
|
||||||
getRootLogger() {
|
getRootLogger() {
|
||||||
return Packages.org.apache.logging.log4j.LogManager.getRootLogger()
|
return Packages.org.apache.logging.log4j.LogManager.getRootLogger()
|
||||||
}
|
}
|
||||||
sendJson(sender: string | any, json: object | string): void {
|
|
||||||
throw new Error("Method not implemented.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user