Actual version is v1.6 intended for newest Craftbukkit versions.
Basic information
This plugin sends data to custom .PHP file on your website using GET headers. The data is information about current server status, e.g. Online/Offline, number of online players etc.
On the first start of server with this plugin the plugin creates folder ServerStatus and the configuration file. Then you have set data in config and restart the server.
In configuration file config.yml you can set useSecurityKey (true or false), your security key and full path (adress) to the .PHP file.
Security key can be any expession you want, you will need to set it only in this config.yml file and then in .PHP file. Key will be sent by plugin in GET header, and the .PHP file will check if it is equal.
Then you can set connection timeout. It means how long time give you to plugin to connect to .PHP file. (in milliseconds)
(set -1 for default timeout)
And there is a ignore list. Players in ignore list will be ignored from counting and listing players (plugin won't send them to .PHP file).
Finally you can set refresh-rate to some number of seconds. It means that the plugin will send newest information every x seconds. (set -1 for disabling periodic call)
In this .PHP file is only easy script to read data from GET headers and to write it into .TXT file. You have to set the security key and if you are good .PHP programmer, you would be able to rewrite the code to whatever you want (e.g. write data to .HTML files, to MySQL database,...).
You can choose, if you want to have banner.png or some TXT file with server status.
Banner will look like this:
List of GET headers
sec - The security key
status - Status of the server, can be Online or Offline
name - Name of the server, loaded from server-properties file
motd - Server's message of the day from server-properties file
ip - IP adress of the server, loaded from server-properties file
port - Port of server behind the IP adress, loaded from server-properties file
plsnum - Number of online players
maxnum - Maximum number of players, loaded from server-properties file
players - List of online players
log - Reason why was the URL called (It can be "Starting up Minecraft server", "Stopping Minecraft server", "Player (name) has joined the game", "Player (name) has left the game")
plversion - Contains version number of this plugin
bkversion - Contains version number of used Bukkit version
server.properties
Don't forget to set correct information (server-ip, server-port, server-name, max-players) in server's file server.properties!
Commands & Permissions
serverstatus.reload - Allows you to use /serverstatus command, which reloads the config
serverstatus.ignore - Player with this permission will be ignored from counting and listing players
Changelog
v1.6
Added option to set refresh-rate to -1 for disabling periodic call or set it to any time in seconds
Added option to set connection-timeout to -1 for default timeout or set it to any time in milliseconds
(and no kidding, now is the java.lang.NullPointerException error really fixed! :))
Why not? That just makes it look even more like your copying my plugin. I hope your not but it certainly looks like it, you use the same methods and everything. Looks like you added 1-2 things and changed the $_GET names...
No I will not show you my plugin source.
And, I think that using jQuery for this is very unnecessary, because jQuery slows down whole pages in older browsers, so why don't use basic JavaScript?
Btw my JS code doesn't reload the index/home page at all, read it one more time.
Its not that I would write my own code, it's just that I wrote it to help you clean it up. The code you provide is good for small websites that have 25-50 users online at a time, but if you have more than that the $_GET variables to regular php variables will slow down loading time.
Also, Can I see the plugin source? This plugin is extremely similar to mine.
As far as refreshing the content of who's online, i suggest you just do something like this.
Next option for you is to make JavaScript code checking if the status.txt file was changed, and if it was, JavaScript will refresh the <iframe>. It's propably much better option than refreshing <iframe> every 5 seconds.
How to do that? Save content of status.txt file into first string, and than set interval to 5 seconds, and set the code to take content of server.txt file to second string, then compare the strings and if they aren't equal, refresh the <iframe> and set the value of the first string to the value of the second string.
I think that people who don't understand PHP language won't say that my code is messy, and the people who understand PHP language will write own code (like you).
You can get all this information from vanilla minecraft. Just use minequery thats built into minecraft.
As far as refreshing, just have javascript refresh a section (<div> tag) every 5-10 seconds. Thats what I do for my online player list at http://minersworld.net at the bottom. It uses my plugin bukkitstats to store the online players in a database, then the website gets the players out of the database and shows their picture on the page.
Simple. If you want the code ill give it to you. Just PM me
On topic...
I looked at your PHP Code and its very messy. Learn how to organize it. Here is a better, cleaned up code that doesn't turn things to variables.
<?php// Here you have to set your security key:$securityKey="12345";// Then edit the name for .TXT file with server status:$fileName="status.txt";// Don't edit the code below if you don't understand PHP programming!if(!isset($_GET['sec']){echo"Error! No security key given!";}elseif($_GET['sec']==$securityKey){$players=str_replace("-",",",substr_replace($_GET['players'],"",-1));$fh=fopen($fileName,'w')ordie("Unable to locate file specified");$string='Status: '.$_GET['status'].'\nServer Name: '.$_GET['name'].'\nIP Address: '.$_GET['ip'].':'.$_GET['port'].'\nPlayers Online: '.$_GET['plsnum'].'/'.$_GET['maxnum'].'\n'.$players;fwrite($fh,$string);fclose($fh);}?>
Well the refreshing part, i am already getting it. Plus wont the refreshing keep going as long as the user is on the website?
I mean't something like on my website;
www.pvpkillz.com
On the right and left you can see the player numbers and they are live feed.
Right when you join it changes it and i think it refreshes once the player value changes.
i think its set to obtain the number of players every 180 milliseconds from the server.
I did the iframe refresh, before, and it showed people that the website is still loading even tho its just refreshing the iframes.
If i can somehow add MOTD to the status it will be cool.
I just don't know how to obtain it.
Btw, the plugin i am using is simpleplayerlist
but if you can add the MOTD ( Cause i have a Dynamic MOTD) then i will for sure move to this plugin.
You have to refresh page on web using e.g. JavaScript, because your page doesn't know when it should refresh. I suppose you load the .TXT file in your HTML page by <iframe> tag, so you can use for example:
functionstatus(){document.getElementById("iframe").contentDocument.location.reload(true);}window.setInterval("status();",5000);// this code will refresh server status every 5 seconds
But you can write server status into .HTML file, so you can refresh the .HTML file by <meta> tag. You have many options how to do this.
This plugin doesn't obtain the MOTD, but it's good thing to do! :)
would it be possible to have a html code insted of php?
@Spiiikes
Try it again now. The link is: Link Removed: http://www.mediafire.com/?0f87hfkbiav15qv
The webpage doesn't show anything? It's blank.
i cant download the Phpfile.zip :X
@PigPlushy
I even don't know that you have a similar plugin, I just continue from the idea of ServerIP plugin, which became inactive.
PigPlushy
some messy code? just another way of writing, I use a lot of functions !
you're talking about "load time"! with ajax, you will not see that because ajax loader first
I've been working on a page for my website to be compatible white this plugin You may use my script
Why not? That just makes it look even more like your copying my plugin. I hope your not but it certainly looks like it, you use the same methods and everything. Looks like you added 1-2 things and changed the $_GET names...
@PigPlushy
No I will not show you my plugin source. And, I think that using jQuery for this is very unnecessary, because jQuery slows down whole pages in older browsers, so why don't use basic JavaScript? Btw my JS code doesn't reload the index/home page at all, read it one more time.
Its not that I would write my own code, it's just that I wrote it to help you clean it up. The code you provide is good for small websites that have 25-50 users online at a time, but if you have more than that the $_GET variables to regular php variables will slow down loading time.
Also, Can I see the plugin source? This plugin is extremely similar to mine.
As far as refreshing the content of who's online, i suggest you just do something like this.
Then save that as status.php
Now on your home page, you would do
and at the bottom of that page, just reload status.php so the index/home page doesn't load at all
@Undeadkillz
Next option for you is to make JavaScript code checking if the status.txt file was changed, and if it was, JavaScript will refresh the <iframe>. It's propably much better option than refreshing <iframe> every 5 seconds.
How to do that? Save content of status.txt file into first string, and than set interval to 5 seconds, and set the code to take content of server.txt file to second string, then compare the strings and if they aren't equal, refresh the <iframe> and set the value of the first string to the value of the second string.
@PigPlushy
I think that people who don't understand PHP language won't say that my code is messy, and the people who understand PHP language will write own code (like you).
You can get all this information from vanilla minecraft. Just use minequery thats built into minecraft.
As far as refreshing, just have javascript refresh a section (<div> tag) every 5-10 seconds. Thats what I do for my online player list at http://minersworld.net at the bottom. It uses my plugin bukkitstats to store the online players in a database, then the website gets the players out of the database and shows their picture on the page.
Simple. If you want the code ill give it to you. Just PM me
On topic... I looked at your PHP Code and its very messy. Learn how to organize it. Here is a better, cleaned up code that doesn't turn things to variables.
I'm working on a php page for my site and if you want i will post it here when it's finished
@PerwinCZ
Well the refreshing part, i am already getting it. Plus wont the refreshing keep going as long as the user is on the website? I mean't something like on my website; www.pvpkillz.com On the right and left you can see the player numbers and they are live feed. Right when you join it changes it and i think it refreshes once the player value changes. i think its set to obtain the number of players every 180 milliseconds from the server.
I did the iframe refresh, before, and it showed people that the website is still loading even tho its just refreshing the iframes. If i can somehow add MOTD to the status it will be cool. I just don't know how to obtain it.
Btw, the plugin i am using is simpleplayerlist but if you can add the MOTD ( Cause i have a Dynamic MOTD) then i will for sure move to this plugin.
@DarkMinecrafter
Says 403 Forbidden:
This project is currently under moderation. Please come back later.
If you find this to be in error, please notify the administrators.
@Undeadkillz
You have to refresh page on web using e.g. JavaScript, because your page doesn't know when it should refresh. I suppose you load the .TXT file in your HTML page by <iframe> tag, so you can use for example:
But you can write server status into .HTML file, so you can refresh the .HTML file by <meta> tag. You have many options how to do this.
This plugin doesn't obtain the MOTD, but it's good thing to do! :)
@Undeadkillz
Have a look at this
http://dev.bukkit.org/server-mods/server-banner/
Does it live feed it? So without refreshing the page have the numbers of players change? And does it also obtain the MOTD?