-
Notifications
You must be signed in to change notification settings - Fork 2
Dtlstats reference
Usage of this dtlStats api and its classes: almost all servers got the main world named world
so we want to show on our website how many zombies we got on this main world. The code would look like this:
echo "Zombies: ".World::entities()->zombie;
thats it :)
class Bukkit extends StatClass { }
class World extends StatClass { }
class Player extends StatClass { }
with these classes you can get a lot of player/world/server specific informations on the fly :)
A list of all stats you can get from the bukkit server:
plugins {
//a list of all plugins on the server, saved like this
"pluginName1" => "pluginVersion1",
"pluginName2" => "pluginVersion2",
"pluginName3" => "pluginVersion3",
}
server {
ip, port, motd, name, version, maxPlayers, onlineMode, defaultGamemode, isHardcore
}
As you see above these stats got more leves/layers so how to get them? It's easy, the first name is always the method name like
Bukkit::server();
and the second values can be acquired by just pointing to them like this:
Bukkit::server()->motd;
or to dont always use the Bukkit::server() method
$server = Bukkit::server();
$server->motd;
Get a player in this way
//returns the information from the requested player.
$player = PLayer::get("PlayerName");
or if you know for sure what player is interesting you then you can make this:
//create a special class for the requested player
class PlayerName extends Player { }
now you can (depending if you are using the $variable or Class setup) show informations from players.
A list of all stats you can get from a player:
exp, expTotal, expToLvl, level, food, exhaustion, air, airMax, gamemode, lived, isOnline, isDead, isFlying, isOp, isSleeping, isSneaking, isSprinting, isWhitelisted, isBanned
if you want to show lets say all experience values (exp, expToLvl, expTotal), you would do it like in the example below:
echo $player->exp;
echo $player->expTotal;
echo $player->expToLvl;
or
echo PlayerName::exp();
echo PlayerName::expTotal();
echo PlayerName::expToLvl();