
<?php
echo "PocketMine-MP plugin ReportSystem v1.1.0
This file has been generated using DevTools v1.13.0 at Sat, 04 Apr 2020 10:39:25 +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(); ?>
L               a:9:{s:4:"name";s:12:"ReportSystem";s:7:"version";s:5:"1.1.0";s:4:"main";s:21:"smo\ReportSystem\Main";s:3:"api";s:6:"3.11.6";s:6:"depend";s:0:"";s:11:"description";s:12:"ReportSystem";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1585964365;}
   plugin.ymlÓ   Må‡^Ó   ò”¶      /   src/smo/ReportSystem/command/CommandManager.phpB  Må‡^B  ;-¶      .   src/smo/ReportSystem/command/ReportCommand.php  Må‡^  ñ–¶      2   src/smo/ReportSystem/command/ReportlistCommand.php!  Må‡^!  þò|¶      &   src/smo/ReportSystem/ConfigManager.php-  Må‡^-  t¢ûU¶      &   src/smo/ReportSystem/EventListener.php  Må‡^  íf¶      -   src/smo/ReportSystem/form/CheckReportForm.phpÎ  Må‡^Î  "—(&¶      1   src/smo/ReportSystem/form/CheckReportListForm.php$  Må‡^$  Éž^|¶      2   src/smo/ReportSystem/form/RemoveReportListForm.phpP  Må‡^P  ‘‡¸^¶      (   src/smo/ReportSystem/form/ReportForm.phpb  Må‡^b  ¤zR¶      ,   src/smo/ReportSystem/form/ReportlistForm.phpp  Må‡^p  *¾’¶         src/smo/ReportSystem/Main.php  Må‡^  Ç@¶      name: ReportSystem

main: smo\ReportSystem\Main

version: 1.1.0

api: 3.11.6

load: POSTWORLD

author: smo

description: ReportSystem

permissions:
 
 report.guest:
  default: true

 reportlist.op:
  default: op<?php

declare(strict_types=1);

namespace smo\ReportSystem\command;

class CommandManager{

	public function __construct($plugin){

		$plugin->getServer()->getCommandMap()->register("report", new ReportCommand());
		$plugin->getServer()->getCommandMap()->register("reportlist", new ReportlistCommand());
	}
}<?php

declare(strict_types=1);

namespace smo\ReportSystem\command;

use pocketmine\command\{Command, CommandSender};
use pocketmine\Player;

use smo\ReportSystem\form\ReportForm;

class ReportCommand extends Command{

	public function __construct(){

		parent::__construct("report", "ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼ã‚’ãƒ¬ãƒãƒ¼ãƒˆã—ã¾ã™", "/report");
		$this->setPermission("report.guest");
	}

	public function execute(CommandSender $sender, string $commandLabel, array $args){

		if(!$this->testPermission($sender)){
            return false;
        }

        if(!$sender instanceof Player){
        	$sender->sendMessage("Â§c[ReportSystem] >> ã‚²ãƒ¼ãƒ å†…ã§å®Ÿè¡Œã—ã¦ãã ã•ã„");
        	return;
        }

        $sender->sendForm(new ReportForm());
	}
}<?php

declare(strict_types=1);

namespace smo\ReportSystem\command;

use pocketmine\command\{Command, CommandSender};
use pocketmine\Player;

use smo\ReportSystem\form\ReportlistForm;

class ReportlistCommand extends Command{

	public function __construct(){

		parent::__construct("reportlist", "ãƒ¬ãƒãƒ¼ãƒˆã‚’ç¢ºèªã—ã¾ã™", "/reportlist");
		$this->setPermission("reportlist.op");
	}

	public function execute(CommandSender $sender, string $commandLabel, array $args){

		if(!$this->testPermission($sender)){
            return false;
        }

        if(!$sender instanceof Player){
        	$sender->sendMessage("Â§c[ReportSystem] >> ã‚²ãƒ¼ãƒ å†…ã§å®Ÿè¡Œã—ã¦ãã ã•ã„");
        	return;
        }

        $sender->sendForm(new ReportlistForm());
	}
}<?php

declare(strict_types=1);

namespace smo\ReportSystem;

use pocketmine\utils\Config;
use pocketmine\Player;
use pocketmine\Server;

class ConfigManager{

	private $config;
	private $plugin;
	private static $instance = null;

	public function __construct($plugin){

		$this->config = new Config($plugin->getDataFolder() . "Config.yml", Config::YAML,[

			"CanUseID" => 1
		]);
		$this->plugin = $plugin;
		self::$instance = $this;

		date_default_timezone_set("Asia/Tokyo");
	}

