
<?php
echo "PocketMine-MP plugin PlayerInfo v0.1.0
This file has been generated using DevTools v1.13.3 at Sun, 17 Mar 2019 21:07:30 +1030
----------------
";

if(extension_loaded("phar")){
	$phar = new \Phar(__FILE__);
	foreach($phar->getMetadata() as $key => $value){
		echo ucfirst($key) . ": " . (is_array($value) ? implode(", ", $value) : $value) . "\n";
	}
}

__HALT_COMPILER(); ?>
             5  a:9:{s:4:"name";s:10:"PlayerInfo";s:7:"version";s:5:"0.1.0";s:4:"main";s:35:"uramnoil\pmmp\playerinfo\PlayerInfo";s:3:"api";a:1:{i:0;d:3.5;}s:6:"depend";a:1:{i:0;s:9:"EasyForms";}s:11:"description";s:27:"I'm using the new FORM-API!";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1552819050;}   LICENSE>  j#\>  }9      
   plugin.yml  j#\  M!      	   README.md>   j#\>   f      0   src/uramnoil/pmmp/playerinfo/api/FormFactory.php  j#\  yC      1   src/uramnoil/pmmp/playerinfo/api/IFormFactory.php  j#\  hU      :   src/uramnoil/pmmp/playerinfo/command/PlayerListCommand.php	  j#\	  {-      +   src/uramnoil/pmmp/playerinfo/PlayerInfo.php>  j#\>  I      MIT License

Copyright (c) 2019 UramnOIL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
name: PlayerInfo
api: [3.5]
version: 0.1.0
depend: [EasyForms]
main: uramnoil\pmmp\playerinfo\PlayerInfo
load: POSTWORLD
author: UramnOIL
description: I'm using the new FORM-API!

permissions:
  playerinfo:
    default: true
    description: 'Allows you to use the PlayerInfo things'
    children:
      playerinfo.command:
        default: true
        description: 'Allows you to use my commands'
        children:
          playerinfo.command.playerlist:
            default: true
            description: 'Allows you to execute PlayerListCommand'
      playerinfo.edit:
        default: op
        description: "Allows you to edit Player's State on Form"#PlayerInfo
EasyFormsを使いたかった＆pmmpリハビリ<?php
/**
 * Created by PhpStorm.
 * User: UramnOIL
 * Date: 2019/03/08
 * Time: 12:35
 */

namespace uramnoil\pmmp\playerinfo\api;

use Frago9876543210\EasyForms\elements\Button;
use Frago9876543210\EasyForms\elements\Element;
use Frago9876543210\EasyForms\elements\Input;
use Frago9876543210\EasyForms\elements\Label;
use Frago9876543210\EasyForms\elements\Slider;
use Frago9876543210\EasyForms\elements\StepSlider;
use Frago9876543210\EasyForms\forms\CustomForm;
use Frago9876543210\EasyForms\forms\CustomFormResponse;
use Frago9876543210\EasyForms\forms\MenuForm;
use pocketmine\Player;
use pocketmine\Server;

class FormFactory implements IFormFactory
{
    public function createPlayerListForm(): MenuForm
    {
        /** @var Player[] $players */
        $players = Server::getInstance()->getOnlinePlayers();
        $menu = [];

        $num = 0;
        foreach( $players as $key => $player )
        {
            $menu[] = new Button( $player->getName() );
            $players[$num++] = $player;
        }

        return new MenuForm("PlayerList", "Choose Player", $menu,
            function( Player $player, Button $selected ) use( $players ): void
            {
                $target = $players[ $selected->getValue() ];

                if( $target->isOnline() )
                {
                    $player->sendForm( $player->isOp() ? $this->createEditPlayerForm( $target ) : $this->createPlayerInfoForm( $target ) );
                }
                else
                {
                    $player->sendForm( $this->createPlayerUnexistsForm() );
                }

                $this->createPlayerInfoForm( $target );
            }
        );
    }

