Git Product home page Git Product logo

minestat's Introduction

MineStat πŸ“ˆ

AppVeyor build status CodeQL build status CodeFactor grade Discord

MineStat is a Minecraft server status checker.

You can use these classes/modules in a monitoring script to poll multiple Minecraft servers, include similar functionality in a Discord bot, or to let visitors see the status of your server from their browser. MineStat has been ported to multiple languages for use with ASP.NET, FastCGI, mod_perl, mod_php, mod_python, Node.js, Rails, Tomcat, and more.

If you are planning to host MineStat on a shared webhost, make sure that the provider allows outbound sockets.

Protocol Support πŸ“ž

Note: The Go, JavaScript, and Perl implementations are currently under development.

Protocol C# Go Java JavaScript Perl PHP PowerShell Python Ruby
1.8b/1.3 (beta) βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
1.4/1.5 (legacy) βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
1.6 (extended legacy) βœ”οΈ ❌ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
>=1.7 (JSON) βœ”οΈ ❌ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
Bedrock/PE/RakNet βœ”οΈ βœ”οΈ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
UT3/GS4 Query ❌ ❌ ❌ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ

Examples πŸ“

C# example

Nuget

using System;
using MineStatLib;

class Example
{
  public static void Main()
  {
    MineStat ms = new MineStat("minecraft.frag.land", 25565);
    Console.WriteLine("Minecraft server status of {0} on port {1}:", ms.Address, ms.Port);
    if(ms.ServerUp)
    {
      Console.WriteLine("Server is online running version {0} with {1} out of {2} players.", ms.Version, ms.CurrentPlayers, ms.MaximumPlayers);
      if(ms.Gamemode != null)
        Console.WriteLine("Game mode: {0}", ms.Gamemode);
      Console.WriteLine("Message of the day: {0}", ms.Stripped_Motd);
      Console.WriteLine("Latency: {0}ms", ms.Latency);
      Console.WriteLine("Connected using protocol: {0}", ms.Protocol);
    }
    else
      Console.WriteLine("Server is offline!");
  }
}

Go example

Go Reference

To use the Go package: go get github.com/FragLand/minestat/Go/minestat

package main

import "fmt"
import "github.com/FragLand/minestat/Go/minestat"

func main() {
  minestat.Init("minecraft.frag.land")
  fmt.Printf("Minecraft server status of %s on port %d:\n", minestat.Address, minestat.Port)
  if minestat.Online {
    fmt.Printf("Server is online running version %s with %d out of %d players.\n", minestat.Version, minestat.Current_players, minestat.Max_players)
    fmt.Printf("Message of the day: %s\n", minestat.Motd)
    fmt.Printf("Latency: %dms\n", minestat.Latency)
    fmt.Printf("Connected using protocol: %s\n", minestat.Protocol)
  } else {
    fmt.Println("Server is offline!")
  }
}

Java example

Maven

import land.Frag.MineStat;

class Example
{
  public static void main(String[] args)
  {
    MineStat ms = new MineStat("minecraft.frag.land", 25565);
    System.out.println("Minecraft server status of " + ms.getAddress() + " on port " + ms.getPort() + ":");
    if(ms.isServerUp())
    {
     System.out.println("Server is online running version " + ms.getVersion() + " with " + ms.getCurrentPlayers() + " out of " + ms.getMaximumPlayers() + " players.");
     System.out.println("Message of the day: " + ms.getMotd());
     System.out.println("Message of the day without formatting: " + ms.getStrippedMotd());
     System.out.println("Latency: " + ms.getLatency() + "ms");
     System.out.println("Connected using protocol: " + ms.getRequestType());
    }
    else
      System.out.println("Server is offline!");
  }
}

JavaScript example

npm

To use the npm package: npm install minestat

var ms = require('minestat');
ms.initSync({address: 'minecraft.frag.land', port: 25565}, function(error, result)
{
  if(error)
  {
    console.log('Error encountered during connection attempt.');
    throw error;
  }
  console.log("Minecraft server status of " + result.address + " on port " + result.port + ":");
  if(result.online)
  {
    console.log("Server is online running version " + result.version + " with " + result.current_players + " out of " + result.max_players + " players.");
    console.log("Message of the day: " + result.motd);
    console.log("Latency: " + result.latency + "ms");
  }
  else
  {
    console.log("Server is offline!");
  }
});

Perl example

CPAN

