Who can fix it? I NEED HELP! Code: Code: >topmoney [Server] [05:40:31] [Asynchronous Worker #1 thread/CRITICAL]: RuntimeException: "Threaded members previously set to Threaded objects are immutable, cannot overwrite topList" (EXCEPTION) in "/EconomyAPI_v2.0.9.phar/src/onebone/economyapi/task/SortTask" at line 36 [Server] [05:40:31] [Server thread/CRITICAL]: Could not execute asynchronous task SortTask: Task crashed Or Spoiler: Full code view topmoney [Server] [05:40:31] [Asynchronous Worker #1 thread/CRITICAL]: RuntimeException: "Threaded members previously set to Threaded objects are immutable, cannot overwrite topList" (EXCEPTION) in "/EconomyAPI_v2.0.9.phar/src/onebone/economyapi/task/SortTask" at line 36 [Server] [05:40:31] [Server thread/CRITICAL]: Could not execute asynchronous task SortTask: Task crashed
Fix the code yourself by forking EconomyAPI, if you know. If you don't, share us the full code. You can also add a new issue on the original EconomyAPI Repo by onebone..
I have exactly the same problem too, but I don't know how to fix it. This is what my whole SortTask.php looks like: PHP: <?phpnamespace onebone\economyapi\task;use pocketmine\scheduler\AsyncTask;use pocketmine\Server;use pocketmine\Player;use onebone\economyapi\EconomyAPI;class SortTask extends AsyncTask{ private $player, $moneyData, $addOp, $page, $ops, $banList; private $max = 0; private $topList = []; /** * @param string $player * @param array $moneyData * @param bool $addOp * @param int $page * @param array $ops * @param array $banList */ public function __construct($player, $moneyData, $addOp, $page, $ops, $banList){ $this->player = $player; $this->moneyData = $moneyData; $this->addOp = $addOp; $this->page = $page; $this->ops = $ops; $this->banList = $banList; } public function onRun(){ $this->topList = $this->getTopList(); } private function getTopList(){ $money = $this->moneyData["money"]; arsort($money); $ret = []; $n = 1; $this->max = ceil((count($money) - count($this->banList) - ($this->addOp ? 0 : count($this->ops))) / 5); $this->page = (int)min($this->max, max(1, $this->page)); foreach($money as $p => $money){ $p = strtolower($p); if(isset($this->banList[$p])) continue; if(isset($this->ops[$p]) and $this->addOp === false) continue; $current = (int) ceil($n / 5); if($current === $this->page){ $ret[$n] = [$p, $money]; }elseif($current > $this->page){ break; } ++$n; } return $ret; } public function onCompletion(Server $server){ if((($player = $this->player) === "CONSOLE") or ($player = $server->getPlayerExact($this->player)) instanceof Player){ $plugin = EconomyAPI::getInstance(); $output = "- Showing top money list ({$this->page} of {$this->max}) - \n"; $message = ($plugin->getMessage("topmoney-format", $this->player, ["%1", "%2", "%3", "%4"])."\n"); foreach($this->topList as $n => $list){ $output .= str_replace(["%1", "%2", "%3"], [$n, $list[0], $list[1]], $message); } if($player instanceof Player){ $player->sendMessage($output); }else{ $plugin->getLogger()->info($output); } } }}
Please don't post phar files here, it's against the rules. Topmoney in EconomyAPI on Poggit is already fixed https://poggit.pmmp.io/p/EconomyAPI