OnlinePlayersSQL
Description
This plugin will update a MySQL database table with a list of players as the join and disconnect from your game.
Originally created for the MCAddictGallery server, it was created so that we could have a live player listing on our website with minimal of fuss.
Currently the plugin tracks the following information:
- Player Name
- Previous World (used for when a player warps from one world to another)
- Current World (the current world the player is in)
- IP Address
- Logon Time (stored as seconds since epoch)
- Players permission group
- Flag to say whether the player is online or not.
Required Plugins to use this one
- Vault
Optional Plugins that provide extra features
- SimplyVanish - Not required, but if you want the players list to not show vanished players, then you will likely want this.
Configuration
config.yml
MySQLServer: localhost MySQLPort: '3306' MySQLUsername: <username for db> MySQLPassword: <password for db> MySQLDatabase: <database to use> MySQLTable: <table to use> showDebug: true|false op_only_resync: true|false
eg.
MySQLServer: localhost MySQLPort: '3306' MySQLUsername: player_tracker MySQLPassword: fred123 MySQLDatabase: player_tracker MySQLTable: online_players showDebug: false op_only_resync: false
This plugin will check to see if the necessary table exists in 'MySQLDatabase' and if it doesn't, it will create it.
showDebug will put debug information in the console allowing you to follow along what the plugin does when a player connects/disconnects.
op_only_resync determins if only ops can use '/onl resync' or not.
An example php file can be found here: http://dev.bukkit.org/server-mods/online-players-sql/pages/example-php-file/
It should work just fine, though you will need to change values where necessary for your mysql logon information.
Information about each function used can naturally be found at the php.net website.
-
View User Profile
-
Send Message
Posted Mar 24, 2012Not sure if you could help, but I want to make a datediff in php
so it shows number of minutes connected instead of the time they connected. Any help would be appreciated. http://www.theragequitters.com/-
View User Profile
-
Send Message
Posted Mar 24, 2012set up a forum for the mod, would love for you all to post your website addresses for your games live player listing, would love to see how you all have used the plugin to make super awesome listings.
-
View User Profile
-
Send Message
Posted Mar 24, 2012uploaded a new version, just waiting on approval.
notable changes:
Now requires the 'vault' plugin to also be installed, which shouldn't really be a problem, i mean the plugin does a nice job of hiding the difficult task of having to program for a good 6 different permissions plugins.
Next version i should be able to get a new command system in place for resyncing the player listing from inside the game.
Any takers for what the command should be? i was thinking maybe '/onl resync'
-
View User Profile
-
Send Message
Posted Mar 24, 2012@BioBG
Yeah, i believe PHP itself has trouble sometimes with dates, i know it did for us.
-
View User Profile
-
Send Message
Posted Mar 24, 2012@darkcloud784
We use this website to get the player skin: http://earthiverse.ath.cx/skin2/?user=<username>
Not sure how to get the actual face itself though.
-
View User Profile
-
Send Message
Posted Mar 24, 2012I have a problem ... not correct getting the hours ...
in the server and the PC the time is 21:46
here is 21:46 in the list is 20:46 ....
is there a way to change it ?
OK I FIX this with:
date_default_timezone_set('Etc/GMT-2');
if some one have the same problem add "date_default_timezone_set('Etc/GMT-2');" after while() {
Etc/GMT-2 is the time zone from greenwich meridian.
-
View User Profile
-
Send Message
Posted Mar 24, 2012@ray73864
Also is there a way to add the ability to fetch the face skin of each player or can that only be stored in another way?
-
View User Profile
-
Send Message
Posted Mar 23, 2012Ooo I am excited
edit -
@darkcloud784
Maybe something like this will work for you. I didn't test but this uses more basic php and more likely to work on a default install or older version.
http://pastebin.com/k7aDWB7m
-
View User Profile
-
Send Message
Posted Mar 23, 2012@darkcloud784
Yeah, looks like vault has everything i need. Will make the changes some time this weekend when i get enough free time to deal with it.
-
View User Profile
-
Send Message
Posted Mar 23, 2012@ray73864
I think vault has methods of doing this.
-
View User Profile
-
Send Message
Posted Mar 22, 2012ok, on second look, it appears bukkit doesn't provide any way possible to find out what permissions group a player is in.
The only other way i can think of would be to go through the various different permissions plugins, but that would mean i'm limiting my plugin i think.
On third looking, i might be able to use Vault to get at this information.
-
View User Profile
-
Send Message
Posted Mar 22, 2012@rustymetal
table name option is already in the works for v0.6, once i get my own local copy running i can test all that, currently i wait till our mcaddict server has nobody on then i test my plugin :)
As for permission groups, will have to see about that one, it never came up as an idea for when i first created it because we originally would parse the permissions.yml file for permissions-ex and then use that for showing what permissions group they were in, then when we switched to the SQL stuff for permissions-ex we just changed our code to go that way.
I'll definitely look into adding it though.
-
View User Profile
-
Send Message
Posted Mar 22, 2012@darkcloud784
Yeah, my example used MySQLi extensions because that's what i prefer, there's nothing stopping you from using the older MySQL extension itself though, just need to change around some of the function calls, etc...
-
View User Profile
-
Send Message
Posted Mar 22, 2012/reload in bukkit doesn't actually work properly anyway. It won't reload just the plugin you ask it to, it will reload all of them, and it doesn't unload the old copies first, which means you end up with 2 running instances.
One of our admins on the mcaddictserver did suggest to me a way to resync the currently connected players though, which shouldn't be a problem, basically i just drop all the current ones and reload them all.
-
View User Profile
-
Send Message
Posted Mar 22, 2012Bug I just noticed. /reload cmd will result in the current players not being returned into the database. Only new players connected after will appear in DB. Add a refresh command?
-
View User Profile
-
Send Message
Posted Mar 22, 2012@ray73864
Anyway to query the database without requiring mysqli? Unfortunately our provider for our webserver doesnt support certain php extensions.
Fatal error: Class 'mysqli' not found in /home/warcraft/public_html/PlayerList/PlayerList.php on line 2
-
View User Profile
-
Send Message
Posted Mar 22, 2012I am switching to this plugin for the world stats. Could you add a row for retrieving the players permission group? This is the only thing I am missing to display on my webpage.
Also a config entry for table name is much faster to change then connecting to SQL and import/export, rename/recreate, modify table for online_players2.
I would like that option :)
-
View User Profile
-
Send Message
Posted Mar 22, 2012ok, i have done up an example php file, the location is in the updated description.
-
View User Profile
-
Send Message
Posted Mar 21, 2012@darkcloud784
I can indeed, yes. Gimme a day or 2 to do it and i'll post the sourcecode for it.
-
View User Profile
-
Send Message
Posted Mar 21, 2012Anyway you can create a php script that will allow us to link it to a website?