To use the CPAN module: cpan Minecraft::ServerStatus

use Minecraft::ServerStatus;

$ms = Minecraft::ServerStatus::init("minecraft.frag.land", 25565);

print "Minecraft server status of $ms->{address} on port $ms->{port}:\n";
if($ms->{online})
{
  print "Server is online running version $ms->{version} with $ms->{current_players} out of $ms->{max_players} players.\n";
  print "Message of the day: $ms->{motd}\n";
  print "Latency: $ms->{latency}ms\n";
}
else
{
  print "Server is offline!\n";
}

PHP example

Packagist Version

Note: MineStat for PHP requires multi-byte string support to handle character encoding conversion. Enabling mbstring support can be as simple as installing the php-mbstring package for your platform. If building PHP from source, see https://www.php.net/manual/en/mbstring.installation.php. To validate, phpinfo() output will reference mbstring if the feature is enabled.

<?php
require_once('minestat.php');

$ms = new MineStat("minecraft.frag.land", 25565);
printf("Minecraft server status of %s on port %s:<br>", $ms->get_address(), $ms->get_port());
if($ms->is_online())
{
  printf("Server is online running version %s with %s out of %s players.<br>", $ms->get_version(), $ms->get_current_players(), $ms->get_max_players());
  if($ms->get_request_type() == "Bedrock/Pocket Edition")
    printf("Game mode: %s<br>", $ms->get_mode());
  printf("Message of the day: %s<br>", $ms->get_motd());
  printf("Message of the day without formatting: %s<br>", $ms->get_stripped_motd());
  printf("Latency: %sms<br>", $ms->get_latency());
  printf("Connected using protocol: %s<br>", $ms->get_request_type());
}
else
{
  printf("Server is offline!<br>");
}
?>

PowerShell example

Gallery

To install the module: Install-Module -Name MineStat

Import-Module MineStat
$ms = MineStat -Address "minecraft.frag.land" -port 25565
"Minecraft server status of '{0}' on port {1}:" -f $ms.Address, $ms.Port

if ($ms.Online) {
  "Server is online running version {0} with {1} out of {2} players." -f $ms.Version, $ms.Current_Players, $ms.Max_Players
  "Message of the day: {0}" -f $ms.Stripped_Motd
  "Latency: {0}ms" -f $ms.Latency
  "Connected using SLP protocol '{0}'" -f $ms.Slp_Protocol
}else {
  "Server is offline!"
}

Python example

PyPI

To use the PyPI package: pip install minestat

import minestat

ms = minestat.MineStat('minecraft.frag.land', 25565)
print('Minecraft server status of %s on port %d:' % (ms.address, ms.port))
if ms.online:
  print('Server is online running version %s with %s out of %s players.' % (ms.version, ms.current_players, ms.max_players))
  # Bedrock specific attribute:
  if ms.gamemode:
    print('Game mode: %s' % ms.gamemode)
  print('Message of the day: %s' % ms.motd)
  print('Message of the day without formatting: %s' % ms.stripped_motd)
  print('Latency: %sms' % ms.latency)
  print('Connected using protocol: %s' % ms.slp_protocol)
else:
  print('Server is offline!')

See the Python specific readme (Python/README.md) for a full list of all supported attributes.

Ruby example

Gem

To use the gem: gem install minestat

require 'minestat'

ms = MineStat.new("minecraft.frag.land", 25565)
puts "Minecraft server status of #{ms.address} on port #{ms.port}:"
if ms.online
  puts "Server is online running version #{ms.version} with #{ms.current_players} out of #{ms.max_players} players."
  puts "Game mode: #{ms.mode}" if ms.mode
  puts "Message of the day: #{ms.motd}"
  puts "Message of the day without formatting: #{ms.stripped_motd}"
  puts "Latency: #{ms.latency}ms"
  puts "Connected using protocol: #{ms.request_type}"
else
  puts "Server is offline!"
end

Contributing and Support :octocat:

Feel free to submit an issue if you require assistance or would like to make a feature request. You are also welcome to join our Discord server. Any contributions such as build testing, creating bug reports or feature requests, and submitting pull requests are appreciated. Our code style guidelines can be found in the "Coding Convention" section of CONTRIBUTING.md. Please see the fork and pull guide if you are not certain how to submit a pull request.

Contributors

minestat's People

Contributors

