-
Notifications
You must be signed in to change notification settings - Fork 0
/
StealHumanoidSkin.php
64 lines (57 loc) · 1.96 KB
/
StealHumanoidSkin.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* ____ _ _ ___
* | _ \ _ __ ___ ___ ___ _ __ | |_| |/ (_)_ __ ___
* | |_) | '__/ _ \/ __|/ _ \ '_ \| __| ' /| | '_ ` _ \
* | __/| | | __/\__ \ __/ | | | |_| . \| | | | | | |
* |_| |_| \___||___/\___|_| |_|\__|_|\_\_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License. see <https://opensource.org/licenses/MIT>.
*
*
* @author PresentKim (debe3721@gmail.com)
* @link https://github.com/PresentKim
* @license https://opensource.org/licenses/MIT MIT License
*
* @name StealHumanoidSkin
* @main kim\present\singleton\humanoid\StealHumanoidSkin
* @version 1.0.0
* @api 3.0.0-ALPHA11
* @description Stil humanoid's skin
*
* (\ /)
* ( . .) ♥
* c(")(")
*/
declare(strict_types=1);
namespace kim\present\singleton\humanoid {
use kim\present\humanoid\event\PlayerClickHumanoidEvent;
use pocketmine\entity\Skin;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
class StealHumanoidSkin extends PluginBase implements Listener{
public function onEnable() : void{
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
/**
* @priority HIGHEST
*
* @param PlayerClickHumanoidEvent $event
*/
public function onPlayerClickHumanoidEvent(PlayerClickHumanoidEvent $event){
if(!$event->isCancelled()){
$player = $event->getPlayer();
$humanoid = $event->getHumanoid();
$skin = $player->getSkin();
if($event->getAction() === PlayerClickHumanoidEvent::LEFT_CLICK){
$skin = new Skin('humanoid', $humanoid->getSkin()->getSkinData(), $skin->getCapeData(), $skin->getGeometryName(), $skin->getGeometryData());
}else{
$skin = new Skin('humanoid', $skin->getSkinData(), $skin->getCapeData(), $humanoid->getSkin()->getGeometryName(), $humanoid->getSkin()->getGeometryData());
}
$player->setSkin($skin);
$player->sendSkin();
}
}
}
}