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.
Hi !
Seems be have a leaks of memory in 1.8.7. Could you up to date with MC 1.8.7 to fix any problem please ? :)
Mate are you still active here? I hope you are. Great job
Hey, nice Work! @ray73864 Are you still active here? I have a two suggestions:
1. Please support this plugin too http://dev.bukkit.org/bukkit-plugins/vanish/
2. For the upcoming name changing feature, may its better when the table has a primary key. I think its not hard to add or?
Thanks!
@Locercus
Location as in? what block they are currently standing on?
That'll mean updating the DB every time they move just one block, could get extremely laggy with all those SQL updates happening especially if the server is a busy one.
Or do you only care about the location they were last at when they logged off?
Could you possibly add a column for player location? I need this for my server! :)
Still compiled against 1.7.2, I'm going to ignore 1.7.9 and wait for 1.7.10 version of bukkit.
New version posted, just waiting on approval.
Will look at this tomorrow. It's interesting because it should be using the new sql stuff which auto quotes.
Using McMyAdmin apparently the names of permission groups aren't exported. Because of this, I'm getting errors when OnlinePlayerSQL wants to perform the following query:
UPDATE online_players SET permission_group = ** NOT SPECIFIED ** WHERE player = 'playername'
I suggest you either quote the value for permission_group or skip this query when no permission group was found.
@KrustyLv
I don't currently store the nickname, i store the actual playername.
When Mojang brings out the ability to change your minecraft name, i'll probably add a second table or something so that you can keep track of all the names that UUID has had, not sure yet.
Either way, i will definitely have it set up so that the current name they have is stored along with their UUID.
@ray73864
But in database still will be stored player nickname, right?
When 1.7.6 comes out, all the stats will be broken due to Mojang switching from storing things by player name to storing them by UUID, i'm hoping the Bukkit team implements a way to convert from the old to the new so that all i have to do is a simple SQL code change to fix it.
@Jacold
Please check using the latest version. Hopefully i have fixed this issue once and for all.
Long time coming, but here it is, a fix for all the SQL issues people have been reporting.
http://dev.bukkit.org/media/files/783/14/OnlinePlayersSQL.v1.9.4.jar
I've switched from the old style SQL syntax to using PreparedStatements, that way the SQL driver itself handles the escaping of strings, etc...
I have tested this on my local dev set up and logging into the server successfully creates an entry in the table if one didn't exist before, world changing is recorded, player deaths is recorded, not sure about player kills as it is hard to kill another player when it is a server of 1.
If you want to watch as the server runs the PreparedStatements, simply turn logging on in the config.yml, restart your server and you will see things like:
com.mysql.jdbc.JDBC4PreparedStatement@62e14baa: UPDATE online_players SET previous_world='world_nether', current_world='world', permission_group='' WHERE player='ray73864'
When I install it almost all what I need works fine except setting online status to 1 again. It throws errors:
It's update when player joins/disconnects? Can you add server status (plugin sql'd online when server starts and offline when crashes or typing /stop)?
I think I'll install it tomorrow.
Can you once fix it?
@GlabbichRulz
Yeah, i made some minor changes here and there for the 1.7 version, it's possible it creeped in somehow.
Anyway, once work calms down a bit, i'll release the current version i have, which i am hoping fixes the issue once and for all.
@ray73864
the server is running on a nitrado.net linux server.
I am not sure if its a conflict with other/newer Plugins on my server, but i am sure your great plugin worked in earlyer versions.
@GlabbichRulz
Sorry about not releasing it, have been busy with work.
Is this on a windows computer or a linux box?