How i can add effect when the player use a warp?? With This: PHP: public function warpAs(CommandSender $sender, Player $p){ if($this->canUse($sender)){ $p->teleport($this->p); $p->sendMessage("§4§l>"); $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" . $this->name); $p->sendMessage("§4§l>"); $p->sendPopup("§l§bBienvenido a §l§c" . $this->name);
Write use pocketmine\entity\Effect; And code: PHP: public function warpAs(CommandSender $sender, Player $p){if($this->canUse($sender)){$p->teleport($this->p); $effect = Effect::getEffect(1); //Effect ID $effect->setVisible(true); //Effect particles $effect->setDuration(300); //Duration in ticks $p->addEffect($effect); $p->sendMessage("§4§l>"); $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" . $this->name); $p->sendMessage("§4§l>"); $p->sendPopup("§l§bBienvenido a §l§c" . $this->name);
Maybe, than in your linux servers somethings like plugins can disturb the addEffect() ... Is there a plugin that uses pocketmine\entity\Effect ?
Are you sure that in your Linux server, in the code for the command is there : PHP: public function warpAs (Command Sender $sender, Player $p) {// Effect codes} Because, if there's not Player $p it won't work! If use it on : PHP: if($this->canUse($sender)){$p->teleport($this->p); $effect = Effect::getEffect(1); //Effect ID $effect->setVisible(true); //Effect particles $effect->setDuration(300); //Duration in ticks $p->addEffect($effect); $p->sendMessage("§4§l>"); $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" . $this->name); $p->sendMessage("§4§l>"); $p->sendPopup("§l§bBienvenido a §l§c" . $this->name) Like, if it works!