[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

  2. Option to add last login (time and date) to the DB?
     
  3. Offline

    Brettflan

    That's what the "time" field should contain.
     
  4. Offline

    wouter0100

    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)
     
  5. Offline

    Brettflan

    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.
     
  6. Offline

    wouter0100

    Thanks (A)
     
  7. Offline

    Brettflan

    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`
     
  8. Offline

    MonsieurApple

    Changed thread title to remove 627-798. Dashes are not allowed.
     
  9. Offline

    michaelsk8

    Is there a plugin That Shows In the chat box if the player is new new
     
  10. Offline

    Brettflan

    "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.
     
  11. Offline

    Banana937

    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

    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.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 6, 2016
  12. Offline

    Brettflan

    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?
     
  13. Offline

    Banana937

    No I don't... where would I download that?

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

    michaelsk8

    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.
     
  15. Offline

    Banana937

    Please don't post your tech support questions on this guys Forum thread. But I can help... I'm BFitz937 on Skype.
     
  16. Offline

    Chains

    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?
     
  17. Offline

    Banana937

    I still need help...
     
  18. Offline

    Brettflan

    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.
     
  19. Offline

    Chains

    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
     
  20. Offline

    Brettflan

    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.
     
  21. Offline

    Chains

    I already edit the source but i'm too stupid to compile it -.-" okay but thanks
     
  22. Offline

    Toxik

    The plugin works fine for me 'as-is' on Minecraft 1.7.2 / CB 953.
     
  23. Offline

    Max Black

    Same with Toxik, also wanted to say this is a great plugin, really helps with the site currently online section ;)
     
  24. Offline

    RastaLulz

    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:
    <?php
    function onlineUsers() {

      
    $path 'C:\path\to\plugins\OnlineUsers\online_users.txt';
      
    $handle fopen($path"r"); $contents fread($handlefilesize($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;

    }  
     
  25. Offline

    Matt

    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.
     
  26. Offline

    Brettflan

    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.
     
  27. Offline

    Seweryn

    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} ???
     
  28. Offline

    Brettflan

    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.
     
  29. Offline

    chrisgun

    I would like to give this a try. Could you update the download link? it is down atm
     
  30. Offline

    Brettflan

    It's back up now.
     
  31. Offline

    Zerdux

    I have installed the plugin for my server and it works but there is no mysql database addet.
    Does it work with the www - mysql-database or any other database?
    if it works with another database how i can change it for my www database?
    So i would like give out the datas via php and mysql...
    Or have i add the database in phpmyadmin?
    witch structure the database is need if i have to add it?
    sorry for my bad english ;)
     

Share This Page