
<?php
echo "PocketMine-MP plugin CommandRepeater v1.0.0
This file has been generated using DevTools v1.14.0 at Thu, 30 Jul 2020 03:24:03 +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(); ?>
             ÿ   a:9:{s:4:"name";s:15:"CommandRepeater";s:7:"version";s:5:"1.0.0";s:4:"main";s:27:"nira_janai\CmdRepeater\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:1596047043;}
   plugin.ymld   þ!_d   ׉Úl¶      *   src/nira_janai/CmdRepeater/task/Repeat.phpK
  þ!_K
  ša¹�¶      /   src/nira_janai/CmdRepeater/form/CommandList.phpU  þ!_U  p=1›¶      ,   src/nira_janai/CmdRepeater/form/MainForm.php¦  þ!_¦  ž�Fc¶      *   src/nira_janai/CmdRepeater/form/Remove.phpL  þ!_L  /܄¶      '   src/nira_janai/CmdRepeater/form/Set.php?  þ!_?  ìGÊá¶      )   src/nira_janai/CmdRepeater/command/rc.php.  þ!_.  [އ4¶      #   src/nira_janai/CmdRepeater/Main.php0  þ!_0  £~¨j¶      ﻿name: CommandRepeater
author: nire
version: "1.0.0"
api: 3.0.0
main: nira_janai\CmdRepeater\Main
<?php

namespace nira_janai\CmdRepeater\task;


use pocketmine\plugin\PluginBase;
use pocketmine\scheduler\Task;
use pocketmine\{Server,Player};
use pocketmine\command\ConsoleCommandSender;

use nira_janai\CmdRepeater\Main;





class Repeat extends Task{
	
	private static $a = 0;
	private static $b = 0;
	private static $c = 0;
	private static $d = 0;
	private static $e = 0;
	private static $f = 0;
	private static $g = 0;
	private static $h = 0;
	private static $i = 0;
	private static $j = 0;
	private static $can = false;
	
	
	
	public function onRun(int $tick){
		
		self::$a++;
		self::$b++;
		self::$c++;
		self::$d++;
		self::$e++;
		self::$f++;
		self::$g++;
		self::$h++;
		self::$i++;
		self::$j++;
		
		
		if(Main::$instance->DB->__isset(self::$a)){
			
			$commands = Main::$instance->DB->get(1);
			self::$a = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$b) and self::$b === 10){
		
			$commands = Main::$instance->DB->get(10);
			self::$b = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$c) and self::$c === 30){
		
			$commands = Main::$instance->DB->get(30);
			self::$c = 0;
			self::$can = true;
			
		}
		
			
		if(Main::$instance->DB->__isset(self::$d) and self::$d === 60){
			
			
			$commands = Main::$instance->DB->get(60);
			self::$d = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$e) and self::$e === 300){
		
			$commands = Main::$instance->DB->get(300);
			self::$e = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$f) and self::$f === 600){
		
			$commands = Main::$instance->DB->get(600);
			self::$f = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$g) and self::$g === 900){
		
			$commands = Main::$instance->DB->get(900);
			self::$g = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$h) and self::$h === 1800){
		
			$commands = Main::$instance->DB->get(1800);
			self::$h = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$i) and self::$i === 6000){
		
			$commands = Main::$instance->DB->get(6000);
			self::$i = 0;
			self::$can = true;
			
		}
		
		
		if(Main::$instance->DB->__isset(self::$j) and self::$j === 144000){
		
			$commands = Main::$instance->DB->get(144000);
			self::$j = 0;
			self::$can = true;
			
		}
		
		
		if(self::$can === true){
			
			foreach((array)$commands as $command){
				
				$sender = new ConsoleCommandSender();
				Server::getInstance()->dispatchCommand($sender,$command);
				
			}
			
			self::$can = false;
			
		}
		
	}
	
}


<?php

namespace nira_janai\CmdRepeater\form;


use pocketmine\form\Form;
use pocketmine\{Server,Player};

use nira_janai\CmdRepeater\Main;
use nira_janai\CmdRepeater\form\MainForm;





class CommandList implements Form{

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

