feat: add qrcode lib
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
63ff11def1
commit
b400ab81f0
@ -8,18 +8,30 @@ const Messenger = Bukkit.getMessenger()
|
||||
@provideSingleton(channel.Channel)
|
||||
export class BukkitChannel extends channel.Channel {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
private pluginInstance: any
|
||||
|
||||
send(player: any, channel: string, data: any) {
|
||||
player.sendPluginMessage(this.pluginInstance, channel, data);
|
||||
/**
|
||||
* 给玩家发送通道消息
|
||||
* @param player 接受消息的玩家
|
||||
* @param channel 通道
|
||||
* @param data 数据
|
||||
*/
|
||||
send(player: any, channel: string, data: number[]) {
|
||||
player.sendPluginMessage(this.pluginInstance, channel, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册通道监听器
|
||||
* @param channel 通道
|
||||
* @param listener 监听器
|
||||
*/
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
Messenger.registerIncomingPluginChannel(this.pluginInstance, channel, new PluginMessageListener({
|
||||
onPluginMessageReceived: (/**String */ channel, /**Player */ player, /**byte[] */data) => {
|
||||
listener(data, { channel, player, data })
|
||||
}
|
||||
}));
|
||||
Messenger.registerOutgoingPluginChannel(this.pluginInstance, channel);
|
||||
}))
|
||||
Messenger.registerOutgoingPluginChannel(this.pluginInstance, channel)
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
Messenger.unregisterIncomingPluginChannel(this.pluginInstance, channel)
|
||||
|
1243
packages/common/src/qrcode.ts
Normal file
1243
packages/common/src/qrcode.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -73,6 +73,7 @@ declare global {
|
||||
interface Console {
|
||||
ex(err: Error): void
|
||||
stack(err: Error, color?: boolean): string[]
|
||||
sender(sender: any, ...args: any): void
|
||||
sender(...args: any): void
|
||||
console(...args: any): void
|
||||
i18n(name: string, ...params: any[]): void
|
||||
|
Loading…
Reference in New Issue
Block a user