
<?php
echo "PocketMine-MP plugin ChatLog v1.0.0
This file has been generated using DevTools v1.13.0 at Sun, 01 Sep 2019 14:20:54 +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(); ?>
Y                a:9:{s:4:"name";s:7:"ChatLog";s:7:"version";s:5:"1.0.0";s:4:"main";s:12:"ChatLog\Main";s:3:"api";a:1:{i:0;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:1567315254;}
   plugin.yml   6Uk]   d         src/ChatLog/Main.phpb
  6Uk]b
  ࿶      name: ChatLog
main: ChatLog\Main
version: 1.0.0
api: [3.0.0]
load: POSTWORLD
commands:
 chatlog:
  description: チャットのログを見ます
<?php

namespace ChatLog;

use pocketmine\Player;
use pocketmine\Plugin\PluginBase;
use pocketmine\Server;
use pocketmine\event\Listener;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\utils\TextFormat;
use pocketmine\utils\Config;

class Main extends PluginBase implements Listener{

	public function onEnable () {

		if(!file_exists($this->getDataFolder())){
		mkdir($this->getDataFolder(), 0744, true);
		}
	$this->getServer()->getPluginManager()->registerEvents($this, $this);
	$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML,array("max-chats"=>50,"time_zone"=>"Asia/Tokyo"));
	date_default_timezone_set($this->config->get("time_zone"));
	}
	
	private $count = [];
	private $chats = [];

	public function onChat(PlayerCommandPreprocessEvent $event){

	$player = $event->getPlayer();
	$user = $player->getName();
	$mes = $event->getMessage();
	$time = date("H:i:s");
	$com = explode(" ",$mes);
	if(count($this->chats) == $this->config->get("max-chats")+1) array_shift($this->chats);
		if(substr($mes,0,1) == "/"){
			switch($com[0]){
			case "/say";
			$mes = str_replace("/say ","",$mes);
			$this->chats[] = ["name"=>"§d[{$user}]","mes"=>$mes,"time"=>$time];
			break;
			case "/me";
			$mes = str_replace("/me ","",$mes);
			$this->chats[] = ["name"=>"* {$user}","mes"=>$mes,"time"=>$time];
			break;
			}
		return true;
		}
		$this->chats[] = ["name"=>"<{$user}>","mes"=>$mes,"time"=>$time];
	}

	public function onCommand(CommandSender $sender, Command $command, string $label, array $args):bool{
        
		if(!$sender instanceof Player) {
		$sender->sendMessage(">>§cこのコマンドはゲーム内で使ってください");
		return false;
        	}else{
			switch ($command->getName()) {
			case "chatlog":
			$chats = "";
			if(!empty($this->chats)){
				foreach($this->chats as $chat){
				$chats = $chats."\n[§a".$chat["time"]."§f] ".$chat["name"]." ".$chat["mes"]."§r§f"; 
				}
			}
			$this->sendForm($sender,"Chat Log",$chats,[],9242823);
			break;
			}
		}
	return true;
	}

	public function sendForm(Player $player, $title, $come, $buttons, $id) {
	$pk = new ModalFormRequestPacket(); 
	$pk->formId = $id;
	$data = [ 
	'type'    => 'form', 
	'title'   => $title, 
	'content' => $come, 
	'buttons' => $buttons
	]; 
	$pk->formData = json_encode( $data, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING | JSON_UNESCAPED_UNICODE );
	$player->dataPacket($pk);
	}
}{,:|8L)^]+ʠ   GBMB