<?php echo "Altay plugin Timer v1.0.0\nThis file has been generated using Turanic at Sun, 05 Aug 2018 19:49:32 +0900.\n----------------\n";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:5:"Timer";s:7:"version";s:5:"1.0.0";s:4:"main";s:10:"Timer\Main";s:3:"api";a:3:{i:0;s:12:"3.0.0-ALPHA8";i:1;s:5:"3.0.0";i:2;s:5:"4.0.0";}s:6:"depend";a:0:{}s:11:"description";s:0:"";s:7:"authors";a:1:{i:0;s:11:"amane192386";}s:7:"website";s:0:"";s:12:"creationDate";i:1533466172;}
   plugin.yml¹   <Öf[¹   •e´›¶         src/Timer/CallbackTask.phpà  <Öf[à  &^¶         src/Timer/Main.php»  <Öf[»  °–†Ѷ      name: Timer
main: Timer\Main
version: 1.0.0
api: [3.0.0-ALPHA8,3.0.0,4.0.0]
author: amane192386
load: POSTWORLD
commands:
 timer:
  description: "タイマー設定コマンド"<?php
/*
 *
 *  ____            _        _   __  __ _                  __  __ ____
 * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \
 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
 * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/
 * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_|
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * @author PocketMine Team
 * @link http://www.pocketmine.net/
 *
 *
*/
declare(strict_types=1);
namespace Timer;
/**
 * Allows the creation of simple callbacks with extra data
 * The last parameter in the callback will be this object
 *
 * If you want to do a task in a Plugin, consider extending PluginTask to your needs
 *
 */
class CallbackTask extends \pocketmine\scheduler\Task{
	/** @var callable */
	protected $callable;
	/** @var array */
	protected $args;
	/**
	 * @param callable $callable
	 * @param array    $args
	 */
	public function __construct(callable $callable, array $args = []){
		$this->callable = $callable;
		$this->args = $args;
	}
	/**
	 * @return callable
	 */
	public function getCallable() : callable{
		return $this->callable;
	}
	public function onRun(int $currentTicks){
		$c = $this->callable;
		$args = $this->args;
		$c(...$args);
	}
}<?php

namespace Timer;

use pocketmine\Player;
use pocketmine\entity\Entitiy;
use pocketmine\entity\Skin;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
use pocketmine\network\mcpe\protocol\PlayerListPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
use pocketmine\utils\UUID;
use pocketmine\Server;
use pocketmine\block\Block;
use pocketmine\utils\Config;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
use pocketmine\command\Command;
use pocketmine\scheduler\PluginTask;
use pocketmine\command\CommandSender;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\player\PlayerPreLoginEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\entity\Effect;
use pocketmine\event\entity\EntityDamageByEntityEvent; 
use pocketmine\event\entity\EntityDamageEvent; 
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\event\player\PlayerDeathEvent;
use Timer\CallbackTask;
use pocketmine\math\Vector3;
use pocketmine\level\Position;
use pocketmine\entity\EffectInstance;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\level\particle\FloatingTextParticle;
use pocketmine\inventory\ArmorInventory;
use pocketmine\inventory\ArmorInventoryEvent;
use pocketmine\inventory\PlayerInventory;
use pocketmine\event\entity\EntityInventoryChangeEvent;
use pocketmine\event\server\DataPacketReceiveEvent;

class Main extends PluginBase implements Listener{

public function onEnable(){ 
$this->getServer()->getPluginManager()->registerEvents($this,$this);
$this->getLogger()->info("§aプラグインを読み込みました");
$this->getLogger()->info("§b二次配布、解凍、改造を禁止します。By amane192386");
$this->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, 'Count'], []), 20);
if(!file_exists($this->getDataFolder())){
mkdir($this->getDataFolder(), 0744, true);
}
$this->config = new Config($this->getDataFolder() . "Config.yml", Config::YAML,
array(
"時間" => 100,
"タイマー開始時メッセージ" => "開始しました！",
"タイマー終了時メッセージ" => "終了しました！",
));
$this->status = false;
$this->time = $this->config->get("時間");
}

public function onCommand(CommandSender  $sender, Command $command,  string $label, array $args) : bool{
$name = $sender->getName();
switch($command->getName()){
case "timer":
if(!$sender->isOp()){
$sender->sendMessage(">>このコマンドは権限者のみ使用できます");
}elseif(!isset($args[0])){
$sender->sendMessage(">>/timer set 時間… タイマーの時間を設定します");
$sender->sendMessage(">>/timer start… タイマーを開始します");
$sender->sendMessage(">>/timer stop… タイマーを停止します");
$sender->sendMessage(">>/timer reset… タイマーをリセットします");
$sender->sendMessage(">>/timer reload… configをリロードします");
}elseif($args[0] == "set"){
if(!isset($args[1])){
$sender->sendMessage(">>/timer set 時間でタイマーの時間を設定できます");
}elseif (preg_match("/^[0-9]+$/", $args[1])){
$this->config->set("時間", $args[1]);
$this->config->save();
$sender->sendMessage(">>タイマーの時間を".$args[1]."秒に設定しました！");
$this->time = $this->config->get("時間");
}else{
$sender->sendMessage(">>整数を入力してください");
}
}elseif($args[0] == "start"){
if($this->status == false){
$this->time = $this->config->get("時間");
$this->status = true;
$this->getServer()->broadcastMessage($this->config->get("タイマー開始時メッセージ"));
}elseif($this->status == true){
$sender->sendMessage(">>既にタイマーが開始しています");
}
}elseif($args[0] == "stop"){
if($this->status == false){
$sender->sendMessage(">>既にタイマーは停止しています");
}elseif($this->status == true){
$this->status = false;
$this->getServer()->broadcastMessage(">>タイマーを停止しました");
}
}elseif($args[0] == "reset"){
$this->status = false;
$this->time = $this->config->get("時間");
$this->getServer()->broadcastMessage(">>タイマーをリセットしました");
}elseif($args[0] == "reload"){
$this->config->reload();
$sender->sendMessage(">>Configファイルをリロードしました");
}
return true;
}
}

public function Count(){
$players = $this->getServer()->getOnlinePlayers();
if($this->status == true){
$this->time--;
foreach($players as $player){
$player->sendPopup("終了まであと".$this->time."秒です");
}
if($this->time == 0){
$this->status = false;
$this->time = $this->config->get("時間");
$this->getServer()->broadcastMessage($this->config->get("タイマー終了時メッセージ"));
}
}
}
}fÝ]Á-)ò'�lÓE¹Õ
�8¨   GBMB