<?php __HALT_COMPILER(); ?>
                  
   config.yml   !\   g9         src/main/Main.php  !\  j@         src/main/CallbackTask.php  !\  @vϜ      
   plugin.yml   !\   [      ---
RepeatSeconds: "90"
Number of messages: "5"
1: チート・ハックは禁止です
2: 荒らしは辞めましょう
3: ルールは必読です
4: /tagで称号を買えます！
5: STARserverをお楽しみ下さい！
...<?php

namespace main;

use pocketmine\plugin\PluginBase;
use pocketmine\Player;
use pocketmine\scheduler\Task;
use pocketmine\utils\Utils;
use pocketmine\utils\Config;

class main extends PluginBase{
    public function onEnable(){
        
        if(!file_exists($this->getDataFolder())){
            mkdir($this->getDataFolder(), 0744, true);
        }
        
        
        $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array(
          'RepeatSeconds' => '90',
          'Number of messages' => '5',
          '1' => 'message1',
          '2' => 'message2',
          '3' => 'message3',
          '4' => 'message4',
          '5' => 'message5',
          ));
        
        $sec = $this->config->get("RepeatSeconds");
        $sec = $sec*20;
      
        $this->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this,"SendTask"]), $sec);
    }
    
    public function SendTask(){
        $message_num = $this->config->get("Number of messages");
        $rand = mt_rand(1, $message_num);
        $message = $this->config->get("$rand");
        $this->getServer()->broadcastMessage("§a[定期]§b$message");


    }
}<?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/
 *
 *
*/

namespace main;

use pocketmine\scheduler\Task;

/**
 * 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
 *
 * @deprecated
 * Do NOT use this anymore, it was deprecated a long time ago at PocketMine
 * and will be removed at some stage in the future.
 */

class CallbackTask extends 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;
		$this->args[] = $this;
	}

	/**
	 * @return callable
	 */
	public function getCallable(){
		return $this->callable;
	}

	/**
	 * @param $currentTicks
	 */
	public function onRun($currentTicks){
		call_user_func_array($this->callable, $this->args);
	}

}name: RegularlyMessage
api: 4.0.0
main: main\Main
version: 1.0.0
description: Send messages on a regular basis
author: bboyyu51jNK1jD0T"   GBMB