Glizer/Stats

Aus Minecraft Gameserver Wiki
Wechseln zu: Navigation, Suche
glizer

Details: Install | Commands | Permissions | Register | Callback | Stats | Prowl | Changelog | Ban System | Ban and Dispute rules | Terms of Usage | Compromised Account | Privacy | BungeeCord
Comparison: Comparison of glizer with MCBans
Download: Download


The Stats System is deprecated and should not be used anymore

Please do not use it if you don't really need it.

Howto implement it

To make the stats working for your gameserver you need a special script on your gameserver which deliveres the informations.

Example for LogBlock, iConomy & MySQL - Install the LogBlock and iConomy Extension in Minecraft with mySQL-Support and upload this PHP Script on your Webserver. Then enter the URL to this script in your Server-Details on glizer.de

   <?php
   $database = '##DATABASE##';
   $link = mysql_connect('##HOST##', '##USERNAME##', '##PASSWORD##',true);
   if (!$link) {
   die('Could not connect to database');
   }
   $action = mysql_query('SET CHARACTER SET utf8',$link);
   mysql_select_db($database,$link);
   if(!$_REQUEST['data']) die();
   $usr = mysql_escape_string($_REQUEST['data']);
   $qry = 'SELECT  TYPE , SUM(created)  AS created, SUM(destroyed)  AS destroyed
   FROM (
   (
       SELECT  TYPE , count(type)  AS created, 0 AS destroyed
       FROM  `lb-main`
       INNER  JOIN  `lb-players`
       USING (playerid)
       WHERE playername =  \.$usr.'\'
       AND  TYPE  >0
       GROUP  BY  TYPE
   )  UNION (
       SELECT replaced AS
       TYPE , 0 AS created, count(replaced)  AS destroyed
       FROM  `lb-main`
       INNER  JOIN  `lb-players`
       USING (playerid)
       WHERE playername =  \.$usr.'\'
       AND replaced >0
       GROUP  BY replaced)
   ) AS t
   GROUP  BY  TYPE  ORDER  BY SUM(created)  + SUM(destroyed)  DESC;';
   $res = mysql_query($qry);
   $data = array();
   while($r = mysql_fetch_assoc($res))
   {
   $data['p'] += $r['created'];
   $data['d'] += $r['destroyed'];
   $data['b'][$r['TYPE']] = array($r['created'],$r['destroyed']);
   }
   $qry = 'SELECT count(*) as chests FROM  `lb-main` INNER  JOIN  `lb-players` USING (playerid) WHERE playername =  \.$usr.'\' AND type = replaced and replaced = 54';
   $r = mysql_fetch_assoc(mysql_query($qry));
   $data['c'] = $r['chests']; 
   $qry = 'SELECT balance from iConomy WHERE username =  \.$usr.'\;
   $r = mysql_fetch_assoc(mysql_query($qry));
   $data['m'] = $r['balance'];
   $qry = 'SELECT count(*) as t from protections WHERE owner =  \.$usr.'\;
   $r = mysql_fetch_assoc(mysql_query($qry));
   $data['s'] = $r['t'];
   echo json_encode($data);