
<?php
echo "PocketMine-MP plugin Voting v0.0.1
This file has been generated using DevTools v1.13.0 at Tue, 09 Jul 2019 17:27:30 +0930
----------------
";

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:6:"Voting";s:7:"version";s:5:"0.0.1";s:4:"main";s:19:"tatchan\Voting\Main";s:3:"api";s:5:"3.8.5";s:6:"depend";s:0:"";s:11:"description";s:0:"";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1562659050;}
   plugin.ymlÑ  êH$]Ñ  <ôq¶         src/tatchan/Voting/Main.phpê  êH$]ê  ”$P¶      #Name of your plugin. This is self-explanatory. Plugin names SHOULD NOT contain spaces.
name: Voting

#Fully-qualified class-name of your plugin's main class. This is usually the one that extends PluginBase.
#Since PocketMine-MP's autoloader is PSR-0, your plugin's main-class namespace will usually be the same as the folder path.
main: tatchan\Voting\Main

#Version name/number of your plugin
version: 0.0.1

#API version that your plugin supports. If your plugin's API is not compatible with that of the server, the server will refuse to load your plugin.
#The API version is changed when:
# - Breaking changes are made to a development version, things that might cause your plugin to crash.
#     This is denoted by an API suffix, for example 3.0.0-ALPHA4. If the version does not match as a whole on a development version, the plugin will not be loaded. (Suffixes are non-case-sensitive.)
# - Breaking changes are made to a release version, things that might cause your plugin to crash.
#     This usually warrants a major API bump, e.g. 2.0.0 -> 3.0.0. If the major version does not match, the plugin will not be loaded.
# - Feature additions which do not break existing plugins.
#     This is denoted by a minor API bump, e.g. 2.0.0 -> 2.1.0. The server will load plugins with an equivalent or older minor version.
# - Minor bug fixes or insignificant alterations to the API.
#     This is denoted by a patch bump, e.g. 1.13.0 -> 1.13.1
api: 3.8.5

#When to load the plugin. There are currently two options for this: STARTUP and POSTWORLD. Usually POSTWORLD will do fine.
load: POSTWORLD

#Name of the person who wrote the plugin. This can be anything you like.
author: tatchan

#Simple description of what the plugin is or does. Try to keep this short.oved if your plugin will not have any commands.
commands:

 vote:
  #Description to show in the Help command
  default: true
  description: "æŠ•ç¥¨ã™ã‚‹ãŸã‚ã®formã‚’å‡ºã™ã‚ˆ"
  #Usage message shown to the user if they type the command in incorrectly.
 setvote:
  default: false
  description: "æŠ•ç¥¨ã‚’ã‚»ãƒƒãƒˆã™ã‚‹ãŸã‚ã®formã‚’å‡ºã™ã‚ˆ"
  
 vlist:
  default: false
  description: "æŠ•ç¥¨ã®çŠ¶æ…‹ã‚’å‡ºã™ã‚ˆ"

 reset:
  default: false
  description: "æŠ•ç¥¨ã‚’ãƒªã‚»ãƒƒãƒˆã™ã‚‹ã‚ˆ"
<?php


namespace tatchan\Voting;
use Frago9876543210\EasyForms\forms\CustomFormResponse;
use pocketmine\utils\Config;
use Frago9876543210\EasyForms\forms\ModalForm;
use Frago9876543210\EasyForms\forms\MenuForm;
use Frago9876543210\EasyForms\forms\CustomForm;
use pocketmine\plugin\PluginBase;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
use pocketmine\event\server\DataPacketReceiveEvent;
use Frago9876543210\EasyForms\elements\Button;
use Frago9876543210\EasyForms\elements\Image;
use Frago9876543210\EasyForms\elements\Dropdown;
use Frago9876543210\EasyForms\elements\Input;
use Frago9876543210\EasyForms\elements\Slider;
use Frago9876543210\EasyForms\elements\Toggle;
use pocketmine\Player;
use Frago9876543210\EasyForms\elements\Label;
use Frago9876543210\EasyForms\elements\StepSlider;
use Frago9876543210\EasyForms\elements\GameMode;
class Main extends PluginBase{

