Hey, so I'm using a plugin where if you select a class in-game, it will give you that effect perm. In the config, I set up the effects, but for some reason, it doesn't work. It isn't my mistake with setting up the config. <?php namespace benzo\task; use benzo\Loader; use pocketmine\{entity\Effect, entity\EffectInstance, scheduler\Task}; class ClassTask extends Task{ /** @var Loader */ private $plugin; public function __construct(Loader $plugin){ $this->plugin = $plugin; } public function onRun(int $currentTick){ $data = $this->plugin->getData(); foreach($this->plugin->getServer()->getOnlinePlayers() as $player){ if(!$data->exists($player->getName())){ continue; } $class_name = $data->get($player->getName())["class"]; $class_data = $this->plugin->getConfig()->getNested("class.ui"); if(!isset($race_data[$class_name])){ continue; } $effects_data = $race_data[$class_name]["effects"]; foreach($effects_data as $datum){ $player->addEffect(new EffectInstance(Effect::getEffect($datum["id"]), $datum["duration"] * 20, $datum["amplifier"], $datum["visible"])); } } } }
Are you sure that the code is running? If so, double-check that the values returning from your configuration file is correct.
Everything works, except the effect part. Im only showing the effect part atm, do you want to see anything else?
Hmm...since i haven't seen the full code, I'm not sure. But try adding debugging messages on your checks and see if the checks are working. PHP: // Like this!if(blah blah blah) { echo 'Worked1';}if(another blah blah) { echo 'Worked 2';}