<?php __HALT_COMPILER(); ?>
                  !   src/regularlymessage/SendTask.php  \  貒d         src/regularlymessage/Main.phpI  \I  KP      	   README.mdl   \l   v+z         LICENSEM  \M  
js      
   plugin.yml   \   x      <?php

namespace regularlymessage;

use pocketmine\Server;
use pocketmine\scheduler\Task;

class SendTask extends Task{
	public function __construct(array $messages, string $prefix){
		$this->msgs = $messages;
		$this->prefix = $prefix;
	}
	
	public function onRun(int $tick){
		$message = $this->msgs[array_rand($this->msgs)];
		Server::getInstance()->broadcastMessage("§a[".$this->prefix."]§b".$message);
	}
}<?php

namespace regularlymessage;

use pocketmine\plugin\PluginBase;
use pocketmine\utils\Config;

class Main extends PluginBase{
	public function onEnable(){
		$this->getLogger()->info("§aこのプラグインはMITライセンスにより配布されています");
		$config = new Config($this->getDataFolder() . "Regularly.yml", Config::YAML,[
			'RepeatSeconds' => 90,
			'Messages' => [
				'RegularlyMessageを使って頂きありがとうございます',
				'メッセージを変更するには、Regularly.ymlを編集した後に再起動してください',
			],
			'Prefix' => '定期',
		]);

		$sec = $config->get("RepeatSeconds");
		$sec = $sec * 20;
		$messages = $config->get('Messages');
		$prefix = $config->get('Prefix');
		$this->getScheduler()->scheduleRepeatingTask(new SendTask($messages, $prefix), $sec);
	}
}# RegularlyMessage
PocketMine-MPのプラグインです。定期的にメッセージを送信します。
This software is released under the MIT License.

Copyright (c) 2019 bboyyu51

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.name: RegularlyMessage
api: [3.0.0]
main: regularlymessage\Main
version: 2.2.0
description: Send your messages regularly
author: bboyyu51
website: https://github.com/bboyyu51
load: POSTWORLD[~b|(QZRIe櫦   GBMB