• Proceed with caution! Unofficial add-on plugins and abilities are not supported by the ProjectKorra staff. We will not provide support for broken add-ons. Download at your own risk.
  • Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server

ProjectKorra Interface

Dooder_07

Verified Member
I got bored last night and decided to adapt the same code I use to display other mysql tables for ProjectKorra.

This isn't complete! I still need to change the element output to a more visually friendly format and I also want to create [optional] columns for 'permaremoved' and 'ability slots'.

The code itself is pretty minimalist; utilizing CDNs for bootstrap, themes (css/bootswatch) and javascripts! It's all configurable right there at the top of the source.

I'm totally open to criticism/suggestions for improving this interface.
It's really nothing complicated, so I won't get mad at you if you do criticize me. d:



PHP:
removed outdated code, use source below
 
Last edited:

Dooder_07

Verified Member
Update: I made the element output look nice and stuff and fixed a couple of issues I saw.
I could have went ahead and added 'permaremoved' and 'abilities', but personally I prefer it without them. I can make a version with them if anyone wants that?

PHP:
<!-- Edit the information below to reflect your database/information -->

<?php
$sitename="SomeMincraftServer"; //the title to use for your site
$dbhost="localhost:3306"; //the host of your mysql database
$dbname="minecraft"; //your mysql database name
$dbuser="root"; //your preferred mysql username
$dbpass="password"; //your username's password
$theme="cyborg"; //http://bootswatch.com/ - choose a theme from here! (watch your spelling though)
?>

<!--
There's no need to alter anything beyond this point, unless you know what you're doing.
Otherwise, post on the forums what you would like added. This should be a collaborative effort!
-->

<html>

  <head>

    <title><?php echo "$sitename";?></title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>body { font-size: 140%; }</style>
    <link href="https://cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet" media="screen">
    <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.2.0/<?php echo strtolower( $theme ); ?>/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
    <script src="//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.js"></script>

    <script>
    $(document).ready(function(){
        $('#players').dataTable();
    });
    </script>

  </head>

<body>


<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
     <a class="navbar-brand" href="#"><?php echo ( $sitename ); ?></a>
  </div>
</nav>

  <div class="container">

    <table id="players" class="table table-striped" cellspacing="0">
      <thead>
        <tr>
     <th>Player</th>
          <th>Element</th>
        </tr>
      </thead>

      <tbody>
    <?php
            mysql_connect($dbhost, $dbuser, $dbpass) or die('<div class="alert alert-danger" role="alert">Oh snap! '.mysql_error().'!</div>');
            mysql_select_db($dbname) or die('<div class="alert alert-danger" role="alert">Oh snap! '.mysql_error().'!</div>');
       $query = 'SELECT player, element FROM pk_players';
       $result  = mysql_query($query);

            while ($row = mysql_fetch_array($result)) {

       $player = $row['player'];
       $element = $row['element'];

       if(!empty($element)){
       if ($element == "a"){
       $element = '<span class="label label-default">Air</span>';
       } elseif ($element == "w"){
       $element = '<span class="label label-primary">Water</span>';
       } elseif ($element == "f"){
       $element = '<span class="label label-danger">Fire</span>';
       } elseif ($element == "e"){
       $element = '<span class="label label-success">Earth</span>';
       } elseif ($element == "c"){
       $element = '<span class="label label-warning">Chiblocking</span>';
       } else {
       $element = '<span class="label label-info">Avatar</span>';
       }
    }
                echo "<tr>";
        echo '<td><img src="http://mcapi.ca/v1/avatar/?player='.$player.'&size=25" title="'.$player.'"></img>&nbsp;&nbsp;<span class="label label-default">' . $player .'</span>';
        echo '<td>'.$element.'</td>';
            }

       ?>
      </tbody>

    </table>

  </div>

<br>

    <div id="footer">
      <div class="container-fluid">
        <span class="badge"><i class="fa fa-copyright"></i> <?php echo "$sitename";?> <?php echo date("Y"); ?></span>
      </div>
    </div>

</body>
</html>
ISSUES I'M AWARE OF SO FAR:
- If a player has more than one type of bending, I just labeled them as Avatar. I'll probably make a function later to list out all their types.
- Switching themes from bootswatch may change the element background colors to undesired colors. I may remove the class="label" in favor of an actual permanent background. Maybe.
- It still lists players who haven't chosen an element. I could have fixed it to not show these players, but then I thought to myself, "This isn't an issue with my code, perhaps a plugin dev should code a way to clean up the database to remove players without a type (and who have permaremoved=null)."

I didn't mention this in the OP, but the above code is PHP. To use it you would paste it into a file titled 'index.php' or something similar on your PHP enabled web host.
 
Last edited:

AlexTheCoder

Staff member
Plugin Developer
Verified Member
You should make a way to change their bending in your interface. Also, we need players with no bending to be stored because of our BendingPlayer method. We ensure that ALL players are stored upon joining.
 

Dooder_07

