public MinecraftServerConnection()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
     _buffer  = new List <byte>();
 }
 public Task StartAsync(CancellationToken cancellationToken)
 {
     Console.WriteLine("starting background service");
     if (instance == null)
     {
         instance = new MinecraftServerConnection();
     }
     _timer = new Timer(ScheduledFunction, null, TimeSpan.Zero, TimeSpan.FromSeconds(20));
     return(Task.CompletedTask);
 }