[INACTIVE][WEB] OnlineLog v1.0.1 - Online player statistics [602]

Discussion in 'Inactive/Unsupported Plugins' started by Olof Larsson, Mar 25, 2011.

  1. Offline

    Olof Larsson

    OnlineLog - Online player statistics :)

    Current version: 1.0.1
    Download: https://github.com/oloflarsson/minecraft-online-log/tree/master/releases
    Source: https://github.com/oloflarsson/minecraft-online-log

    This plugin will log which and how many players are online to a mysql database.
    You can use this data to create fancy charts on your web page :)
    One row will be written to the database table each time the online players change.
    For example when someone logs in or logs out.

    Take a look at this live example
    How to install
    • Download the latest release
    • Put OnlineLog.jar in the plugins folder.
    • Download the mysql driver and put it in your server folder.
    • Create this table:
    CREATE TABLE `onlinelog` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `playercount` smallint(5) unsigned NOT NULL,
    `playernames` varchar(4096) CHARACTER SET ascii NOT NULL,
    PRIMARY KEY (`id`),
    KEY `timestamp` (`timestamp`)
    );
    • Start and stop the server. The plugin will create a default config file.
    • Modify the configuration file.
    Current ToDo list:
    *empty*

    Changelog:
    Version 1.0.1
    • CB602 compatibility
    Version 1.0.0
    • The first version
    Fork me on github!
    I would be glad to code on this plugin together with you :). Please fork me on github and do a pull request. Read more here:
    http://help.github.com/fork-a-repo/
    http://help.github.com/pull-requests/
     
  2. Offline

    crysis992

    uhm nice but i get a error message when i try to create the table:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ENGINE=MyISAM DEFAULT CHARSET=latin1' at line 6
     
  3. Offline

    NotoriousPyro

    Use this:
    Code:
    CREATE TABLE IF NOT EXISTS `onlinelog` (
      `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `playercount` smallint(5) unsigned NOT NULL,
      `playernames` varchar(4096) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
      PRIMARY KEY (`timestamp`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
    PS: It would be nice if there was some sort php file included with this to generate an image from the data.
     
  4. Offline

    tha d0ctor

    this ^^^ I would really like a php file too to get a nice current players widget for my site!
     
  5. Offline

    NotoriousPyro

    tha d0ctor likes this.
  6. Offline

    tha d0ctor

    cool man thanks for the link!
     
  7. Offline

    Plague

  8. Offline

    Olof Larsson

    Fixed CB version in the title and updated to latest RB :)

    Take a look at this live example

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

    nakashimakun

    Hello Old Larsson,

    Is there a way you could bring that script from wordpress and just make it usable in a normal php page or something? like iframed in or something.

    Brian.
     
  10. Offline

    ChrisX930

  11. Offline

    derchris

    Should I post Bugs here?

    Code:
    2011-04-03 13:06:38 [INFO] mondengel1992 lost connection: disconnect.quitting
    2011-04-03 13:06:38 [INFO] GIGX lost connection: disconnect.quitting
    2011-04-03 13:06:39 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2011-04-03 13:06:38' for key 'PRIMARY'
    2011-04-03 13:06:39 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2011-04-03 13:06:39 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    2011-04-03 13:06:39 [SEVERE]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    2011-04-03 13:06:39 [SEVERE]    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.Util.getInstance(Util.java:382)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1662)
    2011-04-03 13:06:39 [SEVERE]    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1581)
    2011-04-03 13:06:39 [SEVERE]    at org.mcteam.onlinelog.OnlineLog.doOnlineLog(OnlineLog.java:130)
    2011-04-03 13:06:39 [SEVERE]    at org.mcteam.onlinelog.OnlineLog.logCurrentState(OnlineLog.java:148)
    2011-04-03 13:06:39 [SEVERE]    at org.mcteam.onlinelog.OnlineLogPlayerListener.onPlayerQuit(OnlineLogPlayerListener.java:16)
    2011-04-03 13:06:39 [SEVERE]    at org.bukkit.plugin.java.JavaPluginLoader$2.execute(JavaPluginLoader.java:175)
    2011-04-03 13:06:39 [SEVERE]    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    2011-04-03 13:06:39 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.ServerConfigurationManager.c(ServerConfigurationManager.java:122)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:503)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.NetworkManager.a(NetworkManager.java:202)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    2011-04-03 13:06:39 [SEVERE]    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    
    As you can see, 2 players left at the same time. But the way you update the database make it error out, as there is already an entry for that time.
     
  12. Offline

    GamerX

    I'm posting a un-official release here.

    I did NOT code the update, @derchris did it.

    Un-Official version: 1.1
    Download: http://dl.dropbox.com/u/21756616/OnlineLog.jar


    ChangeLog:
    * Added "autoReconnect=true" for the mysql connection

    @Olof Larsson
    PM if you want the updated source code
     
  13. Offline

    derchris

    Thanks GamerX for the compile.

    This is in reference to the following issue I opened today:

    https://github.com/oloflarsson/minecraft-online-log/issues/1

    Just testing at the moment to check if all works fine now.

    Edit:

    The error is gone, however the "fix" has a nasty side effect.
    Server now shows at least 1 player online, even though no player is currently connected.
    Looks like the last connection which is still active stays active.

    Might need a little bit more investigation, and some code changes for clearing open user connections to the database.
     
  14. Offline

    Monk3y

    Primary key
    and key are those made int he table because i cant find it :(

    Code:
    Error
    SQL query:
    
    CREATE TABLE  `modtv_war-room`.`onlinelog` (
    
    `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `timestamp` TIMESTAMP UNSIGNED NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `playercount` SMALLINT( 5 ) NOT NULL ,
    `playernames` VARCHAR( 4096 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL ,
    PRIMARY KEY (  `id` )
    ) ENGINE = MYISAM ;
    
    MySQL said:
    
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNSIGNED NOT NULL DEFAULT CURRENT_TIMESTAMP, `playercount` SMALLINT(5) NOT NULL,' at line 1 
    ok so i figure out that the keys dont go into the table but i still get this error :(

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

    Plague

    considered inactvive
     
  16. Offline

    Kazaam

    Use this SQL Code :

    Code:
    CREATE TABLE IF NOT EXISTS `onlinelog` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `playercount` smallint(5) unsigned NOT NULL,
      `playernames` varchar(4096) CHARACTER SET ascii NOT NULL,
      PRIMARY KEY (`id`),
      KEY `timestamp` (`timestamp`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1
     

Share This Page