	public static function get(): self {

		return self::$instance;
	}

	public function saveConfig(): void {

		if($this->config === null) return;

		$this->config->save();
		$this->plugin->getLogger()->notice("Configã‚’ã‚»ãƒ¼ãƒ–ã—ã¾ã—ãŸ");
	}

	public function addReport(Player $sender, string $name, string $reason): void {

		$date = (new \DateTime())->format("Yå¹´næœˆjæ—¥ Gæ™‚iåˆ†sç§’");
		$id = $this->config->get("CanUseID");
		$this->config->set("CanUseID", $id + 1);

		$this->config->set($id,[

			"å ±å‘Šè€…" => $sender->getName(),
			"å¯¾è±¡è€…" => $name,
			"ç†ç”±" => $reason,
			"æ™‚é–“" => $date
		]);

		$sender->sendMessage("Â§a[ReportSystem] >> å ±å‘Šã—ã¾ã—ãŸã€‚ã‚ã‚ŠãŒã¨ã†ã”ã–ã„ã¾ã—ãŸã€‚");

		foreach(Server::getInstance()->getOnlinePlayers() as $p){
			if($p->isOp()){
				$p->sendMessage("Â§a[ReportSystem] >> æ–°ãŸãªãƒ¬ãƒãƒ¼ãƒˆãŒå±Šãã¾ã—ãŸã€‚ ID: ".$id);
			}
		}
	}

	public function removeReport(int $id, Player $sender): void {

		if(!$this->config->exists($id)){
			$sender->sendMessage("Â§c[ReportSystem] >> ID: ".$id." ã®ãƒ¬ãƒãƒ¼ãƒˆã¯å­˜åœ¨ã—ã¾ã›ã‚“");
			return;
		}

		$this->config->remove($id);
		$sender->sendMessage("Â§a[ReportSystem] >> ID: ".$id." ã®ãƒ¬ãƒãƒ¼ãƒˆã‚’å‰Šé™¤ã—ã¾ã—ãŸ");
	}

	public function getData(int $id): ?array {

		if(!$this->config->exists($id)){
			return null;
		}

		return $this->config->get($id);
	}

	public function getAll(): array {

		$all = $this->config->getAll();
		unset($all["CanUseID"]);

		return $all;
	}
}<?php

declare(strict_types=1);

namespace smo\ReportSystem;

use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;

use smo\ReportSystem\ConfigManager;

class EventListener implements Listener{

	public function onJoin(PlayerJoinEvent $event): void {

		$player = $event->getPlayer();
		$count = count(ConfigManager::get()->getAll());

		if($player->isOp()){
			$player->sendMessage("Â§a[ReportSystem] >> ".$count." ä»¶ã®æœªèª­ã®ãƒ¬ãƒãƒ¼ãƒˆãŒã‚ã‚Šã¾ã™");
		}
	}
}<?php

namespace smo\ReportSystem\form;

use pocketmine\form\Form;
use pocketmine\Player;

use smo\ReportSystem\ConfigManager;

class CheckReportForm implements Form{

    private $id;

    public function __construct(int $id){

         $this->id = $id;
    }

    public function handleResponse(Player $player, $data): void {

       return;
    }

    public function jsonSerialize(){

        $data = ConfigManager::get()->getData($this->id);
        $senderName = $data["å ±å‘Šè€…"];
        $name = $data["å¯¾è±¡è€…"];
        $reason = $data["ç†ç”±"];
        $date = $data["æ™‚é–“"];

        $content = "ID {$this->id} ã®ãƒ¬ãƒãƒ¼ãƒˆ:\n\nå ±å‘Šè€…: {$senderName} \nå¯¾è±¡è€…: {$name} \nç†ç”±: {$reason} \næ™‚é–“: {$date} \n\n";

        return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆç¢ºèª",
            "content" => $content,
            "buttons" => [["text" => "çµ‚äº†"]]
        ];
    }
}<?php

namespace smo\ReportSystem\form;

use pocketmine\form\Form;
use pocketmine\Player;

use smo\ReportSystem\ConfigManager;

class CheckReportListForm implements Form{

    private $button;
    private $list;

    private $isEmpty = false;

    public function __construct(){

         if(count(ConfigManager::get()->getAll()) === 0){
            $this->isEmpty = true;
            return;
        }

        foreach(ConfigManager::get()->getAll() as $id => $data){
            $this->button[] = ["text" => "ID: ". (string) $id];
            $this->list[] = $id;
        }
    }

