# [INFO] OnlineUsers 1.7.0 - logged users in a file/mysql [BukkitDev]

Discussion in 'Plugin Releases' started by Brettflan, Jan 17, 2011.

1. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:

This post has been edited 10 times. It was last edited by Brettflan Apr 27, 2013.
#1
2.
3. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Can you compare the list of players shown in one to the other, to see which player is missing? Can you then check your logs for anything odd relating to that player logging in or getting disconnected? This plugin monitors player logins and disconnections to maintain the player list, but it's possible something is somehow slipping past that.
I haven't seen any problems like you're describing, but I do use the flatfile method myself. The results should be the same either way, though.
#91
4. Offline

### battlefielder128

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
5. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
That's what the "time" field should contain.
#93
6. Offline

### wouter0100

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Can you make thet i can see in the database how many hours/minuts the player is online? (Sorry for my very bad english )
#94
7. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
A running total of how much time overall they've been online? Should be pretty simple. I'll see about adding a new field and tracking that when I have some spare time.
#95
8. Offline

### wouter0100

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Thanks (A)
#96
9. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Done, and released in 1.6 (see the first post).

Note that the new time_total column is only updated when players disconnect. So, if a player is currently connected, that column won't account for the additional time they've been online in their current session. If you want to get a fully up-to-date value for how long they've been online, you can account for it in your query.
For example, this query would give you the up-to-date value as current_time_total:
Code:
SELECT *, IF(online=1, ADDTIME(time_total, TIMEDIFF(NOW(), time)), time_total) AS current_time_total FROM users_online
#97
10. Offline

### MonsieurApple

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Changed thread title to remove 627-798. Dashes are not allowed.
#98
11. Offline

### michaelsk8

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Is there a plugin That Shows In the chat box if the player is new new
#99
12. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
"New" by what standards? I believe Essentials (possibly EssentialsChat or another subplugin) has an option to give a "welcome [player] to the server!" message the first time a player ever connects to the server.
13. Offline

### Banana937

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
I believe that you have this confused with something else. This plugin is for showing the users on a server in an SQL database. Not on the server. DURP
14. Offline

### Banana937

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Can someone help me? I currently use GoDaddy to host my website, and I'm trying to use PHP to list the OnlineUsers on a page for my site. This is my Configuration:
Code:
#Minecraft Properties File
#Sat Jun 18 21:56:52 EDT 2011
flatfile=online_users.txt
user=sinquillaou
flatfile-data=online_users.data
remove-offline-users=true
flatfile-template=online_users.template
destination=mysql
pass=***************
table=users_online
db=jdbc\:mysql\://sinquillaou.db.7939212.hostedresource.com\:3306/sinquillaou

And this is the error I get in my console when I try to run the server:

Code:
2011-06-18 22:24:13 [SEVERE] OnlineUsers: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2011-06-18 22:24:13 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
2011-06-18 22:24:13 [SEVERE] OnlineUsers: null
2011-06-18 22:24:13 [SEVERE] OnlineUsers: Could not init the datasource
2011-06-18 22:24:34 [SEVERE] OnlineUsers: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2011-06-18 22:24:34 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
2011-06-18 22:24:34 [SEVERE] OnlineUsers: null
2011-06-18 22:24:34 [SEVERE] OnlineUsers: could not execute the sql "UPDATE users_online SET time_total = IF(online=1, ADDTIME(time_total, TIMEDIFF(NOW(), time)), time_total), online=0"
2011-06-18 22:24:55 [SEVERE] OnlineUsers: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2011-06-18 22:24:55 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
2011-06-18 22:24:55 [SEVERE] OnlineUsers: null
2011-06-18 22:24:55 [SEVERE] OnlineUsers: could not execute the sql "TRUNCATE users_online"
2011-06-18 22:24:55 [INFO] OnlineUsers 1.6 disabled

LATER EDIT: The host is a GoDaddy SQL host server.
15. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Assuming your database name is correct ("sinquillaou"), do you have the mysql-connector-java-bin.jar file in your root minecraft server folder alongside the craftbukkit JAR?
16. Offline