	public function onEnable() : void{
		$this->formId = 00001;
		$this->getLogger()->info("Hello World!");

//ã‚­ãƒ¼ãŒè¨­å®šã•ã‚Œã¦ã„ã‚‹Configã®ä½œæˆ
$this->list = new Config($this->getDataFolder() . "list.yml", Config::YAML);

$this->player = new Config($this->getDataFolder() . "player.yml", Config::YAML);

$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array(
'ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1' => 'name',
'ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2' => 'name',
'ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3' => 'name',
'ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4' => 'name',
'ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5' => 'name',
'çŠ¶æ…‹' => 'true of false',
));
}

	public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{
		switch($command->getName()){
case "setvote":
$player = $sender;
$sender->sendForm(new CustomForm("Â§eï½žï½žï½žæŠ•ç¥¨ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ—ï½žï½žï½ž",
	[	
		new Input("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1", $this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1")),
		new Input("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2", $this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2")),
		new Input("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3", $this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3")),
		new Input("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4", $this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4")),
		new Input("ãƒ—ãƒ¬ã‚¤ãƒ¤5", $this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5")),
		new Toggle("æŠ•ç¥¨çŠ¶æ…‹", $this->config->get("çŠ¶æ…‹")),
	],
	function(Player $player, CustomFormResponse $response) : void{
		list($player1, $player2, $player3, $player4,$player5,$enableCreative) = $response->getValues();
		$this->config->set("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1",$player1);
		$this->config->set("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2",$player2);
		$this->config->set("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3",$player3);
		$this->config->set("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4",$player4);
		$this->config->set("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5",$player5);
		$enableCreative ? $this->config->set("çŠ¶æ…‹",true) : $this->config->set("çŠ¶æ…‹",false);


	}
));
return true;

case "vlist":
	$data = [
           "type" => "custom_form",
           "title" => "Â§aï½žï½žï½žæŠ•ç¥¨çµæžœï½žï½žï½ž",
           "content" => [
           	[
           	"type" => "label",
           	"text" => "
{$this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1")}:{$this->list->get($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1"))}
{$this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2")}:{$this->list->get($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2"))}
{$this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3")}:{$this->list->get($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3"))}
{$this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4")}:{$this->list->get($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4"))}
{$this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5")}:{$this->list->get($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5"))}"

           ],
       ]
          
    ];

    $pk = new ModalFormRequestPacket();
    $pk->formId = $this->formId;
    $pk->formData = json_encode($data);
    $sender->dataPacket($pk);
				return true;
case "reset":

$this->config->set("çŠ¶æ…‹", false);
$all = $this->list->getAll(true);
$all2 = $this->player->getALL(true);

foreach($all as $key){ 
$this->list->remove($key); 
$this->list->save(); 
}

foreach($all2 as $key){ 
$this->player->remove($key); 
$this->player->save(); 
}
$sender->sendMessage("æŠ•ç¥¨ã‚’ãƒªã‚»ãƒƒãƒˆã—ã¾ã—ãŸ");
return true;
			case "vote":
			if($this->config->get("çŠ¶æ…‹") == "ture"){
				$name = $sender->getPlayer()->getName();
    if(!$this->player->exists($name)){
    	  $this->player->set($name,true);
        $this->player->save();
			$player = $sender;
$sender->sendForm(new MenuForm(
	"Â§aï½žï½žï½žæŠ•ç¥¨ãƒ•ã‚©ãƒ¼ãƒ ï½žï½žï½ž", "Â§cæŠ•ç¥¨ã—ãŸã„äººã‚’é¸ã‚“ã§ã­", [new Button($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼1")), new Button($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼2")), new Button($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼3")),new Button($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼4")), new Button($this->config->get("ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼5"))], 
	function(Player $player, Button $selected) : void{
		$player->sendMessage($selected->getText() . "ã«æŠ•ç¥¨ã—ã¾ã—ãŸ");
$text = $selected->getText();
 if(!$this->list->exists($text)){
    	  $this->list->set($text,1);
        $this->list->save();
}else{
	  $this->list->set($text,$this->list->get($text) + 1);
        $this->list->save();
}
}
));
return true;
}else{
$sender->sendMessage("Â§eã‚ãªãŸã¯ã‚‚ã†æŠ•ç¥¨æ¸ˆã¿ã§ã™");
return true;
}
}else{
$sender->sendMessage("Â§cæŠ•ç¥¨ã‚’é–‹å§‹ã—ã¦ã„ã¾ã›ã‚“");
return true;
}

}
}

	public function onDisable() : void{
		$this->getLogger()->info("æŠ•ç¥¨PLã‚’çµ‚äº†ã—ã¾ã™");
	}
}
J‚­´†§êã‚Yæñ.||E   GBMB