feat: update server filter

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-01-17 17:43:45 +08:00
parent 1ff33702d8
commit 849393492f
2 changed files with 13 additions and 7 deletions

View File

@ -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()}`)
}
}

View File

@ -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)
}