### Banana937

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:

EDIT: Got it... same problem.
17. Offline

### michaelsk8

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
I know That this isnt For In game Server But I just wna Know does anybody Know of A Plugin that showes If a player is new.Also I need help with my Permissions.Its a long file and if u can help conact 'mbk.elite' on skype.
18. Offline

### Banana937

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Please don't post your tech support questions on this guys Forum thread. But I can help... I'm BFitz937 on Skype.
19. Offline

### Chains

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Hey i got one problem:
I got AuthDB so every User has to register...But your plugin wants to INSERT INTO the table...the problem is that the field 'password' cannot be NULL so your plugin doesnt work then...could you make an option to change it to just update but only if there is an field with the name of the user there?
20. Offline

### Banana937

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
I still need help...
21. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Did you rename it to match the filename I gave? If it's not named exactly right and located in the correct folder (alongside the main CraftBukkit JAR), the plugin won't find it. If you have it located and named correctly and are getting the exact same error message, I have no idea what might cause it.

You're having two plugins share the same table for data? I can definitely see that as causing problems. Why not simply keep them in their own separate tables and use a LEFT JOIN or similar?
OnlineUsers already does an ON DUPLICATE KEY UPDATE for the INSERT statement, by the way. You might check whether you've changed the "remove-offline-users=true" option in the online_users.settings file.
22. Offline

### Chains

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
AuthDB just accesses the table if somebody login and then i just reads. The main problem is, that OnlineUsers gets an Query error because it tries to INSERT and then ON DUPLICATE KEY UPDATE..but it fails because the field password is empty so it cant check if the users exists or not
23. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Either way, the best method would be to have them use separate tables and use a JOIN of some sort when getting the data. No possibility for table structure conflicts that way.
24. Offline

### Chains

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
I already edit the source but i'm too stupid to compile it -.-" okay but thanks
25. Offline

### Toxik

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
The plugin works fine for me 'as-is' on Minecraft 1.7.2 / CB 953.
26. Offline

### Max Black

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Same with Toxik, also wanted to say this is a great plugin, really helps with the site currently online section
27. Offline

### RastaLulz

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Just what I was looking for.

Wrote a little function in PHP for this plugin incase anyone wants to use it on their website.

PHP:
 <?phpfunction onlineUsers() {  $path = 'C:\path\to\plugins\OnlineUsers\online_users.txt';$handle = fopen($path, "r");$contents = fread($handle, filesize($path)); fclose($handle);$contents = explode("\n", $contents);$start = 0;  $count = count($contents) - 2;  $ONLINE['COUNT'] =$count;  foreach($contents as$content) {    if($start != 0) {$user = explode(' ', $content);$ONLINE['USERS'] .= $user[0]; if($start < $count) {$ONLINE['USERS'] .= ', ';      }    }    $start++; } return$ONLINE;}   
28. Offline

### Matt

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Possible addition, that ability to whitelist certain names and hide it from the online list and updating in the mysql. I realize this can be done with PHP, however it would be nice if it was concatenated easier.
29. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
It could be done, but I doubt I'll have time for it, honestly. The source is available on GitHub and pull requests are accepted, though, so other are welcome to implement it.
30. Offline

### Seweryn

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
Hi Brettflan,
Why you use "hh" in {shorttime} insted of "HH". The 24h clock is more accurate
Could you change it?

P.S. Or add {health}, {iteminhand} ???
31. Offline

### Brettflan

dev.bukkit.org profile:
My Plugins (CFCOUNT)
Minecraft account:
1. Beats me, I haven't touched that part of the code and don't even personally use anything beyond a basic list of online users. I see what you're saying, though, especially since it doesn't even display AM/PM, and I agree it needs to be fixed.

2. Those would require much more constant monitoring, where the plugin currently only does anything at all when users join or leave the server.
32. Offline

### chrisgun

dev.bukkit.org profile: