help fix the problem the server sometimes crashes https://github.com/SugarPocket/TopMoney/blob/master/src/topmoney/SendTask.php Code: 2020-01-14 [16:02:29] [Server thread/CRITICAL]: Error: "Call to a member function addParticle() on null" (EXCEPTION) in "plugins/TopMoney-master/src/topmoney/SendTask" at line 66 PHP: public function onRun(int $currentTick){ $player = $this->player; $x = $this->plugin->getConfig()->get("x"); $y = $this->plugin->getConfig()->get("y"); $z = $this->plugin->getConfig()->get("z"); $unit = $this->plugin->getConfig()->get("unit"); $money = $this->plugin->getServer()->getPluginManager()->getPlugin("EconomyAPI"); $money_top = $money->getAllMoney(); $message = ""; $message1 = ""; $topmoney = " §e§f== :: §cMCraft §f:: == > §6§lТОП-БОГАЧЕЙ "; $topmoney1 = " §6§f== :: §cMCraft §f:: == > §6§lТОП-БОГАЧЕЙ "; if(count($money_top) > 0){ arsort($money_top); $i = 1; foreach($money_top as $name => $money){ $message .= " §b #".$i.". §d".$name." §f".$money." §a$unit\n"; $message1 .= " §b #".$i.". §d".$name." §9".$money." §a$unit\n"; if($i >= 10){ break; } ++$i; } } $p = new FloatingTextParticle(new Vector3($x, $y, $z), $message, $topmoney); // $p1 = new FloatingTextParticle(new Vector3($x, $y, $z), $message1, $topmoney1); $player->getLevel()->addParticle($p); // $player->getLevel()->addParticle($p1); }}
i recommend to use slapper nametag . its better . the problem is you did not set position . if you want to make a leader board this code is crash cuz will add a floating text for every online player ! . but you could fix the error whit if(!is_null($player)){ $player->getLevel()->addParticle($p); //if player is online } but this will not work as a leaderboard . sry for bad english
Since the task is scheduled 200 ticks or 10 seconds after the player joined, the player probably quit the server before the task is run Simple fix is to check if the player is still online PHP: public function onRun(int $currentTick){if(!$this->player->isOnline()) return;$player = $this->player;$x = $this->plugin->getConfig()->get("x");$y = $this->plugin->getConfig()->get("y");$z = $this->plugin->getConfig()->get("z");...