Hello, my name is Nice and I am 25. You know the scoreboard flicking idk how to example but scoreboard disappear, ya that do u know how to fix it. Idk if it’s possible
I don't think anything like that is possible. We are using an old, modified version of ScoreboardsPE. What we did was addLine() once, and then remove the ones who refresh and add them back updated, but some of the lines were duplicating. If you really need to get rid of that, this is the only thing I know that would help.
That's the bug, old screenshot, from 1.7 probably, because we changed the system within 2-3 days. Here is how our old code works (found that from an abandoned plugin): PHP: $scoreboard = $this->scoreboard; $scoreboard->setLine($player, 1, " "); $scoreboard->removeLine($player, 2); $scoreboard->setLine($player, 2, C::GOLD." Hello, ".C::AQUA.$player->getDisplayName()); $scoreboard->setLine($player, 3, " "); $scoreboard->removeLine($player, 4); $scoreboard->setLine($player, 4, C::GOLD." Your Health: ".C::AQUA.$player->getHealth()); $scoreboard->removeLine($player, 5); $scoreboard->setLine($player, 5, C::GOLD." Bot's Health: ".C::AQUA.$bot->getHealth()); $scoreboard->removeLine($player, 6); $scoreboard->setLine($player, 6, C::GOLD." Time Left: ".C::AQUA.$time); $scoreboard->removeLine($player, 7); $scoreboard->setLine($player, 7, C::GOLD." Online: ".C::AQUA.count($this->plugin->getServer()->getOnlinePlayers())); $scoreboard->setLine($player, 8, " "); $scoreboard->removeLine($player, 9); $scoreboard->setLine($player, 9, C::GOLD." Shop: ".C::GREEN.$shop); $scoreboard->addDisplay($player, ScoreboardDisplaySlot::SIDEBAR, ScoreboardSort::DESCENDING); PHP: public function __construct(Main $plugin) { $this->plugin = $plugin; $scoreboard = new Scoreboard($this->plugin->getServer()->getPluginManager()->getPlugin("ScoreboardsPE")->getPlugin(), C::BOLD.C::RED."Bot PracticePvP", ScoreboardAction::CREATE); $scoreboard->create(ScoreboardDisplaySlot::SIDEBAR, ScoreboardSort::DESCENDING); $this->scoreboard = $scoreboard; }
Or don't use ScoreboardPE and use your own API so you avoid doing hacks like @MalakasPlayzMCPE showed
this is how i created mine PHP: public function showScoreboard(): void{ $pk = new SetDisplayObjectivePacket(); $pk->displaySlot = "sidebar"; $pk->objectiveName = $this->getName(); $pk->displayName = "§l§6Hestra§8PvP"; $pk->criteriaName = "dummy"; $pk->sortOrder = 0; $this->sendDataPacket($pk); $this->scoreboardVisible = true; } public function getScoreboardLine(int $score): ?string{ return empty($this->scoreboardLines[$score]) ? null : $this->scoreboardLines[$score]; } public function updateScoreboard(): void{ $data = $this->getData(); $lines = [ 1 => " ", 2 => " §l§6Head Hunting: ", 3 => " §l§e* §r§7Level:§f " . $this->getHHLevel() . " ", 4 => " §l§e* §r§7Experience:§f " . $this->getHHProgress() . " ", 5 => " ", 6 => " §l§6Information: ", 7 => " §l§e*§r§7 Realm:§f Overlord", 8 => " §l§e* §r§7Balance:§f $" . round($data->get("balance")) . " ", 9 => " §l§e* §r§7Faction:§f No-Faction", 10 => " §l§e* §r§7Online:§f " . count($this->getServer()->getOnlinePlayers()) . " ", 11 => " ", 12 => " §eplay.HestraPvP.net " ]; foreach($lines as $score => $line){ $this->setScoreboardLine($score, $line); } } public function setScoreboardLine(int $score, string $line): void{ if(!$this->scoreboardVisible) return; $entry = new ScorePacketEntry(); $entry->objectiveName = $this->getName(); $entry->type = $entry::TYPE_FAKE_PLAYER; $entry->customName = $line; $entry->score = $score; $entry->scoreboardId = $score; if(isset($this->scoreboardLines[$score])){ $pk = new SetScorePacket(); $pk->type = $pk::TYPE_REMOVE; $pk->entries[] = $entry; $this->sendDataPacket($pk); } $pk = new SetScorePacket(); $pk->type = $pk::TYPE_CHANGE; $pk->entries[] = $entry; $this->sendDataPacket($pk); $this->scoreboardLines[$score] = $line; } it works fine because i don't need a task to update it each time
The bug you were experiencing might be due to the fact that each score name must be unique. For example, if two "Chest Refill" score entries have the same name... Code: Chest Refill: 2:30 Chest Refill: 2:30 ...then the client hides one of them (not sure which one). It sucks, yeah. In my case, I added a hack by NUL-concatenating the lines, like so: PHP: public function setLine(int $line, string $text) : void{ //... $entry = new ScorePacketEntry(); $entry->type = ScorePacketEntry::TYPE_FAKE_PLAYER; $entry->objectiveName = $this->objective; $entry->customName = $text . str_repeat("\0", $line); //<-- concatenating with "\0" so each score name is unique. The "\0" won't show up in the scoreboard. $entry->score = $line; //...}
It refreshes each second, it cannot be same. Also, if it was the same, the new line would not appear.