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.
@ray73864
Thank you very much for the new file. Tested a hole day without errors.
@OPJewelz
I don't understand the question. My plugin doesn't do anything with regards to inventories.
Is it possible if we have existing inventories to use that plugin?
@ray73864
Works perfectly on 1.4.6 server as of the latest 1.6.2 update.
@fungreenfox
Please test out the new version (1.6.2) @ http://dev.bukkit.org/media/files/667/494/OnlinePlayersSQL.jar
Pretty sure i've got this one fixed now.
Using 1.4.6 beta bukkit, and 1.6.1 onlineplayerssql:
16:26:57 [SEVERE] java.sql.SQLException: Column Index out of range, 0 < 1. 16:26:57 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) 16:26:57 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) 16:26:57 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) 16:26:57 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) 16:26:57 [SEVERE] at com.mysql.jdbc.ResultSetImpl.checkColumnBounds(ResultSetImpl.java:812) 16:26:57 [SEVERE] at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2677) 16:26:57 [SEVERE] at net.rayherring.MyOnlPlayerListener.onPlayerDeath(MyOnlPlayerListener.java:39) 16:26:57 [SEVERE] at sun.reflect.GeneratedMethodAccessor636.invoke(Unknown Source) 16:26:57 [SEVERE] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 16:26:57 [SEVERE] at java.lang.reflect.Method.invoke(Unknown Source) 16:26:57 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425) 16:26:57 [SEVERE] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) 16:26:57 [SEVERE] at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:35) 16:26:57 [SEVERE] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) 16:26:57 [SEVERE] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) 16:26:57 [SEVERE] at org.bukkit.craftbukkit.v1_4_6.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:332) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityPlayer.die(EntityPlayer.java:255) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityLiving.damageEntity(EntityLiving.java:758) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityHuman.damageEntity(EntityHuman.java:615) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityPlayer.damageEntity(EntityPlayer.java:308) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityMonster.m(EntityMonster.java:88) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityMonster.a(EntityMonster.java:114) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityCreature.bn(EntityCreature.java:56) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityLiving.c(EntityLiving.java:1277) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityMonster.c(EntityMonster.java:20) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityZombie.c(EntityZombie.java:108) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityLiving.j_(EntityLiving.java:534) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityMonster.j_(EntityMonster.java:24) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityZombie.j_(EntityZombie.java:121) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.EntityPigZombie.j_(EntityPigZombie.java:32) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.World.entityJoinedWorld(World.java:1334) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.WorldServer.entityJoinedWorld(WorldServer.java:548) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.World.playerJoinedWorld(World.java:1315) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.World.tickEntities(World.java:1193) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.WorldServer.tickEntities(WorldServer.java:445) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:580) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:224) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:494) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:427) 16:26:57 [SEVERE] at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
I get this to often.
@nikooo14
Not much i can do, since the webside is all done by the person creating the website. But, as i said, it will be an issue with your SQL query returning no results at all.
@ray73864
I can not fix it otherwise, the host does not give me access to phpmyadmin
@nikooo14
That means that your SQL query returned nothing and so the fetch_object() function spazzed out as it didn't know what to do about it.
Check your query to make sure it actually will return some results, test the query in phpmyadmin if necessary as that will tell you what the error actually is.
in my web page get this
Vendetta's Minecraft Server: Online Players
Fatal error: Call to a member function fetch_object() on a non-object in /home/u439471766/public_html/onlineplayers.php on line 27
Player Group World Logged On**
@ray73864
here. http://dev.bukkit.org/server-mods/online-players-sql/tickets/3-2013-01-16-03-21-18-severe-java-sql-sqlexception-column/
@minecraft_pro_demon
I'm not seeing any references to my code at all, is there more to the log or is that it?
2013-01-18 05:12:14 [SEVERE] java.sql.SQLException: Column Index out of range, 0 < 1. 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.ResultSetImpl.checkColumnBounds(ResultSetImpl.java:812) 2013-01-18 05:12:14 [SEVERE] at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2677)
Works, but i get this error after time.
@bjornleijdstrom
That one has me stumped, can you provide a log of it doing that?
Hi again, Thanks for an update!
The error seems to have gone away, but it still keeps spamming the "user not logged in"-message; can you add an option for deleting the "NULL"-posts? Like "deletenullusers: true"
1.6 uploaded, waiting on approval.
1.6 is compiled against the most recent beta build of CB: 1.4.6-R0.3
Get it here: http://dev.bukkit.org/media/files/665/87/OnlinePlayersSQL.jar
@Weasel_Squeezer
You can get the listing of all players that have ever been online from the main table itself.
The main table stores every player that has ever logged onto your game since you started using the plugin, and when a player connects/disconnects it just updates the 'online' field in the table with a 1 (connected) or 0 (offline).
@bjornleijdstrom
Hrmm, it's possible the information i need disappears before the onDisable is called for a plugin.
Shouldn't be too difficult to come out with a fix for that one, first i've ever seen it though, what version of Craftbukkit are you using?
@wkera
Why not? If you don't want to use that feature, then simply don't use it, logging players online time is not harmful in any way at all.
Been a bit busy lately, also waiting for bukkit to fix a lot of their stuff. Hopefully next week i shall have a new version out.