Comments (12)
Thanks for your attention to the problem and it is now OK with the latest version😀
from minestat.
I have gone ahead and moved this to a new issue.
- Are you sure that you can reach the minecraft server from where you are running this code? And that
ip
andMINECRAFT_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.
@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.
Hm, I think I now know what the issue is.
Calling:
mineStat.isServerUp()
returns always false
from minestat.
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.
Same on python (i can't get info of localhost server)
from minestat.
@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.
@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.
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.
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.
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.
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)
- Feature Request - Net Core Support HOT 3
- [Javascript] minestat.online returns True even after server is shut down HOT 6
- Python bug preventing SLP querying
- KeyError: 'motd_2' , when "-" in the IP HOT 12
- Some servers cannot query the information HOT 10
- Add support for SRV record resolution
- Add GameSpy4/UT3 query protocol support
- JSON Protocol Is Removing Whitespace In MOTD HOT 2
- Is there a Gradle version for java? HOT 2
- A question about Java and bedrock server protocols HOT 9
- Python: Port from SRV record is not used HOT 1
- PHP @ Minestat erroe on socket_recv() line 293 HOT 9
- Powershell -> PHP HOT 3
- Player Username option HOT 7
- `description` don't always exist HOT 1
- Possible runtime error when MotD is empty/null HOT 1
- KeyError `players` HOT 4
- [Ruby] `srv_suceeded` seems typo
- Nested `extra` in MOTD is not parsed correctly on `stripped_motd` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minestat.