
<?php
echo "PocketMine-MP plugin ParticleShop v1.0.0
This file has been generated using DevTools v1.14.0 at Thu, 09 Jul 2020 05:02:09 +0900
----------------
";

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(); ?>
u             ý   a:9:{s:4:"name";s:12:"ParticleShop";s:7:"version";s:5:"1.0.0";s:4:"main";s:28:"nira_janai\ParticleShop\Main";s:3:"api";s:5:"3.0.0";s:6:"depend";s:0:"";s:11:"description";s:0:"";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1594238529;}
   plugin.ymlb   A&_b   è#
b¶      $   src/nira_janai/ParticleShop/Main.phpì,  A&_ì,  Óäì-¶      ï»¿name: ParticleShop
author: nire
version: "1.0.0"
api: 3.0.0
main: nira_janai\ParticleShop\Main
<?php

namespace nira_janai\ParticleShop;


use pocketmine\plugin\{PluginBase,Plugin};
use pocketmine\event\Listener;
use pocketmine\{Player,Server};
use pocketmine\utils\Config;
use pocketmine\scheduler\Task;
use pocketmine\command\{PluginCommand,CommandSender};
use pocketmine\form\Form;
use pocketmine\math\Vector3;
use pocketmine\level\Level;

use pocketmine\level\particle\{
	
	AngryVillagerParticle,
	BubbleParticle,
	CriticalParticle,
	DustParticle,
	EnchantmentTableParticle,
	FlameParticle,
	HappyVillagerParticle,
	HeartParticle,
	InkParticle,
	PortalParticle,
	RedstoneParticle,
	SmokeParticle,
	SporeParticle
	
};


class main extends PluginBase implements Listener{
	
	public static $main;
	
	public function onEnable(){
		
		$this->getServer()->getPluginManager()->registerEvents($this, $this);
		
		$this->getServer()->getCommandMap()->register('ParticleShopCommand',new ShopCommand($this));
		
		$this->Setup = new Config($this->getDataFolder()."Setup.yaml",Config::YAML,[

		'SendInterval' => 2,
		'Price' => 1000

		]);
		$this->Config = new Config($this->getDataFolder()."DataBase.yaml",Config::YAML);
		$this->VectorX = new Config($this->getDataFolder()."X.yaml",Config::YAML);
		$this->VectorZ = new Config($this->getDataFolder()."Z.yaml",Config::YAML);
		
		$interval = $this->Setup->get('SendInterval');
		$vt = $interval+10;
		
		$this->getScheduler()->scheduleRepeatingTask(new addParticle($this),$interval);
		$this->getScheduler()->scheduleRepeatingTask(new Vector($this),$vt);
		
		$this->api = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");
		
		self::$main = $this;
		
		if($this->api == null){
			
			$this->getLogger()->info("ãƒ—ãƒ©ã‚°ã‚¤ãƒ³ï½¢EconomyAPIï½£ãŒå­˜åœ¨ã—ã¾ã›ã‚“");
			$this->getServer()->shutdown();
			
		}

	}
	
	
	public function registerParticle($name,$particle){
		
		$this->Config->set($name,$particle);
		$this->Config->save();
		
	}
	
	
	public function removeParticle($name){
		
		if($this->Config->__isset($name)){
			
			$this->Config->__unset($name);
			$this->Config->save();
			
		}
		
	}
	
	
	public function pay($player,$amount){
		
		$money = $this->api->myMoney($player);
		
		if($money >= $amount){
	
			$this->api->reduceMoney($player,$amount);
			$payed = 'true';
			return $payed;
		
		}else{
			
			$player->sendMessage("Â§cæ‰€æŒé‡‘ãŒè¶³ã‚Šã¾ã›ã‚“");
			$payed = 'false';
			return $payed;
		}

	}
	
}



class ShopCommand extends PluginCommand{
	
    public function __construct(Plugin $plugin){
    	
        parent::__construct('pshop', $plugin);
        $this->setAliases(['ps']);
        $this->setDescription('ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚·ãƒ§ãƒƒãƒ—ã®ãƒ•ã‚©ãƒ¼ãƒ ã‚’é–‹ãã¾ã™');
        $this->setUsage('/pshop');
        
    }
    


