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

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

  1. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  2. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  3. Offline

    battlefielder128

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Option to add last login (time and date) to the DB?
     
  4. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    That's what the "time" field should contain.
     
  5. Offline

    wouter0100

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

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  7. Offline

    wouter0100

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thanks (A)
     
  8. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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 (Text):
    1. SELECT *, IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`) AS `current_time_total` FROM `users_online`
     
  9. Offline

    MonsieurApple

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

    michaelsk8

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

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    "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.
     
  12. Offline

    Banana937

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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
     
  13. Offline

    Banana937

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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 (Text):
    1.  
    2. #Minecraft Properties File
    3. #Sat Jun 18 21:56:52 EDT 2011
    4. flatfile=online_users.txt
    5. user=sinquillaou
    6. flatfile-data=online_users.data
    7. remove-offline-users=true
    8. flatfile-template=online_users.template
    9. destination=mysql
    10. pass=***************
    11. table=users_online
    12. db=jdbc\:mysql\://sinquillaou.db.7939212.hostedresource.com\:3306/sinquillaou
    13.  
    And this is the error I get in my console when I try to run the server:

    Code (Text):
    1.  
    2. 2011-06-18 22:24:13 [SEVERE] OnlineUsers: Communications link failure
    3.  
    4. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    5. 2011-06-18 22:24:13 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    6. 2011-06-18 22:24:13 [SEVERE] OnlineUsers: null
    7. 2011-06-18 22:24:13 [SEVERE] OnlineUsers: Could not init the datasource
    8. 2011-06-18 22:24:34 [SEVERE] OnlineUsers: Communications link failure
    9.  
    10. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    11. 2011-06-18 22:24:34 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    12. 2011-06-18 22:24:34 [SEVERE] OnlineUsers: null
    13. 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"
    14. 2011-06-18 22:24:55 [SEVERE] OnlineUsers: Communications link failure
    15.  
    16. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    17. 2011-06-18 22:24:55 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    18. 2011-06-18 22:24:55 [SEVERE] OnlineUsers: null
    19. 2011-06-18 22:24:55 [SEVERE] OnlineUsers: could not execute the sql "TRUNCATE `users_online`"
    20. 2011-06-18 22:24:55 [INFO] OnlineUsers 1.6 disabled
    21.  
    LATER EDIT: The host is a GoDaddy SQL host server.
     
  14. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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?
     
  15. Offline

    Banana937

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    No I don't... where would I download that?

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

    michaelsk8

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  17. Offline

    Banana937

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

    Chains

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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?
     
  19. Offline

    Banana937

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

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  21. Offline

    Chains

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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
     
  22. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  23. Offline

    Chains

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

    Toxik

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

    Max Black

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

    RastaLulz

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

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

    PHP:
    1. <?php
    2. function onlineUsers() {
    3.  
    4.   $path = 'C:\path\to\plugins\OnlineUsers\online_users.txt';
    5.   $handle = fopen($path, "r"); $contents = fread($handle, filesize($path)); fclose($handle);
    6.  
    7.   $contents = explode("\n", $contents);
    8.  
    9.   $start = 0;
    10.  
    11.   $count = count($contents) - 2;
    12.  
    13.   $ONLINE['COUNT'] = $count;
    14.  
    15.   foreach($contents as $content) {
    16.     if($start != 0) {
    17.       $user = explode(' ', $content);
    18.       $ONLINE['USERS'] .= $user[0];
    19.       if($start < $count) {
    20.         $ONLINE['USERS'] .= ', ';
    21.       }
    22.     }
    23.     $start++;
    24.   }
    25.  
    26.   return $ONLINE;
    27.  
    28. }  
     
  27. Offline

    Matt

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  28. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  29. Offline

    Seweryn

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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} ???
     
  30. Offline

    Brettflan

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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.
     
  31. Offline

    chrisgun

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I would like to give this a try. Could you update the download link? it is down atm
     

Share This Page