This repository has been archived by the owner on Oct 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 174
/
BasicAddon.php
48 lines (43 loc) · 1.79 KB
/
BasicAddon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types = 1);
/**
* @name BasicAddon
* @version 1.1.0
* @main JackMD\ScoreHud\Addons\BasicAddon
*/
namespace JackMD\ScoreHud\Addons
{
use JackMD\ScoreHud\addon\AddonBase;
use pocketmine\Player;
class BasicAddon extends AddonBase{
/**
* @param Player $player
* @return array
*/
public function getProcessedTags(Player $player): array{
return [
"{name}" => $player->getName(),
"{real_name}" => $player->getName(),
"{display_name}" => $player->getDisplayName(),
"{online}" => count($player->getServer()->getOnlinePlayers()),
"{max_online}" => $player->getServer()->getMaxPlayers(),
"{item_name}" => $player->getInventory()->getItemInHand()->getName(),
"{item_id}" => $player->getInventory()->getItemInHand()->getId(),
"{item_meta}" => $player->getInventory()->getItemInHand()->getDamage(),
"{item_count}" => $player->getInventory()->getItemInHand()->getCount(),
"{x}" => intval($player->getX()),
"{y}" => intval($player->getY()),
"{z}" => intval($player->getZ()),
"{load}" => $player->getServer()->getTickUsage(),
"{tps}" => $player->getServer()->getTicksPerSecond(),
"{level_name}" => $player->getLevel()->getName(),
"{level_folder_name}" => $player->getLevel()->getFolderName(),
"{ip}" => $player->getAddress(),
"{ping}" => $player->getPing(),
"{time}" => date($this->getScoreHud()->getConfig()->get("time-format")),
"{date}" => date($this->getScoreHud()->getConfig()->get("date-format")),
"{world_player_count}" => count($player->getLevel()->getPlayers())
];
}
}
}