<?php echo "PocketMine-MP plugin KD v1\nThis file has been generated using DevTools v1.12.1 at Sat, 20 Jan 2018 17:56:10 +0900\n----------------\n";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(); ?>
(             *  a:9:{s:4:"name";s:2:"KD";s:7:"version";s:1:"1";s:4:"main";s:8:"SEI\Main";s:3:"api";a:11:{i:0;s:5:"3.0.0";i:1;s:12:"3.0.0-ALPHA1";i:2;s:12:"3.0.0-ALPHA2";i:3;s:12:"3.0.0-ALPHA3";i:4;s:12:"3.0.0-ALPHA4";i:5;s:12:"3.0.0-ALPHA5";i:6;s:12:"3.0.0-ALPHA6";i:7;s:12:"3.0.0-ALPHA7";i:8;s:12:"3.0.0-ALPHA8";i:9;s:12:"3.0.0-ALPHA9";i:10;s:13:"3.0.0-ALPHA10";}s:6:"depend";a:0:{}s:11:"description";s:60:"総kill、death数、キルレートの確認ができます";s:7:"authors";a:1:{i:0;s:13:"seiichiro0511";}s:7:"website";s:0:"";s:12:"creationDate";i:1516438570;}	   death.yml   *cZ   zT         id.yml   *cZ   ۀP         kill.yml   *cZ   zT      
   plugin.ymlO  *cZO  !      (   src/RuinPray/ui/elements/BaseElement.php'  *cZ'  h      %   src/RuinPray/ui/elements/Dropdown.phpO  *cZO  	>      $   src/RuinPray/ui/elements/Element.phps   *cZs   rl      "   src/RuinPray/ui/elements/Input.php.  *cZ.  tڶ      "   src/RuinPray/ui/elements/Label.php   *cZ   h"      #   src/RuinPray/ui/elements/Slider.php  *cZ        '   src/RuinPray/ui/elements/StepSlider.php,  *cZ,  D      #   src/RuinPray/ui/elements/Toggle.php  *cZ  0Ҷ      $   src/RuinPray/ui/forms/CustomForm.php  *cZ  Ƒȫ      #   src/RuinPray/ui/forms/ModalForm.phpJ  *cZJ  ?      $   src/RuinPray/ui/forms/SimpleForm.php  *cZ  L          src/RuinPray/ui/forms/Window.phpH  *cZH  >          src/RuinPray/ui/UI.php  *cZ  <[S         src/SEI/Main.php-  *cZ-  *      --- []
...
---
id: 280
...
--- []
...
﻿name: KD
main: SEI\Main
version: 1.0
api:
- 3.0.0
- 3.0.0-ALPHA1
- 3.0.0-ALPHA2
- 3.0.0-ALPHA3
- 3.0.0-ALPHA4
- 3.0.0-ALPHA5
- 3.0.0-ALPHA6
- 3.0.0-ALPHA7
- 3.0.0-ALPHA8
- 3.0.0-ALPHA9
- 3.0.0-ALPHA10
load: POSTWORLD
author: seiichiro0511
description: 総kill、death数、キルレートの確認ができます
commands:
 kd:
  usage:
  description: "総kill、death数、キルレートの確認"
  permission: kd.command
permissions:
 kd:
  default: true
  description: "kill&death status"
 kd.command:
  default: true
  description: "kill&death status"
<?php

namespace RuinPray\ui\elements;

abstract class BaseElement implements Element {

	const TYPE = "";
	public $text = "text!"; /** @var string */

	public function text(string $text) : BaseElement {
		$this->text = $text;
		return $this;
	}

	public function content() {
		return [];
	}

}
<?php

namespace RuinPray\ui\elements;

class Dropdown extends BaseElement {

	const TYPE = "dropdown";

	public $options; /** @var array */
	public $defaultOptionIndex = 0;

	public function options(array $options) : Dropdown {
		$this->options = $options;
		return $this;
	}

	public function defaultOptionIndex($default) : Dropdown {
		$this->defaultOptionIndex = $default;
		return $this;
	}

	public function content() : array {
		return [
			"type" => self::TYPE,
			"text" => $this->text,
			"options" => $this->options,
			"defaultOptionIndex" => $this->defaultOptionIndex
		];
	}
}
<?php

namespace RuinPray\ui\elements;

interface Element {

  /** @return array */
	public function content();

}
<?php

namespace RuinPray\ui\elements;

class Input extends BaseElement {

	const TYPE = "input";

	public $placeholder = null;
	public $default = null;

	public function placeholder(string $placeholder) : Input {
		$this->placeholder = $placeholder;
		return $this;
	}

	public function default(string $default) : Input {
		$this->default = $default;
		return $this;
	}

	public function content() : array {
		return [
			"type" => self::TYPE,
			"text" => $this->text,
			"placeholder" => $this->placeholder,
			"default" => $this->default ?? ""
		];
	}
}
<?php

namespace RuinPray\ui\elements;

class Label extends BaseElement {

  const TYPE = "label";

  public function content() {
    return [
      "type" => self::TYPE,
      "text" => $this->text
    ];
  }
}
<?php

namespace RuinPray\ui\elements;

class Slider extends BaseElement {

	const TYPE = "slider";

	public $min = 0;
	public $max = 10:
	public $steps = 1;
	public $defaultValue = 0;

	public function min(int $min) : Slider {
		$this->min = $min;
		return $this;
	}

	public function max(int $max) : Slider {
		$this->max = $max;
		return $this;
	}

	public function steps(int $steps) : Slider {
		$this->steps = $steps;
		return $this;
	}

	public function defaultValue($default) : Slider {
		$this->defaultValue = $default;
		return $this;
	}

	public function content() : array {
		return [
			"type" => self::TYPE,
			"text" => $this->text,
			"min" => $this->min,
			"max" => $this->max,
			"steps" => $this->steps,
			"defaultValue" => $this->defaultValue
		];
	}
}
<?php

namespace RuinPray\ui\elements;

class StepSlider extends BaseElement {

	const TYPE = "step_slider";

	public $steps; /** @var array */
	public $defaultIndex = 0;

	public function steps(array $steps) : StepSlider {
		$this->steps = $steps;
		return $this;
	}

	public function defaultIndex($default) : StepSlider {
		$this->defaultIndex = $default;
		return $this;
	}

	public function content() : array {
		return [
			"type" => self::TYPE,
			"text" => $this->text,
			"steps" => $this->steps,
			"defaultIndex" => $this->defaultIndex
		];
	}
}
<?php

namespace RuinPray\ui\elements;

class Toggle extends BaseElement {

	const TYPE = "toggle";
	public $defaultValue = false;


	public function defaultValue(string $default) : Toggle {
		$this->defaultValue = $default;
		return $this;
	}

	public function content() : array {
		return [
			"type" => self::TYPE,
			"text" => $this->text,
			"defaultValue" => $this->defaultValue
		];
	}
}
<?php

namespace RuinPray\ui\forms;

use RuinPray\ui\elements\Element;

class CustomForm extends Window {

	public function __construct(Int $id){
		parent::__construct($id);

		$this->data = [
			"type" => "custom_form",
			"title" => "",
			"content" => []
		];
	}

	public function setTitle(String $title){
		$this->data["title"] = $title;
	}

/*----- Elements -----*/

	public function addContent(Element $element) {
		$this->data["content"][] = $element->content();
	}

}
<?php

namespace RuinPray\ui\forms;

class ModalForm extends Window {

	public function __construct(Int $id){
		parent::__construct($id);

		$this->data = [
			"type" => "modal",
			"title" => "",
			"content" => "",
			"button1" => "",
			"button2" => ""
		];
	}

	public function setTitle(String $title){
		$this->data["title"] = $title;
	}

	public function setContent(String $text){
		$this->data["content"] = $text;
	}

	public function setButton1(String $text){
		$this->data["button1"] = $text;
	}
	public function setButton2(String $text){
		$this->data["button2"] = $text;
	}
}<?php

namespace RuinPray\ui\forms;

class SimpleForm extends Window {

	public function __construct(Int $id){
		parent::__construct($id);
        
		$this->data = [
			"type" => "form",
			"title" => "",
			"content" => "",
			"buttons" => []
		];
	}

	public function setTitle(String $title){
		$this->data["title"] = $title;
	}

	public function setContent(String $text){
		$this->data["content"] = $text;
	}

	public function addButton(String $text, $image = null){
		if($image !== null){
			$this->data["buttons"][] = [
				"text" => $text,
				"image" => [
					"type" => "url",
					"data" => $image
				]
			];
		}else{
			$this->data["buttons"][] = [
				"text" => $text
			];
		}
	}
}<?php

namespace RuinPray\ui\forms;

class Window {

	protected $id;
	protected $data;

	public function __construct(Int $id){
		$this->id = $id;
	}

	public function encode(){
		$this->data = json_encode($this->data);
	}

	public function getId(){
		return $this->id;
	}
	
	public function getData(){
		return $this->data;
	}
}<?php

namespace RuinPray\ui;

use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;

use pocketmine\Player;

use RuinPray\ui\forms\CustomForm;
use RuinPray\ui\forms\SimpleForm;
use RuinPray\ui\forms\ModalForm;

class UI {

	public static function createCustomForm(Int $id){
		return new CustomForm($id);
	}

	public static function createModalForm(Int $id){
		return new ModalForm($id);
	}

	public static function createSimpleForm(Int $id){
		return new SimpleForm($id);
	}

	public static function sendForm($player, $form){
		$pk = new ModalFormRequestPacket();
		$form->encode();
		$pk->formId = $form->getId();
		$pk->formData = $form->getData();
		$player->dataPacket($pk);
	}

}<?php

namespace SEI;

use pocketmine\plugin\PluginBase;
use pocketmine\event\Listener;

use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\CommandExecutor;

use pocketmine\event\player\PlayerDeathEvent;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\player\PlayerQuitEvent;

use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityDeathEvent;
use pocketmine\event\entity\EntityDamageByEntityEvent;

use pocketmine\Server;
use pocketmine\Player;
use pocketmine\utils\Config;

use pocketmine\event\player\PlayerMoveEvent;

use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;

use pocketmine\event\player\PlayerInteractEvent;

use pocketmine\item\Item;
use pocketmine\inventory\Inventory;

use RuinPray\ui\UI;


class Main extends PluginBase implements Listener{

	public function onEnable(){
		$this->getlogger()->info("§b使い道がなさそうなプラグインを読み込みました §a製作者 : seiichiro0511");
		$this->getlogger()->warning("このプラグインの二次配布、製作者偽りは禁止です");
		$this->getServer()->getPluginManager()->registerEvents($this, $this);

		if(!file_exists($this->getDataFolder())){
		mkdir($this->getDataFolder());
}

$this->death = new Config($this->getDataFolder()."death.yml", Config::YAML);
$this->kill = new Config($this->getDataFolder()."kill.yml", Config::YAML);
$this->id = new Config($this->getDataFolder() ."id.yml", Config::YAML,
[
		"id" => 280
	]
);

	}

	public function onDisable(){
		$this->kill->save();
		$this->death->save();
}

  public function onQuit(PlayerQuitEvent $event){
	$this->kill->save();
	$this->death->save();
}
public function onMove(PlayerMoveEvent $event){
$this->kill->save();
$this->death->save();
}

        public function onJoin(PlayerJoinEvent $event){
					$player = $event->getPlayer();
					$name = $player->getName();
					$this->kill->save();
					$this->death->save();
					if($this->kill->exists("" .$name. "")){

					}else{
						$this->kill->set("" .$name. "", "1");
					}

					if($this->death->exists("" .$name. "")){

					}else{
						$this->death->set("" .$name. "", "1");
					}
				}

				public function onInteract(PlayerInteractEvent $event){
					$player = $event->getPlayer();
					$name = $player->getName();
					$death = $this->death->get("" .$name. "");
					$kill = $this->kill->get("" .$name. "");

					$id = $this->id->get("id");

					$killrate = round($kill / $death, 2);
					if($player->getInventory()->getItemInHand()->getId() === $id){

						$form = UI::createSimpleForm(1000);
						$form->setTitle("§e" .$name. "さん§bのステータス");
						$form->setContent("§4総KILL数  §r" .$kill. "\n§d総DEATH数  §r" .$death. "\n§eキルレート  §r" .$killrate. "");
						$form->addButton("閉じる");
						UI::sendForm($player, $form);

					}
			}

				public function onDeath(PlayerDeathEvent $event){
					$player = $event->getPlayer();

					$cause = $player->getLastDamageCause();

					$n = $player->getName();
					$d = $this->death->get("" .$n. "");

					$this->death->set("" .$n. "", $d + 1);

					if(isset($player->lastDamager)){

							$killer = $player->lastDamager;
							$name = $killer->getName();

							$k = $this->kill->get("" .$name. "");

							$this->kill->set("" .$name. "", $k + 1);

							unset($player->lastDamager);
					}
				}

public function onCommand(CommandSender $sender, Command $command, string $label, array $args) :bool {
	if(!$sender instanceof Player){
		$sender->sendMessage("§cゲーム内で実行してください");
		return true;
	}

	$name = $sender->getPlayer()->getName();

	$kill = $this->kill->get("" .$name. "");
	$death = $this->death->get("" .$name. "");

	$killrate = round($kill / $death, 2);

switch (strtolower($command->getName())) {

case "kd":

$form = UI::createSimpleForm(1000);
$form->setTitle("§e" .$name. "さん§bのステータス");
$form->setContent("§4総KILL数  §r" .$kill. "\n§d総DEATH数  §r" .$death. "\n§eキルレート  §r" .$killrate. "");
$form->addButton("閉じる");
UI::sendForm($sender, $form);

return true;

}
return false;

}
}
7=~/i5$'44   GBMB