feat: add channel support for bungee bukkit sponge
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
18
packages/bungee/src/channel.ts
Normal file
18
packages/bungee/src/channel.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { channel, plugin, event } from '@ms/api'
|
||||
import { inject, injectable } from '@ms/container'
|
||||
|
||||
const Bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
|
||||
@injectable()
|
||||
export class BungeeChannel extends channel.Channel {
|
||||
send(player: any, channel: string, data: any) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
Bungee.registerChannel(channel);
|
||||
console.console('§6[§eWARN§6] §eBungeeCord Channel only registerChannel you need self hanler PluginMessageEvent!')
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
Bungee.unregisterChannel(channel);
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||
|
||||
import { server, command, event, task } from '@ms/api'
|
||||
import { server, command, event, channel, task } from '@ms/api'
|
||||
import { Container } from '@ms/container'
|
||||
|
||||
import { BungeeConsole } from './console';
|
||||
import { BungeeEvent } from './event';
|
||||
import { BungeeServer } from './server';
|
||||
import { BungeeCommand } from './command';
|
||||
import { BungeeChannel } from './channel';
|
||||
import { BungeeTaskManager } from './task';
|
||||
|
||||
export default function BungeeImpl(container: Container) {
|
||||
@ -14,5 +15,6 @@ export default function BungeeImpl(container: Container) {
|
||||
container.bind(event.Event).to(BungeeEvent).inSingletonScope();
|
||||
container.bind(server.Server).to(BungeeServer).inSingletonScope();
|
||||
container.bind(command.Command).to(BungeeCommand).inSingletonScope();
|
||||
container.bind(channel.Channel).to(BungeeChannel).inSingletonScope();
|
||||
container.bind(task.TaskManager).to(BungeeTaskManager).inSingletonScope();
|
||||
}
|
||||
|
Reference in New Issue
Block a user