The REAL minecraft elytra FOR MCPE SERVERS ! Also have some awesome admin additions !
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
724B

  1. <?php
  2. namespace Ad5001\Elytra\tasks;
  3. use pocketmine\scheduler\PluginTask;
  4. use Ad5001\Elytra\Main;
  5. class AdminGotoTask extends PluginTask {
  6. public function __construct(Main $main) {
  7. parent::__construct($main);
  8. }
  9. public function onRun(int $tick) {
  10. foreach ($this->getOwner()->getServer()->getOnlinePlayers() as $player) {
  11. //Part needed for players to fly upwards
  12. $ref = new \ReflectionClass("pocketmine\\Player");
  13. $prop = $ref->getProperty("gravity");
  14. $prop->setAccessible(true);
  15. $prop->setValue($player, 0);
  16. $prop->setAccessible(false);
  17. if($player->getMotion()->y !== 0) {
  18. $this->getOwner()->getLogger()->debug("{$player->getName()}'s y motion is {$player->getMotion()->y}");
  19. }
  20. }
  21. }
  22. }