Untitled
unknown
plain_text
3 years ago
1.2 kB
7
Indexable
<?php
namespace MyPlugin;
use pocketmine\{Player, Server};
use pocketmine\command\{Command, CommandSender};
use pocketmine\entity\Entity;
use pocketmine\plugin\PluginBase;
class Testol extends Player {
public static $height = 1.8;
public static $width = 0.6;
public static $gravity = 0.08;
public function __construct($world, $spawn = null) {
parent::__construct($world, $spawn);
$this->setNameTag("привет");
}
}
class MyPlugin extends PluginBase {
public function onEnable(){
$this->getLogger()->info("Плагин запущен");
}
public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool {
switch(strtolower($cmd->getName())) {
case "lole":
$this->createTestol();
break;
default:
return false;
}
return true;
}
private function createTestol() {
$level = Server::getInstance()->getDefaultLevel();
$testol = new Testol($level);
$testol->setSpawn($level->getSpawnLocation());
$level->addEntity($testol);
}
}
Editor is loading...