Hello I have a core plugin and here a repeating scoreboard. My goal is to call in the BedWars plugin I have (not a phar using devtools) and get the kills config to show in a scoreboard. PHP: $plugin = $pl->getServer()->getPluginManager()->getPlugin("Bedwars");$api = Core::getInstance()->score;$rank = Core::getInstance()->getRank($pl);$name = $pl->getName();$only = count(Core::getInstance()->getServer()->getOnlinePlayers());$api->new($pl, $pl->getName(), " §l§eBEDWARS ");$api->setLine($pl, 1, "§7".date("d/m/Y"));$api->setLine($pl, 2, "§f Name:§a ".$name);$api->setLine($pl, 3, "§f Ping:§r ".$this->getPingInt($pl));$api->setLine($pl, 4, "§l§f STATS");$api->setLine($pl, 5, "§f Online:§a ".$only);$api->setLine($pl, 6, "§f BedWars Kills: §a");$api->setLine($pl, 7, "§f BedWars Wins:§a ");$api->setLine($pl, 8, "§f Beds Destroyed:§a ");$api->setLine($pl, 9, "");$api->setLine($pl, 10, " §ejoinwcserver.ddns.net");$api->getObjectiveName($pl); } So, I can’t seem to get the amount of kills, beds or win the player has by calling in a another plugin. Need help getting the kills, beds, and wins the player has an show into the scoreboard. here is the BedWars plugin when I create a config for kills. PHP: public function addKill(string $name) { $tops = new Config($this->plugin->getDataFolder() . "/Kills.yml", Config::YAML); $tops->set($name,$tops->get($name) + 1); $tops->save(); } This works!
Use events! For kills, use PHP: public function onKill(PlayerDeathEvent $event){ $ent = $event->getEntity(); $cause = $ent->getLastDamageCause(); if($cause instanceof EntityDamageByEntityEvent) { $killer = $cause->getDamager(); if($killer instanceof Player) { $this->addKill($killed->getName()); } }} For beds, you can use PHP: public function onBreak(BlockBreakEvent $event){ $block = $event->getBlock(); if($block->getId() === 26){ // if the broken block is bed // Code for adding whatever function you have for adding bed broken }} Solved?
And for getting these, you can make a function like this PHP: public function getKill(Player $player) { $tops = new Config($this->plugin->getDataFolder() . "/Kills.yml", Config::YAML); $tops->get($player->getName()); } And same for bed, just with different file.
The function solves me problem. Imma test it because I need to call in my BedWars plugin and then call function you applied.