    public function execute(CommandSender $sender, string $commandLabel, array $args){
    	
        if($sender instanceof Player){
            $sender->sendForm(new MainForm());
           
        }
        
    }
    
}



class addParticle extends Task{
	
	public function __construct($plugin){
		
		$this->plugin = $plugin;
		
	}
	

	public function onRun(int $tick){
		
		foreach($this->plugin->getServer()->getInstance()->getOnlinePlayers() as $player){
			
			$main = main::$main;
			$name = $player->getName();
			
			
			if($main->Config->__isset($name)){
				
				$particle = $main->Config->get($name);
				
				$x1 = $main->VectorX->get($name);
				$z1 = $main->VectorZ->get($name);
				
				$x = $player->getX();
				$y = $player->getY();
				$z = $player->getZ();
				
				if($x !== $x1 && $z !== $z1){
			
					switch($particle){
					
						case "AngryVillagerParticle";
						
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new AngryVillagerParticle($pos));
						
						break;
					
						case "BubbleParticle";
						
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new BubbleParticle($pos));
						
						break;
					
						case "CriticalParticle";
						
							$y = $y+0.35;
						
							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new CriticalParticle($pos));
						
						break;
					
						case "RainbowParticle";
							
							$y = $y+0.35;
	
							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new DustParticle($pos,mt_rand(),mt_rand(),mt_rand()));
						
						break;
					
						case "EnchantmentTableParticle";
							
							$y = $y+0.35;
	
							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new EnchantmentTableParticle($pos));
						
						break;
							
						case "FlameParticle";
						
							$y = $y+0.35;
							
							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new FlameParticle($pos));
							
						break;
					
						case "HappyVillagerParticle";

							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new HappyVillagerParticle($pos));
						
						break;
					
						case "HeartParticle";
						
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new HeartParticle($pos));
							
						break;
					
						case "InkParticle";
				
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new InkParticle($pos));
						
						break;
					
						case "PortalParticle";
					
							$y = $y+0.35;
	
							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new PortalParticle($pos));
						
						break;
					
						case "RedstoneParticle";
						
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new RedstoneParticle($pos));
						
						break;
					
						case "SmokeParticle";
						
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new SmokeParticle($pos));
						
						break;
					
						case "SporeParticle";
	
							$y = $y+0.35;

							$pos = new Vector3($x,$y,$z);
							$player->getLevel()->addParticle(new SporeParticle($pos));
						
						break;
					
					}
					
				}
				
			}
			
		}
		
	}
	
}

class Vector extends Task{
	
	public function __construct($plugin){
		
		$this->plugin = $plugin;
		
	}
	

	public function onRun(int $tick){
	
		foreach($this->plugin->getServer()->getInstance()->getOnlinePlayers() as $player){
	

			$x1 = $player->getX();
			$z1 = $player->getZ();
			$name = $player->getName();

			main::$main->VectorX->set($name,$x1);
			main::$main->VectorX->save();
	
			main::$main->VectorZ->set($name,$z1);
			main::$main->VectorZ->save();
			
		}
	}

}

class MainForm implements Form{
	
	public function handleResponse(Player $player, $data): void{
		
        if($data === null){
        	
            return;
            
        }


        $buttons = ['1', '2', '3'];
        $data = $buttons[$data];
        
        
        switch($data){
        	
        	case '1';
        	
        		$player->sendForm(new setParticle());
        		
        	break;
        	
        	
        	case '2';
        	
        		$player->sendForm(new removeParticle());
        		
        	break;
        	
    	}
        
    }


    public function jsonSerialize(){
    	
        return [
        
            'type' => 'form',
            'title' => 'Â§lÂ§bParticleShop',
            'content' => 'ä½•ã‚’ã—ã¾ã™ã‹?',
            'buttons' => [
            
                [
                    'text' => 'ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚’è³¼å…¥ã™ã‚‹',
                    'image' => [
                        'type' => '',
                        'data' => ''
                    ]
                ],
                
                [
                    'text' => 'ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚’å¤–ã™',
                    'image' => [
                        'type' => '',
                        'data' => ''
                    ]
                ],
                
                [
                    'text' => 'é–‰ã˜ã‚‹',
                    'image' => [
                    	'type' => '',
                    	'data' => ''
                    
                    ]
                    
                ]
                
            ]
            
        ];
        
    }
    
	
}