ajoro avatar arnesacnussem avatar c0m4r avatar deadlineem avatar dependabot[bot] avatar jrdiver avatar kolletzki avatar kolyaventuri avatar ldilley avatar mindsolve avatar nukka avatar runthebot avatar ryush00 avatar sch8ill avatar seia-soto avatar spongecade avatar swpolgla avatar unn4m3d avatar wangyw15 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minestat's Issues

[Python] Infinite hang on connection close

Minestat Python edition hangs indefinitely if the remote server closes the connection while the script expects more data.
This issue is a regession, introduced by PR #78

Expected Behavior

  • Minestat Python edition should not hang indefinitely, but instead error out or try other protocols

Actual Behavior/Symptoms

  • Minestat Python hangs indefinitely

How to Reproduce Behavior/Symptoms

  • Point minestat at mc.hypixel.net, port 25565
  • Observe hanging (in while loop in _recv_exact)

MineStat Version

Programming Language and Compiler/Interpreter Version

  • Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32

Operating System

  • Windows 7 x64

Add TCP ping capability to measure latency

Measure the time elapsed in milliseconds that it takes to open a TCP connection to the destination server. The C# implementation already contains a delay variable for this purpose. The number of milliseconds elapsed should be rounded to the nearest integer. Lastly, the language examples should be updated to show how this data may also be displayed in output.

motd issue in python (fixed the bug)

I used it in python and my app stopped working because of a type error:
TypeError: a bytes-like object is required, not 'str'

But I found the bug:

Parse the received data

if raw_data is None or raw_data == '':
  self.online = False
else:
  data = raw_data.decode('cp437').split('\x00\x00\x00')
  if data and len(data) >= self.NUM_FIELDS:
    self.online = True
    self.version = data[2].replace("\x00", "")
    self.motd = data[3].encode('utf-8').replace("\x00", "")  #HERE!!
    self.current_players = data[4].replace("\x00", "")
    self.max_players = data[5].replace("\x00", "")
  else:
    self.online = False

I just had to swap them so it firstly replaces the "\x00" to "" than encodes it to utf-8, it fixed my issue.

Parse the received data

if raw_data is None or raw_data == '':
  self.online = False
else:
  data = raw_data.decode('cp437').split('\x00\x00\x00')
  if data and len(data) >= self.NUM_FIELDS:
    self.online = True
    self.version = data[2].replace("\x00", "")
    self.motd = data[3].replace("\x00", "").encode('utf-8')
    self.current_players = data[4].replace("\x00", "")
    self.max_players = data[5].replace("\x00", "")
  else:
    self.online = False

Bedrock support

Add support for Bedrock edition, this is the only working one for java i've found so far sadly

Protocol version support tracker

Issues #20 (1.6), #21 (1.7), #22 (1.8b/1.3), and #45 (Bedrock/PE/RakNet) were for adding missing protocol support to the language implementations referenced in the table below.

Protocol Version Support

Protocol C# Go Java JavaScript Perl PHP PowerShell Python Ruby
1.8b/1.3 (beta) βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
1.4/1.5 (legacy) βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
1.6 (extended legacy) βœ”οΈ ❌ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
1.7 (JSON) βœ”οΈ ❌ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
Bedrock/PE/RakNet βœ”οΈ ❌ βœ”οΈ ❌ ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ

Accommodate extra field in MotD data returned in JSON responses

@isaackogan and @rey-dev reported yesterday via Discord that the MotD appears empty after pinging certain servers (such as Mineplex). After investigating, it was determined that some servers are making use of formatting in their MotDs and this data is being returned in an extra array inside the description object of JSON responses. An example is below:

{"version":{"name":"BungeeCord 1.8.x-1.17.x","protocol":756},"players":{"max":526,"online":525},"description":{"extra":[{"color":"white","text":"                "},{"bold":true,"strikethrough":true,"color":"aqua","text":"   "},{"bold":true,"strikethrough":true,"color":"dark_gray","text":"[ "},{"color":"white","text":" "},{"bold":true,"color":"blue","text":"Mineplex"},{"color":"white","text":" "},{"bold":true,"color":"white","text":"Games"},{"color":"white","text":" "},{"bold":true,"strikethrough":true,"color":"dark_gray","text":" ]"},{"bold":true,"strikethrough":true,"color":"aqua","text":"   "},{"color":"white","text":""}],"text":""}

Notice how the text field of the description object is actually empty. MineStat is working as intended in this regard. However, the extra data is not currently processed at all. @mindsolve proposed stripping the formatting characters out of the response and displaying the plain/unformatted text. Additionally, the extra data in JSON format can be provided so the end user would be able to process it however they choose. For more details regarding JSON and formatting in Minecraft, see the following links:
https://wiki.vg/Chat#Current_system_.28JSON_Chat.29
https://minecraft.fandom.com/wiki/Formatting_codes
https://pypi.org/project/jsontextmc/

Wrong Java logic in requests??

Beginning at line

Retval retval = legacyRequest(address, port, getTimeout());

Shouldn't the logic be this instead: (which would also match more to whats said in the comment above)

        // SLP 1.4/1.5
        Retval retval = legacyRequest(address, port, getTimeout());
        // SLP 1.8b/1.3
        if(retval != Retval.SUCCESS)
          retval = betaRequest(address, port, getTimeout());
        // SLP 1.6
        if(retval != Retval.SUCCESS)
          retval = extendedLegacyRequest(address, port, getTimeout());
        // SLP 1.7
        if(retval != Retval.SUCCESS)
          retval = jsonRequest(address, port, getTimeout())

Because if we keep the logic as it is, namely:

        // SLP 1.4/1.5
        Retval retval = legacyRequest(address, port, getTimeout());
        // SLP 1.8b/1.3
        if(retval != Retval.SUCCESS && retval != Retval.CONNFAIL)
          retval = betaRequest(address, port, getTimeout());
        // SLP 1.6
        if(retval != Retval.CONNFAIL)
          retval = extendedLegacyRequest(address, port, getTimeout());
        // SLP 1.7
        if(retval != Retval.CONNFAIL)
          retval = jsonRequest(address, port, getTimeout())

Then the other requests are done even though the request before already was successfull.

Fix Travis Go build

C#, Go, and Ruby were added to travis.yml. The Java build issue has been resolved. C# and Ruby builds are also passing. However, Go builds are still failing due to an issue with pathing.

Publish Java package to Maven Central Repository

First of all, you did and still do a great job maintaining this project!

I would really like to have an official package published to Maven Central, so that using this library in your application becomes as easy as adding the dependency to your build file.

This should be an easy win in theory, since no new code has to be written.
Here is an overview of what's necessary in order to tackle this: https://maven.apache.org/repository/guide-central-repository-upload.html

'Server is offline'

Hello!
Thanks for the code. But I have faced an issue, that one of the servers can not be queried with the code provided. The server version is 1.7.10. The IP address and the Port are 164.132.201.216:25560.
Meanwhile this service works nice https://mcsrvstat.us/server/164.132.201.216:25560 which means the server can be queried.
Please help me to understand what's wrong. Thanks

Actual behavior/symptoms

'Server if offline'

Steps to reproduce behavior/symptoms

Pass 164.132.201.216:25560 as server option

MineStat version

Latest JS and Go implementations

Operating system

Ubuntu 18.04

minestat.js return error instead of "not online"

I found the minestat.js is behaving very weird, which when it try to query a server that is not opened (online), it will throw and error like the following (TCP connection refuse error) instead of filling online = false

{ Error: connect ECONNREFUSED 127.0.0.1:25566
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1136:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 25566 }

I still haven't figure out a fix to this, but maybe you should take a look of this problem

Reorder SLP protocol attempts

Expected Behavior

  • Anticipated data should be returned by a running Minecraft server.

Actual Behavior/Symptoms

  • The remote TCP port of the Minecraft server refuses communication for a duration of approximately 4 seconds under certain conditions.

How to Reproduce Behavior/Symptoms

  • Attempt to request data from Minecraft 1.4 servers using SLP protocol v1.7 or Minecraft 1.3 servers using SLP protocol v1.6. The Minecraft server seems to block subsequent TCP connection attempts for approximately 4 seconds. This behavior was reported by @mindsolve.

MineStat Version

  • Latest

Programming Language and Compiler/Interpreter Version

  • All language implementations that support multiple SLP protocol versions

Operating System

  • Any

question / bug python

Expected behavior

show the latency, motd, player amount

Actual behavior/symptoms

AttributeError: module 'minestat' has no attribute 'MineStat'

Steps to reproduce behavior/symptoms

  1. go to your python version
  2. go to site-packages folder
  3. make a minestat.py and put the https://github.com/FragLand/minestat/blob/master/Python/minestat.py code in.
  4. use the example
  5. get the error

MineStat version

idk, this one: https://github.com/FragLand/minestat/blob/master/Python/minestat.py

Programming language and compiler/interpreter version

python (3.8.7)
VScode
image

Operating system

Windows 10 (20H2, build: 19042.804, experience: Windows Feature Experience Pack 120.2212.551.0)

Am I just doing something dumb?

1.16.3 Minecraft Server is shown as offline

Expected behavior

Since the Minecraft Server is online, the ping should work and it should be displayed as online.
It used to work perfectly before. Is it because of the 1.16.3 ?
I checked this with other APIs (like mcsrvstat.eu) and they do have it displayed as online.

Actual behavior/symptoms

#isServerUp() returns false

Steps to reproduce behavior/symptoms

MineStat ms = new MineStat("netheranarchy.org", 25565);
System.out.println(ms.isServerUp());

will return false.

MineStat version

Current Version (Latest commit 8 May)

Programming language and compiler/interpreter version

Java

Operating system

Running on Ubuntu

current_players when convert bug

Expected behavior

When convert integer number get all number

Actual behavior/symptoms

When convert integer only one numer. Ej -> String(18) -> int(1)

Steps to reproduce behavior/symptoms

Get current_players and put intval($current_players)

MineStat version

May 25, 2019

Programming language and compiler/interpreter version

PHP apache

Operating system

Ubuntu 18.4

The problem is the have one "invisible" character in middle the numbers.
For the posible solution i was thinking about a character path and then check if they are numbers

Add unit tests

@nukka already added unit tests for Java. Unit tests can be written for the other languages as well.

Organisational: Project handover

Hello everbody!

The original developer and maintainer of MineStat, the dear @ldilley has informed me, that he is no longer able to maintain MineStat and whishes to step down from his position as maintainer. He offered me take over the project from him, as we both think that MineStat should not simply be archived, but instead get a new maintainer and a litte fresh wind in the sails.

I see the following points as to-dos in this regard:

After this is done, we can talk about how the new repo should be handled, what changes should be done and how to do this together as a community.

Best regards,
~MindSolve

Python

Python Module Name?
How to use python script

Ruby gem file permissions are too strict

Behavior/Symptoms

Whenever you attempt to use require 'minestat' within a ruby program, and have the version 2.1.0 gem installed, you get the error 'require': cannot load such file -- minestat (LoadError)

It took me some time to diagnose this issue, however I believe it's because something is wrong with how the ruby gem is configured. Essentially the minestat.rb file that gets installed to your ruby gems directory does not have read permissions assigned to it for everyone, just the user that installed it. It's easy to miss this issue because it only impacts people who use system ruby installed as root, or instances where a gem was installed by a different user than the one trying to use the gem. You could chalk this up to an environment issue on my end, as installing gems as root is bad practice, however this is the only gem I've come across that displays this issue.

I found a similar issue on another project that describes the problem in more detail:
astroband/ruby-stellar-base#55

How to Reproduce Behavior/Symptoms

This issue is not present when you clone this repo, however it is present when you download the .gem file from rubygems.org and unpack it, or let bundler install the gem.

Compare these outputs:

Bundler Installed

swpolgla@Stevens-MBP lib % ls -l
total 32
-rw-r-----  1 root  wheel  12831 Sep 26 13:32 minestat.rb

Unpacked Gem File

swpolgla@Stevens-MBP lib % ls -l
total 32
-rw-r-----@ 1 swpolgla  staff  12831 Sep  7 22:24 minestat.rb

Github Repo Clone

swpolgla@Stevens-MBP lib % ls -l
total 32
-rw-r--r--@  1 swpolgla  staff  13353 Sep 26 15:02 minestat.rb

As you can see, the only version of the file that maintains read permissions for everyone is the github repo clone.
I've temporarily worked around this issue in my project by setting the BUNDLE_PATH environment variable to a folder adjacent to my project files, letting bundler install all the gem dependencies there, and then running chmod -R u+r .gems as a part of my project's startup script.

MineStat Version

  • 2.0.0/2.1.0
    This issue only affects gem versions newer than 0.3.0, so something changed between 0.3.0 and 2.0.0

Programming Language and Compiler/Interpreter Version

  • Ruby 2.6.3
  • Ruby 3.0.2

Operating System

  • MacOS
  • Fedora Linux

Add >=1.7 ping support

#20 was created to add 1.6 SLP support. To become current, 1.7 should also be implemented. The handshake for 1.7 should be as follows:

1. Send 0x00 (handshake packet) with the following fields:
  1a. integer indicating protocol version (just send 1 for ping)
  1b. remote server address as a string
  1c. remote server port as an unsigned short
  1d. send integer 1 to request server status
2. Send 0x00 (request packet)
3. Server should respond with 0x00 and JSON data that must be parsed.

Requesting rubygems.org co-ownership access

I hope you are still around, @unn4m3d. I recently created an account on rubygems.org to update the minestat Ruby gem. You are currently the only owner, so I do not have access unfortunately. Would it be possible to add me at your convenience please? I've also sent you an e-mail as another means of contacting you. My rubygems.org username is LDilley. Here are the instructions to add a gem co-owner: https://guides.rubygems.org/command-reference/#gem-owner

Thank you for any assistance that you can provide, sir.

Wrong default timeout of Java version

Expected behavior

Default timeout of the Java version is 5 seconds (as defined in Minestat.java:33)

Actual behavior/symptoms

Default timeout is 5ms

Steps to reproduce behavior/symptoms

Run the example from the repo with a server that has more than 5ms latency to your machine.
Connection will time out and status will be reported as "offline".

MineStat version

latest

Programming language and compiler/interpreter version

Java

Operating system

Windows, Linux

Using multiple servers in one function

Hey Dilley,

I started creating API with your js, and I want to have multiple servers in one function.

Example of API output.

{seperated_count:{"Skyblock":[355, 55], "Hubs":[588, 0, 45]}, "server_total": 1043}

I'm using nodeJS for the API. I cannot figure out how to put multiple servers in one function.
I tried everything but I didn't get any solution for it.

Woud you please help me with that?

I can figure everything about designing it and that stuff my self ofc, I just need you help with puttin multiple servers in the function.

Thank you for any kind of answer.

With regards,
Yuki Kobayashi.

Whats the gradle import? I can't find it.

Expected behavior

Actual behavior/symptoms

Steps to reproduce behavior/symptoms

MineStat version

Programming language and compiler/interpreter version

Operating system

Add legacy 1.3 ping support

Allow for legacy 1.8b/1.3 ping query support (just in case.) This requires simply sending 0xFE. The response is delimited by Β§ and does not contain the version as in newer releases.

String fields have a space between each character

Expected behavior

The MOTD should reflect what is shown in the Minecraft multiplayer server list.

Actual behavior/symptoms

There is a space between each character of the MOTD, as well as between each character of the version and the player count strings.

Steps to reproduce behavior/symptoms

Ping a server (I used hivemc.eu) and check the aforementioned fields in the result.

MineStat version

Java implementation from d08ee46

Operating system

Windows

Add TCP connection timeout

Add TCP connection timeout for supported languages lacking it. Currently, this includes C#, Go, JavaScript, and PHP. This feature has already been implemented for the Java, Perl, Python, and Ruby code.

1.16.4 Query fails (Ruby)

Expected behavior

I expected it to say, "Online."

Actual behavior/symptoms

>> Server.first.query.online
=> false

Steps to reproduce behavior/symptoms

ms = MineStat.new("test.geysermc.org", 19132)
ms.online # => false

The server is online; see https://mcsrvstat.us/server/test.geysermc.org:19132

MineStat version

minestat (0.3.0)

Programming language and compiler/interpreter version

Ruby 2.7.2

Operating system

macOS Big Sur

I suppose it's Pinging, not Querying.
Going to https://mcsrvstat.us/server/test.geysermc.org:25565 says Ping: Yes and Query: No. (This works)
Going to https://mcsrvstat.us/server/test.geysermc.org:19132 says Ping: No and Query: Yes. (Says offline)

Is this not designed for queries? It would be mega useful if it could unless I am doing it wrong. If you have an alternative that I can use, please let me know :3

disocrd.py output to discord has delete characters between characters

Expected behavior

the server information requested gets sent to discord via an embed

Actual behavior/symptoms

the message gets sent but with delete characters between each character
image

Steps to reproduce behavior/symptoms

using discord.py async branch sending to discord via an embed field

MineStat version

unsure - latest from github as of issue submission

Operating system

tried on linux and windows with same results

Server keeps printing out "Server is Offline", worked before.

Expected behavior

Should be showing the number of players online.

Actual behavior/symptoms

It is showing "Server is Offline!"

Steps to reproduce behavior/symptoms

Not sure.

MineStat version

Latest.

Programming language and compiler/interpreter version

Java, Eclipse IDE

Operating system

Centos 7

`package com.venomsurge;

import com.venomsurge.handlers.CommandHandler;
import com.venomsurge.listeners.CommandListener;
import com.venomsurge.listeners.MyListener;
import com.venomsurge.minecraft.MineStatus;
import com.venomsurge.music.commands.MusicCommand;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;

public class VenomBOT implements Runnable {

public static JDA api;

public void run() {
	while (true) {
		String server = "";
		MineStatus ms = new MineStatus("play.venomsurge.net", 25565);
		if (ms.isServerUp()) {
			if (Integer.parseInt(ms.getCurrentPlayers()) == 1) {
				server = "VenomSurge with 1 player.";
			} else {
				server = "VenomSurge with " + ms.getCurrentPlayers() + " players.";
			}
		} else {
			server = "Server is offline!";
		}
		api.getPresence().setActivity(Activity.playing(server));
		try {
			Thread.sleep(30000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}

public static void main(String[] args) throws Exception {
	String server = "";
	MineStatus ms = new MineStatus("play.venomsurge.net", 25565);
	if (ms.isServerUp()) {
		if (Integer.parseInt(ms.getCurrentPlayers()) == 1) {
			server = "VenomSurge with 1 player.";
		} else {
			server = "VenomSurge with " + ms.getCurrentPlayers() + " players.";
		}
	} else {
		server = "Server is offline!";
	}
	// Initialize the bot status
	api = JDABuilder.createDefault("MY KEY").setStatus(OnlineStatus.ONLINE).setActivity(Activity.playing(server))addEventListeners(new MyListener(), new CommandListener()).build();
	CommandHandler.commands.put("m", new MusicCommand());
	CommandHandler.commands.put("music", new MusicCommand());
	// Launch thread to periodically update the status
	new Thread(new VenomBOT()).start();

}

}`

Pinging hypixel

i am referencing #50 here kinda.

I am trying to tinker around with this and was curious why mc.hypixel.net on port 25565 always gives back "Server ist offline" although the server is not offline. I have read in the bug report above, that the java implementation is not capable of using the correct slp protocol, but according to another bug report, the c# version should support all slp protocols and therefore should be able to retrieve the information, shouldnt it?

Version/MOTD and Bungeecord/Waterfall problems.

Hey, I'm the dude from this pull request: #86
Minestat doesn't detect the versions properly.
See https://autoplug.online/servers and navigate to "new" to see what I mean. (I get this for all servers: >=1.8b/1.3)
When using newer request methods first (like in the PR), I don't get this problem and I'm able to retrieve the right versions, BUT retrieving the MOTD fails and waterfall/bungecoord servers get spammed like one of my users reported here: https://discord.com/channels/707539055448948808/709179613540122744/878806086927400971
Tell me if you need more info, I'm more than happy to provide it ^^

MineStat Version

2.0.0

Programming Language and Compiler/Interpreter Version

Java

Operating System

Windows 10 (latest)

Add 1.6 ping support

MineStat was originally written to only support server list ping for versions 1.4 and 1.5. This query method continues to work on many servers, but some seem to be unresponsive. Implementing the 1.6 SLP protocol will allow MineStat to speak to newer servers. The appropriate data to send in this context would be:

1. 0xFE
2. 0x01
3. 0xFA
4. 0x00 0x4D 0x00 0x43 0x00 0x7C 0x00 0x50 0x00 0x69 0x00 0x6E 0x00 0x67 0x00 0x48 0x00 0x6F 0x00 0x73 0x00 0x74
5. 7 + length of remote hostname in UTF-16BE format as a short
6. 0x4A
7. Remote hostname as UTF-16BE encoded string
8. Remote port as an int

Add support to query servers behind BungeeCord proxies

See issue #5 for more details. This may not be possible. It all depends on if BungeeCord is written to forward queries on to reverse-proxied servers and allow them to reply back to the requester. In the context of the aforementioned issue, there may be a mismatch in player capacity since BungeeCord listeners have their own capacity set in config.yml which may often differ from the max player value defined in server.properties for example.

More research and testing is needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.