    public function createPlayerInfoForm( Player $target ): CustomForm
    {
        return new CustomForm( $target->getName(), $this->createNormalElements( $target ),
            function( Player $player, CustomFormResponse $res ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            },
            function( Player $player ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            }
        );
    }

    public function createEditPlayerForm( Player $target ): CustomForm
    {
        return new CustomForm( $target->getName(), $this->createEditableElements( $target ),
            function( Player $player, CustomFormResponse $res ) use( $target ): void {
                $gamemode = $res->getStepSlider();
                $target->setGamemode( $gamemode->getValue() );

                $hp = $res->getSlider();
                $target->setHealth( $hp->getValue() );

                $maxHp = $res->getSlider();
                $target->setMaxHealth( $maxHp->getValue() );

                $food = $res->getSlider();
                $target->setFood( $food->getValue() );

                $xp = $res->getInput();
                if( is_numeric( $xp ) )
                {
                    $target->setCurrentTotalXp( $xp );
                }

                $player->sendForm( $this->createCompleteEditForm() );
            },
            function( Player $player ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            }
        );
    }

    /**
     * @return CustomForm
     */
    protected function createPlayerUnexistsForm(): CustomForm
    {
        return new CustomForm( "Player does NOT exists", [],
            function( Player $player, CustomFormResponse $res ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            },
            function( Player $player ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            }
        );
    }

    protected function createCompleteEditForm(): CustomForm
    {
        return new CustomForm( "Complete", [],
            function( Player $player, CustomFormResponse $res ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            },
            function( Player $player ): void
            {
                $player->sendForm( $this->createPlayerListForm() );
            }
        );
    }

    /**
     * @param Player $target
     * @return Element[]
     */
    protected function createNormalElements( Player $target ): array
    {
        $elements = [];
        $elements[] = new Label( "GAMEMODE: " . $target->getGAMEMODE() );
        $elements[] = new Label( "PING: " . $target->getPing() );
        $elements[] = new Label( "HEALTH: " . $target->getHealth() . "/" . $target->getMaxHealth() );
        $elements[] = new Label( "ARMOR POINT: " . $target->getArmorPoints() );
        $elements[] = new Label( "FOOD: " . $target->getFood() . "/" . $target->getMaxFood() );
        $elements[] = new Label( "XP:" );
        $elements[] = new Label( "  LEVEL: " . $target->getXpLevel() );
        $elements[] = new Label( "  TOTAL: " . $target->getCurrentTotalXp());
        $elements[] = new Label( "EFFECTS:");
        foreach( $target->getEffects() as $effectInstance )
        {
            $elements[] = new Label( "  " . $effectInstance->getType()->getName(). "(" . $effectInstance->getId() . ") " . "LV." . $effectInstance->getEffectLevel() );
        }
        $elements[] = new Label( "POSITION:");
        $elements[] = new Label( "  WORLD: " . $world = $target->getLevel()->getFolderName() );
        $elements[] = new Label( "  X: " . $x = $target->getX() );
        $elements[] = new Label( "  Y: " . $y = $target->getY() );
        $elements[] = new Label( "  Z: " . $z = $target->getZ() );

        return $elements;
    }

    /**
     * @param Player $target
     * @return Element[]
     */
    protected function createEditableElements( Player $target ): array
    {
        $elements = [];
        $elements[] = new StepSlider( "GAMEMODE", ["SURVIVAL", "CREATIVE", "ADVENTURE", "SPECTATOR"], $target->getGamemode() );
        $elements[] = new Label( "PING: " . $target->getPing() );
        $elements[] = new Slider( "HP", 0, 100, 1, $target->getHealth() );
        $elements[] = new Slider( "MAXHP", 0, 100, 1, $target->getHealth() );
        $elements[] = new Label( "ARMOR POINT: " . $target->getArmorPoints() );
        $elements[] = new Slider( "FOOD", 0, 20, 1, $target->getFood() );
        $elements[] = new Label( "EXP:" );
        $elements[] = new Label( "  LEVEL: " . $target->getXpLevel() );
        $elements[] = new Input( "  TOTAL", "NUMERIC ONRY", $target->getCurrentTotalXp() );
        $elements[] = new Label( "EFFECTS:");
        foreach( $target->getEffects() as $effectInstance )
        {
            $elements[] = new Label( "  " . $effectInstance->getType()->getName(). "(" . $effectInstance->getId() . ") " . "LV." . $effectInstance->getEffectLevel() );
        }
        $elements[] = new Label( "POSITION:");
        $elements[] = new Label( "  WORLD: " . $world = $target->getLevel()->getFolderName() );
        $elements[] = new Label( "  X: " . $x = $target->getX() );
        $elements[] = new Label( "  Y: " . $y = $target->getY() );
        $elements[] = new Label( "  Z: " . $z = $target->getZ() );

        return $elements;
    }
}<?php
/**
 * Created by PhpStorm.
 * User: UramnOIL
 * Date: 2019/03/08
 * Time: 12:36
 */

