hello, I tried to make the player receive effects when interacting with a certain item, but there was an error that I couldn't solve. error: [21:35:26] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\entity\Effect::setAmplifier()" (EXCEPTION) in "plugins/CustomPot/src/ZanoKing/CustomPot/Main" at line 42 part of the most relevant code: PHP: use pocketmine\entity\Effect;//function onInteract $pot = Effect::getEffect(1);(42) $pot->setAmplifier(2); $pot->setVisible(true); $pot->setDuration(273); $player->addEffect($pot); and sorry for the english of the google translator
Your code is outdated. PHP: use pocketmine\entity\EffectInstance;use pocketmine\entity\Effect;$effect = Effect::getEffect(9); // Declaring effect (Confusion)$duration = 20 * 4; // Duration. 20 = 1 second$amplification = 0; // Lv1 is 0$visible = false; // Particle$instance = new EffectInstance($effect, $duration, $amplification, $visible); //Effect Instance$player->addEffect($instance); // Adds Effect