I am making a plugin that makes signs show if a server is up when someone right clicks it. How do I check if a server is up?
nubebuster Run a socket on a separate thread, and see if it gives any response. The target server is either lagging or not online, if the socket times out.
nubebuster http://forums.bukkit.org/threads/web-php-simple-to-use-minecraft-server-status-query.144329/
How about you do a bit of research instead of asking to be spoon fed with no attempts of your own whatsoever?
I would also recommend learning java from reading a book (if you can do that without help) or a video before you start making mods/plugins.
ImPhantom I know Java, I own a server with 4k unique players in 5 days and the only thing I am asking is how to ping a server in code. Exaplme: Code: public void PingServer(){ }
nubebuster The amount of players on your server has absolutely nothing to do with your Java knowledge.
InetAddress net; net = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1}); System.out.println(net.isReachable(5000) ? "reachable" : "not reachable");
nubebuster Whoaa!! How cool are you? You can make a BASIC method.... A fucking 7 year old could do that.
nubebuster Try catch new Socket for IP and port. Seriously, find oracle docs, this should be solved already had you taken the single second to load that page.
Actually if you wanna go there, since you capitalized "BASIC" you referred to the BASIC programming language. No, he didn't make a BASIC method, he made a basic Java method. Being rude isn't cool, bro.
ImPhantom Lol, afk for a day or 3 OK maybe I was kindof trying to not be seen as a nube. But I am indeed not, not at Bukkit API. But for the rest, YES. ImPhantom Konkz Jake6177 xTrollxDudex
nubebuster Google it, PHP: InetAddress address = InetAddress.getByName("address"); if (address.isReachable(3000)) { return true; } return false;
Code: public static boolean isListening(String ip, int port) { Socket s; try { s = new Socket(ip, port); return true; } catch (Exception e) { return false; } } We were all at his level at one point, stop being dicks.
It's ServerListPingEvent and it triggers when the server is pinged. OP is trying to ping another server, I've given him the code, further posted is rather irrelevant.
nubebuster Barinade is right try using that. If the server gets a return responce let it display the given information. Try doing that also i recommend Java for Dummies its actually pretty good. http://it-ebooks.info/book/777/