Spoiler Is there anyway to add an event to where you do /UHC start and countdowns from 3 and then on the 4th tick it breaks all bedrock with a 50 by 50 radius near spawn? Here is what the countdown file looks like.
PHP: <?phpnamespace UHCReload;use pocketmine\scheduler\PluginTask;use pocketmine\utils\TextFormat;use pocketmine\item\Item;use pocketmine\entity\Effect;use pocketmine\level\Position;use pocketmine\level\Level;use pocketmine\utils\Config;use pocketmine\math\vector3;use UHCReload\Main;use pocketmine\Player;use pocketmine\level\sound\GhastSound;use pocketmine\level\sound\ClickSound;use pocketmine\level\sound\AnvilUseSound; class Countdown extends PluginTask{ public $countdown = 0; public function time($int) { $m = floor($int / 60); $s = floor($int % 60); return (($m < 10 ? "0" : "") . $m . ":" . ($s < 10 ? "0" : "") . $s); } public function __construct(Main $plugin){ parent::__construct($plugin); $this->plugin = $plugin; } public function onRun($task){ $this->countdown++; $online = count($this->plugin->getServer()->getOnlinePlayers()); foreach($this->plugin->getServer()->getOnlinePlayers() as $pl){ $x = $pl->getFloorX(); $y = $pl->getFloorY(); $z = $pl->getFloorZ();$pl->sendTip(" §8[§9UHCs§8]\n§9X: §3$x §8/ §9Y: §3$y §8/ §9Z: §3$z\n§9Online: §3$pl§8 / §330");}foreach($this->plugin->getServer()->getOnlinePlayers() as $player){ if($this->countdown == 1){$player->sendMessage("§8[§9UHC§8] §3Starting in §93"); $click = new ClickSound($player); $player->getLevel()->addSound($click); } if($this->countdown == 2){$player->sendMessage("§8[§9UHC§8] §3Starting in §92"); $click = new ClickSound($player); $player->getLevel()->addSound($click);}if($this->countdown == 3){$player->sendMessage("§8[§9UHC§8] §3Starting in §91"); $click = new ClickSound($player); $player->getLevel()->addSound($click);}if($this->countdown == 4){ $player->sendMessage("§8[§9UHC§8] §3Event started!");$player->getLevel()->addSound(new AnvilUseSound($pl));}}}public static function alignStringCenter(string $string, string $string2) : string { $length = strlen($string); $half = $length / 4; $string = $string.PHP_EOL.str_repeat(' ', $half).$string2; return $string;}}
Let's assume you meant seconds instead of ticks. You already over complicated things PHP: <?phpnamespace UHCReload;use pocketmine\scheduler\PluginTask;use pocketmine\utils\TextFormat;use pocketmine\item\Item;use pocketmine\entity\Effect;use pocketmine\level\Position;use pocketmine\level\Level;use pocketmine\utils\Config;use pocketmine\math\vector3;use UHCReload\Main;use pocketmine\Player;use pocketmine\level\sound\GhastSound;use pocketmine\level\sound\ClickSound;use pocketmine\level\sound\AnvilUseSound;class Countdown extends PluginTask { private $countdown = 0; public function __construct(Main $plugin) { parent::__construct($plugin); } public function onRun(int $currentTick) { if(!isset($this->countdown)) { $this->countdown = $currentTick; } $time = $currentTick - $this->countdown; // in ticks $online = count($this->getOwner()->getServer()->getOnlinePlayers()); foreach($this->getOwner()->getServer()->getOnlinePlayers() as $pl) { $x = $pl->getFloorX(); $y = $pl->getFloorY(); $z = $pl->getFloorZ(); $pl->sendTip(" §8[§9UHCs§8]\n§9X: §3$x §8/ §9Y: §3$y §8/ §9Z: §3$z\n§9Online: §3$pl§8 / §330"); } foreach($this->getOwner()->getServer()->getOnlinePlayers() as $player) { if($time === 20) { // every 20 ticks is one second $player->sendMessage("§8[§9UHC§8] §3Starting in §93"); $click = new ClickSound($player); $player->getLevel()->addSound($click); } if($time === 40) { $player->sendMessage("§8[§9UHC§8] §3Starting in §92"); $click = new ClickSound($player); $player->getLevel()->addSound($click); } if($time === 60) { $player->sendMessage("§8[§9UHC§8] §3Starting in §91"); $click = new ClickSound($player); $player->getLevel()->addSound($click); } if($time === 80) { $player->sendMessage("§8[§9UHC§8] §3Event started!"); $player->getLevel()->addSound(new AnvilUseSound($pl)); } } if($time === 80) { $this->getOwner()->removeBedrock(); $this->getHandler()->remove(); } }}