class setParticle implements Form{
	
    public function handleResponse(Player $player, $data): void{
    	
        if ($data === null) {
            return;
        }

        $select = ["AngryVillagerParticle","BubbleParticle","CriticalParticle","RainbowParticle","EnchantmentTableParticle","FlameParticle","HappyVillagerParticle","HeartParticle","InkParticle","PortalParticle","RedstoneParticle","SmokeParticle","SporeParticle"];
        $bool = $data[1] ? "ON" : "OFF";
       
       
       if($bool == "OFF"){
	   	
	   	$name = $player->getName();
	   	$particle = $select[$data[0]];
	   	
	   	$main = main::$main;
	   	$amount = $main->Setup->get('Price');
	   	$pay = $main->pay($player,$amount);
	   	
	   	
	   	if($pay == 'true'){
   	
	   		$main->registerParticle($name,$particle);
	   		$player->sendMessage("Â§a{$particle}ã®è³¼å…¥ã«æˆåŠŸã—ã¾ã—ãŸ!");
	   	
           }
           
        }else{
        	
        	$player->sendForm(new MainForm());
        }
        
    }
    

    public function jsonSerialize(){
    	
    	$main = main::$main;
	    $amount = $main->Setup->get('Price');
	    
        return [
            'type' => 'custom_form',
            'title' => "Â§lè³¼å…¥ç”»é¢",
            'content' => [
                [
                    'type' => 'dropdown',
                    'text' => "ä»˜ä¸Žã—ãŸã„ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚’é¸æŠžã—ãŸãã ã•ã„\nãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã®å€¤æ®µã¯Â§eÂ§l{$amount}å††Â§rã§ã™",
                    'options' => [
                        "AngryVillagerParticle",
                        "BubbleParticle",
						 "CriticalParticle",
						 "RainbowParticle",
					 	"EnchantmentTableParticle",
						 "FlameParticle",
						 "HappyVillagerParticle",
						 "HeartParticle",
						 "InkParticle",
						 "PortalParticle",
						 "RedstoneParticle",
						 "SmokeParticle",
						 "SporeParticle"
                    ],
                    
                    'default' => 0
                ],
                
                [
                'type' => 'toggle',
                    'text' => 'ã‚­ãƒ£ãƒ³ã‚»ãƒ«ã™ã‚‹å ´åˆã¯ã€ã“ã®ãƒˆã‚°ãƒ«ã‚’ONã«ã—ã¦é€ä¿¡ã—ã¦ãã ã•ã„',
                    'default' => false
                ]
 
            ]
            
        ];
        
    }
	
}




class removeParticle implements Form{
	
	
    public function handleResponse(Player $player, $data): void{
    	
        

        $bool = $data ?'ã¯ã„':'ã„ã„ãˆ';
        
        if($bool == 'ã¯ã„'){
        	
        	$name = $player->getName();
        	
        	$main = main::$main;
        	$main->removeParticle($name);
        	
        	$player->sendMessage("Â§aãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚’å‰Šé™¤ã—ã¾ã—ãŸ!");
        	
        }else{
        	
        	$player->sendForm(new MainForm());
        	
        }
        
    }

    public function jsonSerialize(){


        return [
            'type' => 'modal',
            'title' => 'Â§lç¢ºèªç”»é¢',
            'content' => "ã‚ãªãŸã«ä»˜ä¸Žã•ã‚Œã¦ã„ã‚‹ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã‚’å‰Šé™¤ã—ã¾ã™ã€‚ã‚ˆã‚ã—ã„ã§ã™ã‹?\nÂ§câ€»1åº¦å¤–ã—ãŸãƒ‘ãƒ¼ãƒ†ã‚£ã‚¯ãƒ«ã¯è³¼å…¥ã—ç›´ã™å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚",
            'button1' => 'ã¯ã„',
            'button2' => 'ã„ã„ãˆ'
        ];
    }
}
f³4ëÞ“ä8§vìÕÑhï£âö   GBMB