rmmccann / minecraft-status-query Goto Github PK
View Code? Open in Web Editor NEWA java library that uses Minecraft's query protocol to fetch information about a Minecraft server.
License: MIT License
A java library that uses Minecraft's query protocol to fetch information about a Minecraft server.
License: MIT License
Whenever I try to run this at all, It always gives me a "Socket Timeout! Is the server offline?" regardless of the IP address and port entered in.
Full error: Socket Timeout! Is the server offline? Exception in thread "main" java.lang.NullPointerException: Cannot read the array length because "bytes" is null at java.base/java.lang.String.<init>(String.java:632) at query.MCQuery.handshake(MCQuery.java:45) at query.MCQuery.basicStat(MCQuery.java:54) at mainStuff.testerewr.main(yepThisIsABucket.java:8)
There is a bug in this API if you start the Minecraft server with
motd=\u00A7e<\u0000
In the QueryResponse.java there is
motd = new String(temp[3]);
but when you put this strange motd the temp[4] is empty and then all others variable attribution are wrong.
To produce the bug just put motd=\u00A7e<\u0000 in your server.properties file and start the server. Then try to get the full Query info.
code
package com.themixray;
import java.util.logging.Logger;
public class Main {
public static void main(String[] args) {
Logger log = Logger.getLogger("LOG");
long st = System.currentTimeMillis();
MCQuery mcQuery = new MCQuery("0.tcp.ngrok.io", 12601);
QueryResponse response = mcQuery.basicStat();
float ping = (float)System.currentTimeMillis()-st;
log.info("ping "+Float.toString(ping));
}
}
I get a NullPointerExeption with this "token = Integer.parseInt(new String(result).trim());" on line 45 in class MCQuery.
If there is a single quote in a JSON string, it won't parse properly. This occurs sometimes when there is a single quote in a server motd string.
Is there a jar file or anything I have to put in my build.gradle
?
or do I have to build it myself?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.