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

    croemmich

    I'll check that out.
     
  3. Offline

    shadrxninga

    I got this error in my console

    Code:
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://***.***.***.**:3306/database_name
    2011-01-22 18:31:13 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: null
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: Could not init the datasource
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://***.***.**.*:3306/database_name
    2011-01-22 18:31:13 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: null
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: could not execute the sql "UPDATE `users_online` SET `online`=0"
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://174.121.1.62:3306/scswccla_online
    2011-01-22 18:31:13 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: null
    2011-01-22 18:31:13 [SEVERE] OnlineUsers: could not execute the sql "TRUNCATE `users_online`"
    2011-01-22 18:31:13 [INFO] OnlineUsers 1.4 disabled
    I am not sure if this is because the driver is not installed right or the user and pass are wrong

    Here is my settings file:
    Code:
    #Minecraft Properties File
    #Sat Jan 22 18:19:59 PST 2011
    flatfile=online_users.txt
    user=user
    flatfile-data=online_users.data
    remove-offline-users=true
    flatfile-template=online_users.template
    destination=mysql
    pass=*********
    table=users_online
    db=jdbc\:mysql\://***********\:3306/databasename
     
  4. Offline

    DJ411

    any pictures on how it looks?
     
  5. Offline

    fffizzz

    it creates a comma delimited text file, or posts things to the db. What it looks like is dependant upon how you code you php/html to display it. I use it at MyMinecraft.com if you're interested though.
     
  6. Offline

    user_2408

    I have the same error. Using CB b132.

    -B

     
  7. Offline

    croemmich

    For those of you having problems with mysql:

    I will get a fix out for you tomorrow... you can fix it by installing the mysql driver on your java path.
     
  8. Offline

    shadrxninga

    I got mysql working. But with the template file - does that only work with flatfile?
     
  9. Offline

    croemmich

    Yes, you should format the mysql data with PHP or another dynamic language.
     
  10. Offline

    fffizzz

    Ill post a sample script when I get to work for people. May even do one with jquery :D
     
  11. Offline

    Chumber

    move the Onlineuser settings folder into plugins please, addional i get the same [SEVERE] OnlineUsers: No suitable driver found for jdbc error even though it should be in my classpath
     
  12. Offline

    fffizzz

    Ok, heres two sample scripts (PHP) you can use. Very basic and bare minimum..
    Code:
    <?
    $dbhost = 'localhost';
    $dbuser = 'DBUSER';
    $dbpass = 'DBPASS';
    $dbname = 'DATABASENAME';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    mysql_select_db($dbname);
    
    	$q = mysql_query("select count(name) as count from users_online where online='1'") or die(mysql_error());
    	$row = mysql_fetch_array($q);
    	$ucount = $row['count'];
    	unset($q);
    	$q = mysql_query("select name from users_online where online='1'") or die(mysql_error());
    	while($row = mysql_fetch_array($q)) {
    			$olist .= "$row[name] ";
    	}
    echo "There are $ucount users online.<BR>$olist";
    ?>
    With the above code, you will have to make use of $ucount which will display a count for users online. You also have $olist, which is a stored variable with all users online.

    The next example, allows you to colorize some names (mods/admins), but until groups support is properly added to bukkit, he cant add it to this plugin, therefore its a bit more hacky than i'd prefer, but works good none-the-less.

    Code:
    <?
    $dbhost = 'localhost';
    $dbuser = 'DBUSER';
    $dbpass = 'DBPASS';
    $dbname = 'DATABASENAME';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    mysql_select_db($dbname);
    
    	$q = mysql_query("select count(name) as count from users_online where online='1'") or die(mysql_error());
    	$row = mysql_fetch_array($q);
    	$ucount = $row['count'];
    	unset($q);
    	$q = mysql_query("select name from users_online where online='1'") or die(mysql_error());
    	while($row = mysql_fetch_array($q)) {
    		if ($row['name'] == 'USER1' OR $row['name'] == 'USER2' OR $row['name'] == 'USER3' OR $row['name'] == 'USER4' OR $row['name'] == 'USER5' OR $row['name'] == 'USER6') {
    			$olist .= "<font color=blue>$row[name]</font> ";
    		} elseif ($row['name'] == 'ADMINSNAME') {
    			$olist .= "<font color=red>$row[name]</font> ";
    		} else {
    			$olist .= "$row[name] ";
    		}
    	}
    echo "There are $ucount users online.<BR>$olist";
    ?>
    
    The difference above, is that you replace USER1-6 with your mods, or remove how ever many you dont need. This will color thier names blue on your list. Change ADMINSNAME to your own, and your name will become red in the list.

    I provide this ONLY as a basic sample. You will still need a slight understanding of how to add this code and or file to your website to make it display, but this code will do the trick.
     
  13. Offline

    Brettflan

    In your second PHP example, the name coloring code could be significantly cleaned up by using in_array() or similar. Also, be careful about case-sensitivity in string comparisons, since people can log in successfully with different capitalizations ("Joe" or "joe" could be used).

    So, something like this should work better (snippet based on your code):
    PHP:
    // these two lines towards the top for ease of modification
    $Moderators = array("User1""User2""User3""User4");
    $Admins = array("User5""User6");
    // ...snip...

            
    if ( in_arraystrtolower($row['name']), array_map('strtolower'$Moderators) ) ) {
                
    $olist .= "<font color=blue>$row[name]</font> ";
            }
            elseif ( 
    in_arraystrtolower($row['name']), array_map('strtolower'$Admins) ) ) {
                
    $olist .= "<font color=red>$row[name]</font> ";
            } else {
                
    $olist .= "$row[name] ";
            }
     
  14. Offline

    fffizzz

    Thanks.. im certainly no php god, i can hack stuff together, thats about it :D

    --- merged: Jan 30, 2011 5:17 AM ---
    just wondering what the status of this is. I tried copyin that file to the /lib and bin folders for minecraft with no luck..

    thanks again.. :)
     
  15. Offline

    MatCat

    Is this working on b186?
     
  16. Offline

    fffizzz

    ya, but doesnt work on startup if using mysql, you need to /plugin enable OnlineUsers from a loader like essentials.
     
  17. Offline

    croemmich

    I've been meaning to change that... I'll try to get around to that soon.
     
  18. Offline

    fffizzz

    Unfortunately, i had to move on, using Minequery now, this breaks LWC when using MySQL.
     
  19. Offline

    croemmich

    Interesting.. any idea why?
     
  20. Offline

    fffizzz

    No clue, but spent multiple days testing to find the cause.

    start with craftbukkit.jar, eventually moved all plugins over (start/stop after everyone looking for errors) when i didnt have any errors, i was confused and started copying configs for plugins over. Thats when I noticed online users causing the problem. If its on flatfile its fine, my guess is because it fails to load the mysql stuff from the start and tries to do something with sqlite possibly? But you can see my 30 posts in LWC and other threads asking for help.. If i switched back to flat file, error went away and lwc loaded fine after that.
     
  21. Offline

    croemmich

    Not that you care.. should be fixed in 1.5.
     
  22. Offline

    ben62224

    how to install the MySQL JDBC driver on ubuntu server?

    thank you
     
  23. Offline

    croemmich

    the easiest method is to download it from MySQL's website and drop the jar into your server root. You could also do sudo apt-get install libmysql-java, but you may need to change your class path to include the jar than. This page should show you everything... google is your friend. https://help.ubuntu.com/community/JDBCAndMySQL#line-70
     
  24. Offline

    ben62224

    Ok I install and configure, but the DBB and empty minecraft

    online user setting to configure mysql "destination = mysql"

    sorry for my English I use google translation

    Code:
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://localhost:3306/minecraft
    2011-02-06 11:03:49 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: null
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: Could not init the datasource
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://localhost:3306/minecraft
    2011-02-06 11:03:49 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: null
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: could not execute the sql "UPDATE `users_online` SET `online`=0"
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: No suitable driver found for jdbc:mysql://localhost:3306/minecraft
    2011-02-06 11:03:49 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2011-02-06 11:03:49 [SEVERE] OnlineUsers: null
     
  25. Offline

    croemmich

  26. Offline

    Phanku

    I have a silly question.

    First a little bit of back ground to explain where I am coming from.

    MySql database are generally dynamic data with static behavior. What I mean by this is that the data in a database is easy to change and query but without outside forces (a query, a cronjob that activates a query, a php script file that activates the query) it is my understanding that a MySql database will not automatically update its self.

    My question is: if my Minecraft server is down (say it crashed) and isn't responding would the website or what ever script (lets say php for ease) be able to detect that and or would the online status of the players in the database switch to offline.

    Just curious.
     
  27. Offline

    user_2408

    Fantastic mod, possible to see an update for 1.3? I know it works, it's just giving the "warnings" most plugins are doing. :)
     
  28. Offline

    DurtyFree

    Please fix this plugin for the newest version of bukkit, because i become this warnings:

     
  29. Offline

    Brettflan

    Since croemmich hasn't been online in a couple of weeks and since I use this plugin, I decided to see about updating it (along with ServerEvents) myself for the latest CraftBukkit builds.
    Well, I managed it, and since his stated license seems to allow for it, I figured I might as well share:
    http://wimbli.com/minecraft/OnlineUsers_1.5.2_unofficial.zip

    This is definitely unofficial, and just quickly updated by me, but from my brief testing it works fine on CraftBukkit build 432.
     
  30. Offline

    user_2408

    @Brettflan : Thanks! Confirming this is running well on CB461! All those prior warnings are gone =)
     
  31. Offline

    Brettflan

Share This Page