Git Product home page Git Product logo

Comments (12)

Enderman-Teleporting avatar Enderman-Teleporting commented on June 11, 2024 1

Thanks for your attention to the problem and it is now OK with the latest version😀

from minestat.

mindsolve avatar mindsolve commented on June 11, 2024

Hi @lUNuXl and @ldilley,

I have gone ahead and moved this to a new issue.

@lUNuXl:

  • Are you sure that you can reach the minecraft server from where you are running this code? And that ip and MINECRAFT_PORT are correct?
  • What version of MineStat Java are you using (can be seen by checking MineStat.VERSION) and from where (Maven?)?
  • Could you try to run the example java code with your server and report its output?

With the following test code, I was able to successfully check the status of a Paper 1.19.2 server:

public static void main(String[] args) {
	String ip = "gameserv.ng.fx3.eu";
	int MINECRAFT_PORT = 25565;

	MineStat mineStat = new MineStat(ip, MINECRAFT_PORT);
	int players;
	if(mineStat.isServerUp()) {
		System.out.printf("Server %s %s is up%n", "examplename", ip);
		players = mineStat.getCurrentPlayers();
	} else {
		System.out.printf("Server %s %s is down%n", "examplename", ip);
		players = 0;
	}

	System.out.printf("Players online: %d%n", players);
}

Output:

Server examplename gameserv.ng.fx3.eu is up
Players online: 0

Best regards,
MindSolve

from minestat.

lUNuXl avatar lUNuXl commented on June 11, 2024

@mindsolve @ldilley I've created a minimal gradle project for reproducting this issue:

https://github.com/lUNuXl/minestat_issue

When run I get the following output:

12:59:19.760 [main] INFO org.example.Main - Checking server status: 35.210.62.232:25565
12:59:20.116 [main] INFO org.example.Main - Server 35.210.62.232 is down
12:59:20.116 [main] INFO org.example.Main - Players online: 0

from minestat.

lUNuXl avatar lUNuXl commented on June 11, 2024

Hm, I think I now know what the issue is.

Calling:

mineStat.isServerUp()

returns always false

from minestat.

ldilley avatar ldilley commented on June 11, 2024

Is your server up now, @lUNuXl? I attempted to telnet to TCP port 25565 of 35.210.62.232 and the connection times out. Perhaps traffic is only allowed from certain source addresses or the server isn't really up?

telnet 35.210.62.232 25565
Trying 35.210.62.232...
telnet: connect to address 35.210.62.232: Operation timed out
telnet: Unable to connect to remote host

from minestat.

ZentixUA avatar ZentixUA commented on June 11, 2024

Same on python (i can't get info of localhost server)

from minestat.

ldilley avatar ldilley commented on June 11, 2024

@GenifeG: What are the versions of the Python module and Minecraft server you're using? Are you absolutely certain that the server is listening and accepting connections on the loopback interface? If the connection is refused or it times out (as shown in my previous comment above yours using telnet) to 127.0.0.1:25565, then it is rightfully detected as being offline.

from minestat.

ldilley avatar ldilley commented on June 11, 2024

@GenifeG: Your issue should be resolved (see #133/#134 for details). @mindsolve found an error with the connection status check in the Python module. Version 2.3.1 contains the fix and this was also deployed to PyPI.

from minestat.

Enderman-Teleporting avatar Enderman-Teleporting commented on June 11, 2024

Hi I am also using java and I find servers with online-mode set as true(such as 2b2t.org and mc.hypixel.net) can never be recognized as online

from minestat.

ldilley avatar ldilley commented on June 11, 2024

Thank you for the additional information, @Enderman-Teleporting. I can confirm the same behavior while probing certain servers. I've narrowed the cause down to how exceptions are handled in Java. java.io.EOFException is being thrown which causes the connection status to be set to CONNFAIL. This prevents the JSON query from being executed. The return value should really be UNKNOWN in this context. I'll submit a fix soon and reply here when complete.

Stack trace:

java.io.EOFException
        at java.base/java.io.DataInputStream.readUnsignedByte(DataInputStream.java:295)
        at me.dilley.MineStat.legacyRequest(MineStat.java:472)
        at me.dilley.MineStat.<init>(MineStat.java:237)
        at me.dilley.MineStat.<init>(MineStat.java:183)
        at Example.main(Example.java:8)

Problematic code:

catch(IOException ioe)
{
  return ConnectionStatus.CONNFAIL;
}

from minestat.

ldilley avatar ldilley commented on June 11, 2024

This issue should be resolved as of PR #135's merger (title says Python, but it also includes the Java fix). The Maven package was also uploaded as version 3.0.5 and should be synchronized within a couple of hours.

from minestat.

ldilley avatar ldilley commented on June 11, 2024

You are welcome. I am glad that the latest commit resolved your issue. You should be all set too, @lUNuXl.

from minestat.

Related Issues (20)

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.