Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @name Reloj
- * @api 3.0.0-ALPHA12
- * @author BEcraft
- * @main BEcraft\Reloj\JaiPipol
- * @version 1.0ParacetamolXD
- */
- namespace BEcraft\Reloj;
- use pocketmine\block\BlockFactory;
- use pocketmine\plugin\PluginBase;
- use pocketmine\scheduler\PluginTask;
- class JaiPipol extends PluginBase {
- public const TICKS = 20;
- public function onEnable(): void {
- date_default_timezone_set("America/Santo_Domingo");
- $this->getServer()->getScheduler()->scheduleRepeatingTask(new class($this) extends PluginTask {
- private const ALTURA = 25;
- private function tiempo(): void {
- $imagen = @imagecreatetruecolor(55, 8);
- imagestring($imagen, 1, 0, 0, date("h:ia"), imagecolorallocate($imagen, 255, 255,255));
- $imagen = imagerotate($imagen, -180, 0);
- $mundo = $this->getOwner()->getServer()->getDefaultLevel();
- for($y = 0; $y < imagesy($imagen); ++$y){
- for($x = 0; $x < imagesx($imagen); ++$x){
- $posicion = $mundo->getSafeSpawn()->add($x, $y + self::ALTURA);
- $mundo->setBlock($posicion, BlockFactory::get(0, 0));
- $colores = imagecolorsforindex($imagen, imagecolorat($imagen, $x, $y));
- if($colores["red"] !== 255 or $colores["green"] !== 255 or $colores["blue"] !== 255){
- continue;
- }
- $mundo->setBlock($posicion, BlockFactory::get(35, 0));
- }
- }
- imagedestroy($imagen);
- }
- public function onRun(int $tick): void {
- if(date("s") === "00"){
- $this->tiempo();
- }
- }
- }, self::TICKS);
- }
- }
Add Comment
Please, Sign In to add comment