@@ -105,7 +105,7 @@ export class MiaoScriptConsole implements Console {
 | 
			
		||||
                        let sourceMappingURL = lastLine.split('sourceMappingURL=', 2)[1]
 | 
			
		||||
                        if (sourceMappingURL.startsWith('data:application/json;base64,')) {
 | 
			
		||||
                            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
 | 
			
		||||
                        } else {
 | 
			
		||||
                            let file = Paths.get(Paths.get(fileName, '..', sourceMappingURL).toFile().getCanonicalPath()).toFile()
 | 
			
		||||
 
 | 
			
		||||
@@ -73,6 +73,12 @@ export namespace server {
 | 
			
		||||
        getService(service: string): any {
 | 
			
		||||
            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 {
 | 
			
		||||
            throw new Error("Method not implemented.")
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ export namespace task {
 | 
			
		||||
                this.cacheTasks.delete(taskId)
 | 
			
		||||
                let ownerName = task.getOwner()?.description.name
 | 
			
		||||
                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 chat from './enhance/chat'
 | 
			
		||||
 | 
			
		||||
let Bukkit = org.bukkit.Bukkit
 | 
			
		||||
let Bukkit: typeof org.bukkit.Bukkit = org.bukkit.Bukkit
 | 
			
		||||
 | 
			
		||||
@provideSingleton(server.Server)
 | 
			
		||||
export class BukkitServer extends server.ReflectServer {
 | 
			
		||||
@@ -30,6 +30,12 @@ export class BukkitServer extends server.ReflectServer {
 | 
			
		||||
    getService(service: string) {
 | 
			
		||||
        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 {
 | 
			
		||||
        if (typeof sender === 'string') {
 | 
			
		||||
            sender = this.getPlayer(sender)
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,12 @@ export class BungeeServer implements server.Server {
 | 
			
		||||
    getService(service: string) {
 | 
			
		||||
        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 {
 | 
			
		||||
        if (typeof sender === 'string') {
 | 
			
		||||
            sender = this.getPlayer(sender)
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,12 @@ export class NukkitServer implements server.Server {
 | 
			
		||||
    getService(service: string) {
 | 
			
		||||
        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 {
 | 
			
		||||
        if (typeof sender === 'string') {
 | 
			
		||||
            sender = this.getPlayer(sender)
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,8 @@ import { provideSingleton } from '@ccms/container'
 | 
			
		||||
 | 
			
		||||
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")
 | 
			
		||||
 | 
			
		||||
@provideSingleton(server.Server)
 | 
			
		||||
@@ -30,6 +31,12 @@ export class SpongeServer extends server.ReflectServer {
 | 
			
		||||
    getService(service: string) {
 | 
			
		||||
        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 {
 | 
			
		||||
        if (typeof sender === 'string') {
 | 
			
		||||
            sender = this.getPlayer(sender)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user