Jump to content

Minecraft status implementing


matthijs110

Recommended Posts

Please be more specific. Not everyone knows what minecraft is, and as pointed out, status box is a very vague term.

 

If you are unsure how to run Javascript in your browser, you should read the tutorials here and get yourself familiar with the basics. As for communicating with a server, that usually requires making some sort of HTTP request (possibly with AJAX) to a server side script, most common around here is PHP.

 

As for a minecraft server, what documentation is available? Where is the "status" that you need to obtain? How do you obtain it? I'm sure we can help you put the pieces together, but first you need to tell us what the actual pieces are.

Link to comment
Share on other sites

Please be more specific. Not everyone knows what minecraft is, and as pointed out, status box is a very vague term.

 

If you are unsure how to run Javascript in your browser, you should read the tutorials here and get yourself familiar with the basics. As for communicating with a server, that usually requires making some sort of HTTP request (possibly with AJAX) to a server side script, most common around here is PHP.

 

As for a minecraft server, what documentation is available? Where is the "status" that you need to obtain? How do you obtain it? I'm sure we can help you put the pieces together, but first you need to tell us what the actual pieces are.

 

What's a "status box?"

 

Javascript is always "connected" to HTML. They work together.

Like this:

http://xpaw.ru/mcstatus/

 

4Wm78.png

Edited by matthijs110
Link to comment
Share on other sites

They have server-side systems checking the information. Probably written in Java since that's what Minecraft runs on. HTML and Javascript on their own aren't going to be able to obtain that information.

Link to comment
Share on other sites

A program on the server knows what Minecraft is doing and sends the information to the browser when requested. Perhaps the minecraft server itself was modified to perform that function.

 

I don't know exactly how they did it because there are many possible solutions. And I'd have to look up documentation first if I wanted to program a system like that myself. It's not easy.

Link to comment
Share on other sites

A program on the server knows what Minecraft is doing and sends the information to the browser when requested. Perhaps the minecraft server itself was modified to perform that function.

 

I don't know exactly how they did it because there are many possible solutions. And I'd have to look up documentation first if I wanted to program a system like that myself. It's not easy.

Its using Query. (On a different port)

Or you can use MineQuery <<-- Thats a plugin for the server

Edited by matthijs110
Link to comment
Share on other sites

  • 2 weeks later...

If you can get that data then creating the page is trivial, that's just a basic layout with the stats in 2 columns. That's the easy part. Getting the data is the difficult part.

 

According to this page:

 

http://wiki.vg/Query

 

It looks like the basic servers have an optional query interface that you can use to gather statistics. You would need a database in your side to store everything to display on your page, and you can run a job to refresh the data periodically (or you can query the servers each time the page is loaded, but that's going to take longer to load the page).

 

The bottom of that wiki page includes some links to implementations in various languages, and it looks like there are some packages for PHP available also if you want to use that. Either way, you would have a server-side portion that connects to the various servers and gathers data about them to store in your database, and then a portion to get that data from your database and display it on your site.

 

https://www.google.com/search?client=opera&q=mincraft+query+php&sourceid=opera&ie=UTF-8&oe=UTF-8

Link to comment
Share on other sites

If you can get that data then creating the page is trivial, that's just a basic layout with the stats in 2 columns. That's the easy part. Getting the data is the difficult part. According to this page: http://wiki.vg/Query It looks like the basic servers have an optional query interface that you can use to gather statistics. You would need a database in your side to store everything to display on your page, and you can run a job to refresh the data periodically (or you can query the servers each time the page is loaded, but that's going to take longer to load the page). The bottom of that wiki page includes some links to implementations in various languages, and it looks like there are some packages for PHP available also if you want to use that. Either way, you would have a server-side portion that connects to the various servers and gathers data about them to store in your database, and then a portion to get that data from your database and display it on your site. https://www.google.com/search?client=opera&q=mincraft+query+php&sourceid=opera&ie=UTF-8&oe=UTF-8

Okay, i want use this one,https://github.com/kmpm/node-mcqueryWhat do I need to put in my webhost, which file do I need to change? And how does it connects to my HTML code?
Link to comment
Share on other sites

I would start by reading the docs. It should tell you how to enable and configure the Query protocol on your minecraft server. It is likely something no one on this forum has done, but if you have trouble with specific steps, then we can try and help you out. (maybe in the web server forum). There examples provided as well in the link you gave, and this all assume the server you are querying from is running nodejs (hence the name node-mcquery).

 

As for "connecting" it your HTML code, justsomeguy already explained that. Likely you will want to persist the stats/data etc of the minecraft server in a database somewhere (or maybe even just a text/xml file) and then have the backend read that file or get that data from the database and either expose it via a file you can make an AJAX request to, or bundled into the output of your page's markup somehow.

Link to comment
Share on other sites

I would start by reading the docs. It should tell you how to enable and configure the Query protocol on your minecraft server. It is likely something no one on this forum has done, but if you have trouble with specific steps, then we can try and help you out. (maybe in the web server forum). There examples provided as well in the link you gave, and this all assume the server you are querying from is running nodejs (hence the name node-mcquery).

 

As for "connecting" it your HTML code, justsomeguy already explained that. Likely you will want to persist the stats/data etc of the minecraft server in a database somewhere (or maybe even just a text/xml file) and then have the backend read that file or get that data from the database and either expose it via a file you can make an AJAX request to, or bundled into the output of your page's markup somehow.

So I have to put every file in a folder of my root, then change the IP/Port to the right settings?I am still confused on how to connect it to a HTML Code. I want it like Now online or Offline. How can i do that? (example?)

Link to comment
Share on other sites

The relation between PHP and HTML is that PHP writes the HTML as if it was making the page in a text editor.

 

Getting the data is one thing, but assuming you already have data in a variable, you can use it to print that HTML that you would put in the page if you were creating it yourself.

 

 

// This data is actually provided by your API$data = array('total_players' => 153,'currently_online' => 152); // Just print the HTML and put the data where you need itecho '<div class="greenbox">';echo $data['currently_online'] . '/' . $data['currently_online'];echo '</div>'; /*Don't forget that the document has all the <html>, <body>, <link rel="stylesheet"> and all the rest.All that is omitted in this example to point out the important parts*/
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...