How to use the minecraft-protocol.ping function in minecraft-protocol

To help you get started, we’ve selected a few minecraft-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Electroid / infrastructure / docker / other / request / server.js View on Github external
function server_ping(retries=3) {
  if(retries <= 0) {
    return false;
  }
  var success = null;
  mc.ping({}, function(err, results) {
    success = !err;
  });
  sleep(1000);
  if(!success) {
    success = server_ping(retries - 1);
  }
  return success;
}