示例#1
0
 internal async Task PlayerJoinedNotification(PlayerJoinedNotification notification)
 {
     if (PlayerJoined != null)
     {
         await PlayerJoined?.Invoke(notification);
     }
 }
 public async Task Minecraft_PlayerJoined(PlayerJoinedNotification playerJoinEvent)
 {
     await Application.Current.Dispatcher.InvokeAsync(delegate
     {
         PlayerList.Items.Add(playerJoinEvent.PlayerName);
         PlayerListLabel.Content = $"Players online {PlayerList.Items.Count}/20";
     });
 }
 public async Task Handle(PlayerJoinedNotification notification, CancellationToken cancellationToken)
 {
     foreach (var plugin in _pluginLoader.Enabled)
     {
         try
         {
             await plugin.OnPlayerJoin(notification, _pluginContext);
         }
         catch (Exception ex)
         {
             await _mediator.Publish(new PluginLogNotification
             {
                 Exception = ex,
                 Message   = $"Error in {nameof(plugin.OnPlayerJoin)} for plugin {plugin.Name}"
             });
         }
     }
 }
 public override async Task OnPlayerJoin(PlayerJoinedNotification notification, IPluginContext context)
 {
     await _minecraftDiscordClient.SendMessageAsync($"**{notification.PlayerName}** has joined the game.");
 }
 public async Task Handle(PlayerJoinedNotification notification, CancellationToken cancellationToken)
 {
     await _relayEventHandler.PlayerJoinedNotification(notification);
 }
 public virtual Task OnPlayerJoin(PlayerJoinedNotification notification, IPluginContext context)
 {
     return(Task.CompletedTask);
 }