示例#1
0
 public override async Task OnStart(ServerStartedNotification notification, IPluginContext context)
 {
     if (CrashRecoveryQueue.TryDequeue(out var crashTimestamp))
     {
         await _minecraftDiscordClient.SendMessageAsync($"The minecraft server started successfully after the crash on {crashTimestamp}");
     }
 }
 public async Task Handle(ServerStartedNotification notification, CancellationToken cancellationToken)
 {
     _state.Running = true;
     _state.CurrentPlayers.Clear();
     _state.StartTime = DateTimeOffset.Now;
     await _mediator.Publish(new MinecraftStateNotification
     {
         CurrentState = _state
     });
 }
 public async Task Handle(ServerStartedNotification notification, CancellationToken cancellationToken)
 {
     foreach (var plugin in _pluginLoader.Enabled)
     {
         try
         {
             await plugin.OnStart(notification, _pluginContext);
         }
         catch (Exception ex)
         {
             await _mediator.Publish(new PluginLogNotification
             {
                 Exception = ex,
                 Message   = $"Error in {nameof(plugin.OnStart)} for plugin {plugin.Name}"
             });
         }
     }
 }
 public override async Task OnStart(ServerStartedNotification notification, IPluginContext context)
 {
     await _minecraftDiscordClient.SendMessageAsync("Server started");
 }
 public virtual Task OnStart(ServerStartedNotification notification, IPluginContext context)
 {
     return(Task.CompletedTask);
 }