Hello, I'm working on a plugin vote reward plugin. I am having an issue with setting the player's prefix. I want to have it set the player's prefix instead of their rank because I don't want a voter rank overriding their current rank. This is what I have attempted: PHP: $prefix = $this->getServer()->getPluginManager()->getPlugin("PureChat");$prefix->setPrefix('§8[§eVoter§8]§r', $player->getName()); If you know why it's not working, that will help a lot. Thank you.
2nd argument should be $player, not their name: https://github.com/poggit-orphanage...6e879f/src/_64FF00/PureChat/PureChat.php#L688
Alright, that worked. I have one last question, how will I get the $player in a delayed task? This is what I have: PHP: public function __construct(Main $main, $playerName) { $this->main = $main; $this->playerName = $playerName; } public function onRun(int $currentTick) { if($player instanceof Player) { $prefix = $this->getServer()->getPluginManager()->getPlugin("PureChat"); $prefix->setPrefix('', $player); I don't know how I can get $player from that, I've made a few attempts, but they didn't work. Is there a way to do it from getServer(), or is there another way I can do it? Thanks.
On your task, you want the __construct function to get the player: PHP: new MyTask($this, $player)//$this is representing the PluginBase object PHP: public $player;public $mainpublic function __construct(Main $main, Player $player) { $this->main = $main; $this->player = $player; } public function onRun(int $currentTick) { if($this->player instanceof Player) { $prefix = $this->player->getServer()->getPluginManager()->getPlugin("PureChat"); $prefix->setPrefix('', $player);}