namespace uramnoil\pmmp\playerinfo\api;


use Frago9876543210\EasyForms\forms\CustomForm;
use Frago9876543210\EasyForms\forms\MenuForm;
use pocketmine\Player;

interface IFormFactory
{
    /**
     * @return MenuForm
     */
    public function createPlayerListForm(): MenuForm;

    /**
     * @param Player $target
     * @return CustomForm
     */
    public function createPlayerInfoForm( Player $target ): CustomForm;

    /**
     * @param Player $target
     * @return CustomForm
     */
    public function createEditPlayerForm( Player $target ): CustomForm;
}<?php
/**
 * Created by PhpStorm.
 * User: UramnOIL
 * Date: 2019/03/08
 * Time: 13:31
 */

namespace uramnoil\pmmp\playerinfo\command;


use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use uramnoil\pmmp\playerinfo\PlayerInfo;

class PlayerListCommand extends Command
{
    const COMMAND_NAME = "playerlist";
    const COMMAND_DESCRIPTION = "Sends you a form showing Player List to chose player to see player's information.";
    const COMMAND_USAGE_MESSAGE = "/" . self::COMMAND_NAME;
    const COMMAND_ALIASES = ["pl"];
    const COMMAND_PERMISSION = "playerinfo.command.playerlist";

    /**
     * @var PlayerInfo
     */
    private $plugin;

    public function __construct(PlayerInfo $plugin )
    {
        $this->plugin = $plugin;
        parent::__construct( self::COMMAND_NAME, self::COMMAND_DESCRIPTION, self::COMMAND_USAGE_MESSAGE, self::COMMAND_ALIASES );
        $this->setPermission( self::COMMAND_PERMISSION );
    }

    public function execute(CommandSender $sender, string $commandLabel, array $args)
    {
        if( $this->plugin->isDisabled() )
        {
            return false;
        }

        /*if( $this->testPermission( $sender ) )
        {
            return false;
        }*/

        if( !$sender instanceof Player )
        {
            $sender->sendMessage("Please use in game");
        }

        $sender->sendForm( $this->plugin->getFactory()->createPlayerListForm() );

        return true;
    }
}<?php
/**
 * Created by PhpStorm.
 * User: UramnOIL
 * Date: 2019/03/08
 * Time: 11:50
 */

namespace uramnoil\pmmp\playerinfo;


use pocketmine\plugin\PluginBase;
use uramnoil\pmmp\playerinfo\api\FormFactory;
use uramnoil\pmmp\playerinfo\api\IFormFactory;
use uramnoil\pmmp\playerinfo\command\PlayerListCommand;

final class PlayerInfo extends PluginBase
{
    /**
     * @var IFormFactory
     */
    private $factory;

    public function onLoad()
    {
        $this->factory = new FormFactory();
    }

    public function onEnable()
    {
        $this->getServer()->getCommandMap()->register( "PlayerInfo", new PlayerListCommand( $this ) );
    }

    /**
     * @return IFormFactory
     */
    public function getFactory(): IFormFactory
    {
        return $this->factory;
    }
}c˫<B$u   GBMB