    public function handleResponse(Player $player, $data): void {

        if ($data === null) {
            return;
        }

        $player->sendForm(new CheckReportForm( (int) $this->list[$data]));
    }

    public function jsonSerialize(){

        if($this->isEmpty){
            return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆç¢ºèª ä¸€è¦§",
            "content" => "ãƒ¬ãƒãƒ¼ãƒˆãŒã‚ã‚Šã¾ã›ã‚“",
            "buttons" => []
            ];
        }

        return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆç¢ºèª ä¸€è¦§",
            "content" => "",
            "buttons" => $this->button
        ];
    }
}<?php

namespace smo\ReportSystem\form;

use pocketmine\form\Form;
use pocketmine\Player;

use smo\ReportSystem\ConfigManager;

class RemoveReportListForm implements Form{

    private $button;
    private $list;

    private $isEmpty = false;

    public function __construct(){

        if(count(ConfigManager::get()->getAll()) === 0){
            $this->isEmpty = true;
            return;
        }

        foreach(ConfigManager::get()->getAll() as $id => $data){
            $this->button[] = ["text" => "ID: ". (string) $id];
            $this->list[] = $id;
        }
    }

    public function handleResponse(Player $player, $data): void {

        if($this->isEmpty) return;

        if ($data === null) {
            return;
        }

        ConfigManager::get()->removeReport((int) $this->list[$data], $player);

    }

    public function jsonSerialize(){

        if($this->isEmpty){
            return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆå‰Šé™¤ ä¸€è¦§",
            "content" => "ãƒ¬ãƒãƒ¼ãƒˆãŒã‚ã‚Šã¾ã›ã‚“",
            "buttons" => []
            ];
        }

        return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆå‰Šé™¤ ä¸€è¦§",
            "content" => "",
            "buttons" => $this->button
        ];
    }
}<?php

namespace smo\ReportSystem\form;

use pocketmine\form\Form;
use pocketmine\Player;

use smo\ReportSystem\ConfigManager;

class ReportForm implements Form{

    public function handleResponse(Player $player, $data): void {

        if ($data === null) {
            return;
        }

        if($data[0] === "" or $data[1] === "") return;

        ConfigManager::get()->addReport($player, $data[0], $data[1]);
    }

    public function jsonSerialize(){

        return [
            "type" => "custom_form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆ",
            "content" => [
                [
                    "type" => "input",
                    "text" => "ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼ã®åå‰",
                    "placeholder" => "ã“ã“ã«è¨˜å…¥",
                    "default" => ""
                ],

                [
                    "type" => "input",
                    "text" => "ãƒ¬ãƒãƒ¼ãƒˆç†ç”±",
                    "placeholder" => "ã“ã“ã«è¨˜å…¥",
                    "default" => ""
                ]
            ]
        ];
    }
}<?php

namespace smo\ReportSystem\form;

use pocketmine\form\Form;
use pocketmine\Player;

use smo\ReportSystem\ConfigManager;

class ReportlistForm implements Form{

    public function handleResponse(Player $player, $data): void {

        if ($data === null) {
            return;
        }

        switch ($data) {
        	case 0:

        	$player->sendForm(new CheckReportListForm());

        	break;

        	case 1:

        	$player->sendForm(new RemoveReportListForm());

        	break;
        }
    }

    public function jsonSerialize(){

        return [
            "type" => "form",
            "title" => "ãƒ¬ãƒãƒ¼ãƒˆç¢ºèª",
            "content" => "",
            "buttons" => [
                ["text" => "ãƒ¬ãƒãƒ¼ãƒˆç¢ºèª"],
                ["text" => "ãƒ¬ãƒãƒ¼ãƒˆå‰Šé™¤"]
            ]
        ];
    }
}<?php

declare(strict_types=1);

namespace smo\ReportSystem;

use pocketmine\plugin\PluginBase;

use smo\ReportSystem\command\CommandManager;

class Main extends PluginBase{

	public function onEnable(): void {

		$this->getLogger()->notice("ReportSystem ã‚’èª­ã¿è¾¼ã¿ã¾ã—ãŸ");
		(new ConfigManager($this));
		(new CommandManager($this));
		$this->getServer()->getPluginManager()->registerEvents(new EventListener(), $this);
	}

	public function onDisable(): void {

		ConfigManager::get()->saveConfig();
	}
}
Ä/ó{çÀ[)hâì¾"ZbÌ   GBMB