		$player->sendForm(new MainForm());
        
    }



    public function jsonSerialize(){
    	
    	$main = Main::$instance;
    	$comment = $main->getComment();
    	
    	
        return [
        
            'type' => 'form',
            'title' => '§lRepeatCommandList',
            'content' => "{$comment}",
            'buttons' => [
                
                ['text' =>' 閉じる']
                
            ]
            
        ];
        
    }
    
}
<?php

namespace nira_janai\CmdRepeater\form;


use pocketmine\form\Form;
use pocketmine\{Server,Player};

use nira_janai\CmdRepeater\form\{
    Set,
    Remove,
    CommandList
};




class MainForm implements Form{

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


        $buttons = [1, 2, 3, 4];
        $data = $buttons[$data];
        
        
        switch($data){
        	
        	case 1;
        	
        		$player->sendForm(new Set());
        		
        	break;
        	
        	case 2;
        	
        		$player->sendForm(new Remove());
        		
        	break;
        	
        	case 3;
        	
        		$player->sendForm(new CommandList());
        	
        	break;
        	
    	}
        
    }



    public function jsonSerialize(){
    	
        return [
        
            'type' => 'form',
            'title' => '§lCommandRepeater',
            'content' => '何をしますか?',
            'buttons' => [
            
                ['text' => 'リピートコマンドを追加する'],
                
                ['text' => 'リピートコマンドを削除する'],
                
                ['text' => 'リピートコマンド一覧を見る'],
                
                ['text' =>' 閉じる']
                
            ]
            
        ];
        
    }
    
}
<?php

namespace nira_janai\CmdRepeater\form;


use pocketmine\form\Form;
use pocketmine\{Server,Player};

use nira_janai\CmdRepeater\Main;
use nira_janai\CmdRepeater\form\MainForm;






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

        $time = Main::$select[$data[1]];
        $main = Main::$instance;
        
       
       if(!$data[2]){
	   	
	   	if($main->issetRepeatCommand($time, $data[0])){
   			
	   		$main->removeRepeatCommand($time, $data[0]);
	  	 	$player->sendMessage("§l§aリピートコマンド「{$data[0]}」を削除しました");
	   	
	   	}else{
   			
   			$player->sendMessage("§l§c該当のコマンドが存在しません");
   			
   		}
           
        }else{
        	
        	$player->sendForm(new MainForm());
        	
        }
        
    }
    
    

    public function jsonSerialize(){
	    
        return [
       
            'type' => 'custom_form',
            'title' => "§l削除画面",
            'content' => [
            
            	['type' => 'input',
            	 'text' => "ここに削除したいリピートコマンドを入力してください\n/はいりません",
            	 'placeholder' => "say hello"],
            
                
                ['type' => 'dropdown',
                 'text' => "削除するコマンドの送信間隔を選択してください",
                 'options' => Main::$times,
                 'default' => 5],
                
                
                ['type' => 'toggle',
                 'text' => 'キャンセルする場合は、このトグルをONにして送信してください',
                 'default' => false]
 
            ]
            
        ];
        
    }
	
}

<?php

namespace nira_janai\CmdRepeater\form;


use pocketmine\form\Form;
use pocketmine\{Server,Player};

use nira_janai\CmdRepeater\Main;
use nira_janai\CmdRepeater\form\MainForm;





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

        $time = Main::$select[$data[1]];
        $main = Main::$instance;
       
       
       if(!$data[2]){
	   	
	   	$main->registerRepeatCommand($time, $data[0]);
	   	
	   	if($main->issetCommand($data[0])){
   		
	   		$player->sendMessage("§l§a「{$data[0]}」をリピートコマンドに追加しました");
	   		
	   	}else{
   			
   			$player->sendMessage("§l§c「{$data[0]}」はコマンドとして実行できません");
   			
   		}
          
          
        }else{
        	
        	$player->sendForm(new MainForm());
        	
        }
        
    }
    
    

    public function jsonSerialize(){
	    
        return [
       
            'type' => 'custom_form',
            'title' => "§l追加画面",
            'content' => [
            
            	['type' => 'input',
            	 'text' => "ここにリピートしたいコマンドを入力してください\n/はいりません",
            	 'placeholder' => "say hello"],
            
                
                ['type' => 'dropdown',
                 'text' => "実行間隔を選択してください",
                 'options' => Main::$times,
                 'default' => 5],
                
                
                ['type' => 'toggle',
                 'text' => 'キャンセルする場合は、このトグルをONにして送信してください',
                 'default' => false]
 
            ]
            
        ];
        
    }
	
}
<?php

