diff --git a/packages/plugins/src/HelloWorld.ts b/packages/plugins/src/HelloWorld.ts index 0cd7daaf..e2ce61aa 100644 --- a/packages/plugins/src/HelloWorld.ts +++ b/packages/plugins/src/HelloWorld.ts @@ -57,23 +57,29 @@ export class HelloWorld extends interfaces.Plugin { return ['world'] } - @listener({ servertype: 'bukkit' }) - playerjoin(event: org.bukkit.event.player.PlayerJoinEvent) { + @listener({ servers: ['bukkit'] }) + PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) { let plyaer = event.getPlayer(); this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`) setTimeout(() => this.logger.sender(plyaer, `§a欢迎来到 §bMiaoScript §a的世界!`), 10); } - @listener({ servertype: 'sponge' }) - clientconnectionevent$join(event: org.spongepowered.api.event.network.ClientConnectionEvent.Join) { + @listener({ servers: ['sponge'] }) + ClientConnectionEvent$Join(event: org.spongepowered.api.event.network.ClientConnectionEvent.Join) { this.logger.console(`§cSponge §aClientConnectionEvent.Join: §b${event.getTargetEntity().getName()}`) setTimeout(() => this.logger.sender(event.getTargetEntity(), `§a欢迎来到 §bMiaoScript §a的世界!`), 10); } - @listener({ servertype: 'bungee' }) - serverconnected(e: any) { + @listener({ servers: ['bungee'] }) + ServerConnected(e: any) { let event = e as net.md_5.bungee.api.event.ServerConnectedEvent this.logger.console(`§cBungeeCord §aServerConnectedEvent: §b${event.getPlayer().getDisplayName()}`) setTimeout(() => this.logger.sender(event.getPlayer(), `§a欢迎来到 §bMiaoScript §a的世界 §6来自 §cBungeeCord §6的问候!`), 10); } + + @listener({ servers: ["bungee"] }) + PluginMessage(e: any) { + let event = e as net.md_5.bungee.api.event.PluginMessageEvent + this.logger.console(`§cBungeeCord §aPluginMessageEvent: §b${event.getTag()}`) + } } diff --git a/packages/plugins/src/Test.ts b/packages/plugins/src/Test.ts index e9467ba5..cfaf2641 100644 --- a/packages/plugins/src/Test.ts +++ b/packages/plugins/src/Test.ts @@ -78,7 +78,7 @@ export class Test extends interfaces.Plugin { return ['run', 'reload', 'channel', 'add', 'yaml', 'speed', 'top', 'up'] } - @listener({ servertype: 'bukkit' }) + @listener({ servers: ['bukkit'] }) playerjoin(event: any) { this.logger.console('PlayerJoinEvent: ', event.player.name) }