Guest User

Untitled

a guest
Jul 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * @name Reloj
  5. * @api 3.0.0-ALPHA12
  6. * @author BEcraft
  7. * @main BEcraft\Reloj\JaiPipol
  8. * @version 1.0ParacetamolXD
  9. */
  10.  
  11. namespace BEcraft\Reloj;
  12.  
  13. use pocketmine\block\BlockFactory;
  14. use pocketmine\plugin\PluginBase;
  15. use pocketmine\scheduler\PluginTask;
  16.  
  17. class JaiPipol extends PluginBase {
  18.  
  19. public const TICKS = 20;
  20.  
  21. public function onEnable(): void {
  22. date_default_timezone_set("America/Santo_Domingo");
  23. $this->getServer()->getScheduler()->scheduleRepeatingTask(new class($this) extends PluginTask {
  24.  
  25. private const ALTURA = 25;
  26.  
  27. private function tiempo(): void {
  28. $imagen = @imagecreatetruecolor(55, 8);
  29. imagestring($imagen, 1, 0, 0, date("h:ia"), imagecolorallocate($imagen, 255, 255,255));
  30. $imagen = imagerotate($imagen, -180, 0);
  31. $mundo = $this->getOwner()->getServer()->getDefaultLevel();
  32. for($y = 0; $y < imagesy($imagen); ++$y){
  33. for($x = 0; $x < imagesx($imagen); ++$x){
  34. $posicion = $mundo->getSafeSpawn()->add($x, $y + self::ALTURA);
  35. $mundo->setBlock($posicion, BlockFactory::get(0, 0));
  36. $colores = imagecolorsforindex($imagen, imagecolorat($imagen, $x, $y));
  37. if($colores["red"] !== 255 or $colores["green"] !== 255 or $colores["blue"] !== 255){
  38. continue;
  39. }
  40. $mundo->setBlock($posicion, BlockFactory::get(35, 0));
  41. }
  42. }
  43. imagedestroy($imagen);
  44. }
  45.  
  46. public function onRun(int $tick): void {
  47. if(date("s") === "00"){
  48. $this->tiempo();
  49. }
  50. }
  51.  
  52. }, self::TICKS);
  53. }
  54.  
  55. }
Add Comment
Please, Sign In to add comment