namespace nira_janai\CmdRepeater\command;


use pocketmine\plugin\Plugin;
use pocketmine\command\{CommandSender,PluginCommand};
use pocketmine\{Server,Player};

use nira_janai\CmdRepeater\form\MainForm;


class rc extends PluginCommand{
	
    public function __construct(Plugin $plugin){
    	
        parent::__construct('rc', $plugin);
        $this->setAliases(['rc']);
        $this->setDescription('リピートコマンドのフォームです');
        $this->setUsage('/rc');
        
    }
    


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

namespace nira_janai\CmdRepeater;


use pocketmine\plugin\PluginBase;
use pocketmine\{Server,Player};
use pocketmine\utils\Config;
use pocketmine\event\Listener;

use nira_janai\CmdRepeater\command\rc;
use nira_janai\CmdRepeater\task\Repeat;



class Main extends PluginBase implements Listener{
	
	public static $instance;
	public static $select = [1, 10, 30, 60, 300, 600, 900, 1800, 6000, 144000];
	public static $times = ["1秒間隔", "10秒間隔", "30秒間隔", "1分間隔", "5分間隔", "10分間隔", "15分間隔", "30分間隔", "1時間間隔", "24時間間隔"];
	
	
	public function onEnable(){
		
		self::$instance = $this;
		
		$this->getServer()->getPluginManager()->registerEvents($this,$this);
		$this->getScheduler()->scheduleRepeatingTask(new Repeat($this), 20);
		
		$this->getServer()->getCommandMap()->register('addRepeatCommand',new rc($this));
		$this->DB = new Config($this->getDataFolder()."Database.yaml",Config::YAML);
		
	}


	
	public function getRepeatCommands(int $time):array{
		
		$commands = [];
		
		
		foreach((array)$this->DB->getAll($time) as $value){
			
			$commands[] = $value;
			
		}
		
		return $commands;
		
	}
	
	
	
	public function registerRepeatCommand(int $time, string $command):bool{
		
		if($this->issetCommand($command)){
			
			$commands = $this->DB->get($time);
			$commands[] = $command;
			
			$this->DB->set($time,$commands);
			$this->DB->save();
			
			return true;
			
			
		}else{
			
			return false;
			
		}
		
	}
	
	
	
	public function removeRepeatCommand(int $time, string $command){
		
		$data = $this->DB->get($time);
		
		
		if(in_array($command,$data,true)){
			
			$commands = array_diff($data,[$command]);
			$commands = array_values($commands);
			
			$this->DB->set($time,$commands);
			$this->DB->save();
			
		}
		
	}
	
	
	
	public function issetCommand(string $command):bool{
		
		$command = strstr((string)$command, " ", true);
		return Server::getInstance()->getCommandMap()->getCommand($command) !== null;
		
	}
	
	

	public function issetRepeatCommand(int $time, string $command):bool{
		
		return in_array($command, (array)$this->DB->get($time), true);
		
	}
	
	
	
	public function getComment(){
		
		$comment = "§l§f《§bリピートコマンド一覧§f》§r";
		$i = 0;
		$t = self::$times;
		
		
		foreach(self::$select as $time){
			
			$comment .= "\n\n§s§l【{$t[$i]}】§r";
			$i ++;
			
			
			if($this->DB->__isset($time)){
				
				$commands = $this->DB->get($time);
				
				
				if(!empty($commands)){
					
			
					foreach((array)$commands as $command){
				
						$comment .= "\n ・/{$command}";
					
					}
				
				}else{
					
					$comment .= "\n リピートコマンドが存在しません";
	
				}
				
			}else{
				
				$comment .= "\n リピートコマンドが存在しません";
				
			}
			
		}
		
		return $comment;
	
	}
	
}
`{ê˹›ƒ3@TvŽ�")3   GBMB