refactor: extract proxy & fix bungee chaneel
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
@ -6,20 +6,20 @@ const Bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
@provideSingleton(channel.Channel)
|
||||
export class BungeeChannel extends channel.Channel {
|
||||
@inject(event.Event)
|
||||
private eventManager: event.Event;
|
||||
private eventManager: event.Event
|
||||
|
||||
send(player: any, channel: string, data: any) {
|
||||
throw new Error("Method not implemented.");
|
||||
throw new Error("Method not implemented.")
|
||||
}
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
Bungee.registerChannel(channel);
|
||||
Bungee.registerChannel(channel)
|
||||
// console.console('§6[§eWARN§6] §eMiaoScript channel in BungeeCord only register. you need self hanler PluginMessageEvent!')
|
||||
return this.eventManager.listen({ description: { name: channel } }, "PluginMessageEvent", (event: net.md_5.bungee.api.event.PluginMessageEvent) => {
|
||||
listener(event.getData(), event)
|
||||
})
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
Bungee.unregisterChannel(channel);
|
||||
listener.off();
|
||||
unregister(channel: string, off: any) {
|
||||
Bungee.unregisterChannel(channel)
|
||||
off()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user