forked from ifera-mc/ScoreHud-Addons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlockSniperAddon.php
48 lines (42 loc) · 1.26 KB
/
BlockSniperAddon.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 BlockSniperAddon
* @version 1.0.0
* @main BlockHorizons\ScoreHud\Addons\BlockSniperAddon
* @depend BlockSniper
* @api 4.0.0
*/
namespace BlockHorizons\ScoreHud\Addons {
use BlockHorizons\BlockSniper\brush\Brush;
use BlockHorizons\BlockSniper\sessions\SessionManager;
use JackMD\ScoreHud\addon\AddonBase;
use pocketmine\Player;
class BlockSniperAddon extends AddonBase{
/**
* @param Player $player
* @return array
*/
public function getProcessedTags(Player $player): array{
$session = SessionManager::getPlayerSession($player);
$shape = $type = $mode = $size = "No Perm";
if($session !== null){
// We only set the correct values if the player has the permission required.
$brush = $session->getBrush();
$shape = $brush->getShape()->getName();
$type = $brush->getType()->getName();
$mode = $brush->mode === Brush::MODE_BRUSH ? "Brush" : "Selection";
$size = (string) $brush->size;
if($brush->getShape()->usesThreeLengths()){
$size = (string) $brush->width . "x" . (string) $brush->length . "x" . (string) $brush->height;
}
}
return [
"{brush_shape}" => $shape,
"{brush_type}" => $type,
"{brush_mode}" => $mode,
"{brush_size}" => $size,
];
}
}
}