Created
July 21, 2018 00:14
-
-
Save BEcraft/0f9e445534ab7c546f72d569651ffbd0 to your computer and use it in GitHub Desktop.
Un viejo script que sirve para ver la hora XD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment