First of all I wish to say it is my first pocketmine plugin i ever developed, second i've been spent almost 8 hours in finding a solution, 3+ days, im also a student and i dont have lot of time. I cannot find that three problems, i may have included some classes that arent even used, i've been a lot learning pocketmine api and im so much better than before. Im hispanic also. So i have my plugin RaidCommand and i am having the three issues... running pocketmine for version v1.0.8, would love if you guys can also test it yourself the errors! Main file, RaidCommand.php, and the only one PHP: <?phpnamespace RaidCommand;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\command\CommandExecutor;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerInteractEvent;use pocketmine\math\Vector3;use pocketmine\level\Level;use pocketmine\tile\Sign;use pocketmine\level\Explosion;use pocketmine\block\Block;use pocketmine\level\Position;use pocketmine\Server;use onebone\economyapi\EconomyAPI;class RaidCommand extends PluginBase implements Listener{public function onEnable(){$this->getServer()->getPluginManager()->registerEvents($this, $this);$this->getLogger()->info("§aEnabling " . $this->getDescription()->getFullName() . "...");}public function onDisable(){$this->getLogger()->info("§cDisabling " . $this->getDescription()->getFullName() . "...");}public function onCommand(CommandSender $sender, Command $command, $label, array $args){if ($command->getName() === "raid") {if (EconomyAPI::getInstance()->reduceMoney($sender, 35000) == false) {$sender->sendMessage("§cYou need at least §a35000$ §cto use the raid command.");return true;} else {global $tapRaid;$name = $sender->getName();$hand = $sender->getInventory()->getItemInHand();$sender->sendMessage("§2Touch with a diamond pickaxe the area that you want to do more damage in the land.");// it should now define $tapRaid to true so that it can end up raiding.. but the variable is lost on the touch public function$tapRaid = "true";return true;}}}public function onTouch(PlayerInteractEvent $event){global $tapRaid;$player = $event->getPlayer();$block = $event->getBlock();$itemTapped = $event->getItem();$level = $player->getLevel();if ($itemTapped->getId() == "278:0") {if ($player->getLevel()->getName() == "homestead") {if (!empty($tapRaid)) {if ($tapRaid == "true") {// what i gotto add here is check the land is on the tapped block, then check its owner and check if the land owner has raidcommand.protection perm or return error message$x = $block->getX();$stoneY = $block->getY();$signY = $stoneY + 1;$z = $block->getZ();$explosion = new Explosion(new Position($x, $stoneY, $z, $player->getLevel()), 5);$explosion->explodeA();$stoneId = "1";$signId = "323";$level->setBlockIdAt($x, $stoneY, $z, $stoneId);$level->setBlockIdAt($x, $signY, $z, $signId);$getTile = $level->getTile(new Vector3($x,$signY,$z));$getTile->setText("§c[RAIDED]", "§b" . "$player was", "§bhere", "");}}}}}} PS: I forgot say title the glitching part is incomplete, what happens is that the first block sets but it sets a cobblestone stair instead of a stone and the sign isnt setting anywhere
setText(): Error found: sign isn't setted one Y more than the stone setBlockIdAt() (I tapped two times two blocks using the Diamond Pickaxe) and this is what I got, it was supposed to set stone Error found: - Placed one block more - didnt place stone newExplosion simply no explosion happens and no error in console check the code in the post description Oh and I wish the player after using /raid to do all once because i were able to place more than once and if newexplosion were working it would explode two times or the amount of times i tap a block so you can help with that
Sorry but that doesnt help me, im new to this and i dont know what i got to do, can you give me the correct code just..
Try checking if $getTile is instance of Sign tile PHP: $getTile = $level->getTile(new Vector3($x,$signY,$z));if($getTile instanceof Sign){$getTile->setText("§c[RAIDED]", "§b" . "$player was", "§bhere", "");}