Hello, it has been long since i tried to code something, i created a plugin where i can select a place to explode by using a detonator "/detonator" to take the detonator "/setdetxyz" to set the coordinates of the explosion so the coordinates are working fine so far, commands, and the config but the problem is that when i set the coordinates the explosion just doesn't work(no smoke even) and no erros in the console for some reason, i hope someone can help PHP: <?phpnamespace Detonator;use pocketmine\event\Listener;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\level\Explosion;use pocketmine\level\Position;use pocketmine\plugin\PluginBase;use pocketmine\utils\Config;use pocketmine\item\Item;use pocketmine\event\player\PlayerInteractEvent;class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); @mkdir($this->getDataFolder()); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML); $this->config->save(); } public function onDisable() { unlink($this->getDataFolder() . "config.yml"); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool { if ($cmd->getName() === "detonator") { $det = Item::get(347, 0, 1); $det->setCustomName("§aDetonator"); $sender->getInventory()->addItem($det); return true; } if ($cmd->getName() === "setdetxyz") { $sender->sendMessage("You can now choose a block to explode!"); $this->config->setNested($sender->getName().".allowxyz", true); $this->config->save(); return true; } } public function addExplosion(Position $p){ $exp = new Explosion($p, 6, null); $exp->explodeA(); $exp->explodeB(); } public function onTouch(PlayerInteractEvent $event) { $player = $event->getPlayer(); $item = $event->getItem(); if($this->config->get($player->getName())){ if($this->config->getNested($player->getName().".allowxyz")){ $b = $event->getBlock(); $xx = $b->getX(); $yy = $b->getY(); $zz = $b->getZ(); $this->config->setNested($player->getName().".X", $xx); $this->config->setNested($player->getName().".Y", $yy); $this->config->setNested($player->getName().".Z", $zz); $this->config->save(); $this->config->setNested($player->getName().".allowxyz", false); $this->config->save(); $this->config->setNested($player->getName().".allowdet", true); $this->config->save(); $player->sendMessage("§aBlock coordinates are set"); } else { return; } } if($item->getCustomName() == "§aDetonator"){ $x = $this->config->getNested($player->getName().".X"); $y = $this->config->getNested($player->getName().".Y"); $z = $this->config->getNested($player->getName().".Z"); $this->addExplosion(new Position($x, $y, $z, $player->getLevel())); $player->sendMessage("Exploded!"); $this->config->setNested($player->getName().".allowdet", false); $this->config->save(); $this->config->setNested($player->getName().".X", []); $this->config->save(); $this->config->setNested($player->getName().".Y", []); $this->config->save(); $this->config->setNested($player->getName().".Z", []); $this->config->save(); } dont mind this/*if($item->getId() == 347 or $item->getCustomName() == "§aDetonator" and (in_array($this->config->get("players"), $player->getName()))){ $player->sendMessage("Boom!"); $this->addExplosion(new Position($player->getX(), $player->getY(), $player->getZ(), $player->getLevel())); $this->config->setNested($player->getName().".allowdet", false); $this->config->save(); } */ dont mind this }}
Never mind guys i fixed it myself... seems like nobody else did, i just recoded the last part and now it works.