feat: 新增公告接口
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
b3fa8790e3
commit
cf9153c134
@ -105,7 +105,7 @@ export class MiaoScriptConsole implements Console {
|
|||||||
let sourceMappingURL = lastLine.split('sourceMappingURL=', 2)[1]
|
let sourceMappingURL = lastLine.split('sourceMappingURL=', 2)[1]
|
||||||
if (sourceMappingURL.startsWith('data:application/json;base64,')) {
|
if (sourceMappingURL.startsWith('data:application/json;base64,')) {
|
||||||
sourceContent = String.fromCharCode(...Array.from(base64.toByteArray(sourceMappingURL.split(',', 2)[1])))
|
sourceContent = String.fromCharCode(...Array.from(base64.toByteArray(sourceMappingURL.split(',', 2)[1])))
|
||||||
} else if (sourceMappingURL.startsWith('http')) {
|
} else if (sourceMappingURL.startsWith('http://') || sourceMappingURL.startsWith('https://')) {
|
||||||
// TODO
|
// TODO
|
||||||
} else {
|
} else {
|
||||||
let file = Paths.get(Paths.get(fileName, '..', sourceMappingURL).toFile().getCanonicalPath()).toFile()
|
let file = Paths.get(Paths.get(fileName, '..', sourceMappingURL).toFile().getCanonicalPath()).toFile()
|
||||||
|
@ -73,6 +73,12 @@ export namespace server {
|
|||||||
getService(service: string): any {
|
getService(service: string): any {
|
||||||
throw new Error("Method not implemented.")
|
throw new Error("Method not implemented.")
|
||||||
}
|
}
|
||||||
|
broadcast(message: string, permission: string) {
|
||||||
|
throw new Error("Method not implemented.")
|
||||||
|
}
|
||||||
|
broadcastMessage(message: string) {
|
||||||
|
throw new Error("Method not implemented.")
|
||||||
|
}
|
||||||
dispatchCommand(sender: string | any, command: string): boolean {
|
dispatchCommand(sender: string | any, command: string): boolean {
|
||||||
throw new Error("Method not implemented.")
|
throw new Error("Method not implemented.")
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export namespace task {
|
|||||||
this.cacheTasks.delete(taskId)
|
this.cacheTasks.delete(taskId)
|
||||||
let ownerName = task.getOwner()?.description.name
|
let ownerName = task.getOwner()?.description.name
|
||||||
if (ownerName && this.pluginCacheTasks.has(ownerName)) {
|
if (ownerName && this.pluginCacheTasks.has(ownerName)) {
|
||||||
this.pluginCacheTasks.get(ownerName).delete(taskId)
|
this.pluginCacheTasks.get(ownerName)?.delete(taskId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { provideSingleton } from '@ccms/container'
|
|||||||
import * as reflect from '@ccms/common/dist/reflect'
|
import * as reflect from '@ccms/common/dist/reflect'
|
||||||
import chat from './enhance/chat'
|
import chat from './enhance/chat'
|
||||||
|
|
||||||
let Bukkit = org.bukkit.Bukkit
|
let Bukkit: typeof org.bukkit.Bukkit = org.bukkit.Bukkit
|
||||||
|
|
||||||
@provideSingleton(server.Server)
|
@provideSingleton(server.Server)
|
||||||
export class BukkitServer extends server.ReflectServer {
|
export class BukkitServer extends server.ReflectServer {
|
||||||
@ -30,6 +30,12 @@ export class BukkitServer extends server.ReflectServer {
|
|||||||
getService(service: string) {
|
getService(service: string) {
|
||||||
return Bukkit.getServicesManager().getRegistration(base.getClass(service))?.getProvider()
|
return Bukkit.getServicesManager().getRegistration(base.getClass(service))?.getProvider()
|
||||||
}
|
}
|
||||||
|
broadcast(message: string, permission: string) {
|
||||||
|
return Bukkit.broadcast(message, permission)
|
||||||
|
}
|
||||||
|
broadcastMessage(message: string) {
|
||||||
|
return Bukkit.broadcastMessage(message)
|
||||||
|
}
|
||||||
dispatchCommand(sender: string | any, command: string): boolean {
|
dispatchCommand(sender: string | any, command: string): boolean {
|
||||||
if (typeof sender === 'string') {
|
if (typeof sender === 'string') {
|
||||||
sender = this.getPlayer(sender)
|
sender = this.getPlayer(sender)
|
||||||
|
@ -58,6 +58,12 @@ export class BungeeServer implements server.Server {
|
|||||||
getService(service: string) {
|
getService(service: string) {
|
||||||
throw new Error("Method not implemented.")
|
throw new Error("Method not implemented.")
|
||||||
}
|
}
|
||||||
|
broadcast(message: string, permission: string) {
|
||||||
|
return Bungee.broadcast(message)
|
||||||
|
}
|
||||||
|
broadcastMessage(message: string) {
|
||||||
|
return Bungee.broadcast(message)
|
||||||
|
}
|
||||||
dispatchCommand(sender: string | any, command: string): boolean {
|
dispatchCommand(sender: string | any, command: string): boolean {
|
||||||
if (typeof sender === 'string') {
|
if (typeof sender === 'string') {
|
||||||
sender = this.getPlayer(sender)
|
sender = this.getPlayer(sender)
|
||||||
|
@ -27,6 +27,12 @@ export class NukkitServer implements server.Server {
|
|||||||
getService(service: string) {
|
getService(service: string) {
|
||||||
return Nukkit.getServiceManager().getProvider(base.getClass(service))
|
return Nukkit.getServiceManager().getProvider(base.getClass(service))
|
||||||
}
|
}
|
||||||
|
broadcast(message: string, permission: string) {
|
||||||
|
return Nukkit.broadcast(message, permission)
|
||||||
|
}
|
||||||
|
broadcastMessage(message: string) {
|
||||||
|
return Nukkit.broadcastMessage(message)
|
||||||
|
}
|
||||||
dispatchCommand(sender: string | any, command: string): boolean {
|
dispatchCommand(sender: string | any, command: string): boolean {
|
||||||
if (typeof sender === 'string') {
|
if (typeof sender === 'string') {
|
||||||
sender = this.getPlayer(sender)
|
sender = this.getPlayer(sender)
|
||||||
|
@ -3,7 +3,8 @@ import { provideSingleton } from '@ccms/container'
|
|||||||
|
|
||||||
import * as reflect from '@ccms/common/dist/reflect'
|
import * as reflect from '@ccms/common/dist/reflect'
|
||||||
|
|
||||||
const Sponge = org.spongepowered.api.Sponge
|
const Sponge: typeof org.spongepowered.api.Sponge = org.spongepowered.api.Sponge
|
||||||
|
const Text: typeof org.spongepowered.api.text.Text = org.spongepowered.api.text.Text
|
||||||
const File = Java.type("java.io.File")
|
const File = Java.type("java.io.File")
|
||||||
|
|
||||||
@provideSingleton(server.Server)
|
@provideSingleton(server.Server)
|
||||||
@ -30,6 +31,12 @@ export class SpongeServer extends server.ReflectServer {
|
|||||||
getService(service: string) {
|
getService(service: string) {
|
||||||
return Sponge.getServiceManager().provide(base.getClass(service)).orElse(null)
|
return Sponge.getServiceManager().provide(base.getClass(service)).orElse(null)
|
||||||
}
|
}
|
||||||
|
broadcast(message: string, permission: string) {
|
||||||
|
return Sponge.getServer().getBroadcastChannel().permission(permission).send(Text.of(message) as any)
|
||||||
|
}
|
||||||
|
broadcastMessage(message: string) {
|
||||||
|
return Sponge.getServer().getBroadcastChannel().TO_ALL.send(Text.of(message) as any)
|
||||||
|
}
|
||||||
dispatchCommand(sender: string | any, command: string): boolean {
|
dispatchCommand(sender: string | any, command: string): boolean {
|
||||||
if (typeof sender === 'string') {
|
if (typeof sender === 'string') {
|
||||||
sender = this.getPlayer(sender)
|
sender = this.getPlayer(sender)
|
||||||
|
Loading…
Reference in New Issue
Block a user