Verified Member
You should make a way to change their bending in your interface. Also, we need players with no bending to be stored because of our BendingPlayer method. We ensure that ALL players are stored upon joining.
Thanks! I will definitely look for a secure method for signing on via your MySQL credentials to edit the table data, maybe via an Admin interface. Also, I understand the logic for keeping EVERY player stored in the administrators SQL database. I'll probably leave it the way it currently is; blank for no element.
 

Dooder_07

Verified Member
Something to keep in mind, if you change the players element via a SQL editor, the player's bending won't update until they relog or the plugin reloads. I finished an admin tab with the functionality to edit all the cells for the pk_players table, but I need to test it further before I release the source here.

In the meanwhile, there are some more tested alternatives out there, such as Adminer for editing your databases via your browser!
 

Mist

Staff member
Administrator
I created something similar a while ago that is still used for my server! It just keeps track of how many of each element you have in your database.

Screenshot:


I may release a download soon enough.
 

NinjaK

Verified Member
I created something similar a while ago that is still used for my server! It just keeps track of how many of each element you have in your database.

Screenshot:


I may release a download soon enough.
I love the graphical interface there, looks very simple and nice. A download would be amazing.
 

Dooder_07

Verified Member
I created something similar a while ago that is still used for my server! It just keeps track of how many of each element you have in your database.

Screenshot:


I may release a download soon enough.
I assume players with more than one type were added to each of the corresponding values. If you wouldn't mind, I could 'prettify' (re-create) this then add it as a "home" tab to my interface along with the "admin" tab I finished (for editing players types and abilities).
 

xX_FireGaming_Xx

Verified Member
I got bored last night and decided to adapt the same code I use to display other mysql tables for ProjectKorra.

This isn't complete! I still need to change the element output to a more visually friendly format and I also want to create [optional] columns for 'permaremoved' and 'ability slots'.

The code itself is pretty minimalist; utilizing CDNs for bootstrap, themes (css/bootswatch) and javascripts! It's all configurable right there at the top of the source.

I'm totally open to criticism/suggestions for improving this interface.
It's really nothing complicated, so I won't get mad at you if you do criticize me. d:



PHP:
removed outdated code, use source below
awesome job you took your time to make this forum and it received a like and follow
 

Jackson

Staff member
Digital Team
Moderator
Verified Member
I want to make something similar to this on my website but my own design, what rank the player is on the server and the playtime on the server. Can anyone help? I don't know if the person who made this is inactive or not because I can't see when he was last on.


EDIT: When thus was created, bending was saved in a MySQL table but it isn't anymore. I would like to know how it is possible for us to be able to do this. I know mist knows but I don't know how to make it read the file in the pk folder in FTP.
 
Last edited:

Finn_Bueno_

Staff member
Plugin Developer
Verified Member
I got bored last night and decided to adapt the same code I use to display other mysql tables for ProjectKorra.

This isn't complete! I still need to change the element output to a more visually friendly format and I also want to create [optional] columns for 'permaremoved' and 'ability slots'.

The code itself is pretty minimalist; utilizing CDNs for bootstrap, themes (css/bootswatch) and javascripts! It's all configurable right there at the top of the source.

I'm totally open to criticism/suggestions for improving this interface.
It's really nothing complicated, so I won't get mad at you if you do criticize me. d:



PHP:
removed outdated code, use source below
 

Dooder_07

Verified Member
Yes, I'm still active. I could probably improve this interface a lot more now. Also, you can always remove the bootstrap styling and add your own, or change the bootstrap theme.

In response to Jackson, PK still uses MySQL for player data and I recommend it for larger servers and for those who want to manipulate the data more easily. If you want to use the alternative flat file system, I know Java can read a remotely stored file (http) out of the box (and ftp using apache commons). I'm not too sure about JS or PHP yet. But I can find out.

Depending on your setup, if you use UNIX and if the game and web servers are on the same machine, you could easily symlink the PK data to the webserver somewhere to avoid using ftp. But that's probably not possible. Seems like most people pay a hosting company for everything these days.
 

Jackson

Staff member
Digital Team
Moderator
Verified Member
Yes, I'm still active. I could probably improve this interface a lot more now. Also, you can always remove the bootstrap styling and add your own, or change the bootstrap theme.

In response to Jackson, PK still uses MySQL for player data and I recommend it for larger servers and for those who want to manipulate the data more easily. If you want to use the alternative flat file system, I know Java can read a remotely stored file (http) out of the box (and ftp using apache commons). I'm not too sure about JS or PHP yet. But I can find out.

Depending on your setup, if you use UNIX and if the game and web servers are on the same machine, you could easily symlink the PK data to the webserver somewhere to avoid using ftp. But that's probably not possible. Seems like most people pay a hosting company for everything these days.
I enabled it but I don't see it in my MySQL tables.
 

Dooder_07

Verified Member
For future reference, even though I've already answered you privately, quotes are not needed around an integer (port number). And I'm not sure if they check case from ConfigManager, but lowercase 'mysql' should be used for engine.
 
Top