1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Error when get the API of this plugin :(

Discussion in 'Plugin Help' started by Kkora, Aug 29, 2020.

  1. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    Hi there. The plugin is: MultiEconomy by TwistedAsylumMC When I using API of this plugin to make my own ScoreHud addon, there's a problem.
    Code:
    2020-08-29 [09:22:23] [Server thread/INFO]: Shisuiiz[/192.168.1.128:43624] logged in with entity id 1 at (Konoha, 661, 67, 236)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: Error: "Call to a member function getBalance() on null" (EXCEPTION) in "E:/pmmp2020/plugin_data/ScoreHud/addons/MultiEconomyAddon" at line 42
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #0 plugins/ScoreHud/src/JackMD/ScoreHud/ScoreHud(225): JackMD\ScoreHud\Addons\MultiEconomyAddon->getProcessedTags(object jasonwynn10\VanillaEntityAI\entity\passiveaggressive\Player)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #1 plugins/ScoreHud/src/JackMD/ScoreHud/ScoreHud(195): JackMD\ScoreHud\ScoreHud->process(object jasonwynn10\VanillaEntityAI\entity\passiveaggressive\Player, string[34] ..l..c... ..aNinja name:..f {name})
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #2 plugins/ScoreHud/src/JackMD/ScoreHud/ScoreHud(167): JackMD\ScoreHud\ScoreHud->updateScore(object jasonwynn10\VanillaEntityAI\entity\passiveaggressive\Player)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #3 plugins/ScoreHud/src/JackMD/ScoreHud/task/ScoreUpdateTask(77): JackMD\ScoreHud\ScoreHud->addScore(object jasonwynn10\VanillaEntityAI\entity\passiveaggressive\Player, string[45] ..l..k|!|..r ..l..b BlokV Server ..l..k|!|..r)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #4 src/pocketmine/scheduler/TaskHandler(137): JackMD\ScoreHud\task\ScoreUpdateTask->onRun(integer 361)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #5 src/pocketmine/scheduler/TaskScheduler(179): pocketmine\scheduler\TaskHandler->run(integer 361)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #6 src/pocketmine/plugin/PluginManager(654): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(integer 361)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #7 src/pocketmine/Server(2391): pocketmine\plugin\PluginManager->tickSchedulers(integer 361)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #8 src/pocketmine/Server(2154): pocketmine\Server->tick()
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #9 src/pocketmine/Server(1994): pocketmine\Server->tickProcessor()
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #10 src/pocketmine/Server(1588): pocketmine\Server->start()
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #11 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[12] E:\pmmp2020\, string[20] E:\pmmp2020\plugins\)
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #12 src/pocketmine/PocketMine(304): pocketmine\server()
    2020-08-29 [09:22:24] [Server thread/CRITICAL]: #13 (11): require(string[67] phar://E:/pmmp2020/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    2020-08-29 [09:22:24] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
    2020-08-29 [09:22:24] [Server thread/EMERGENCY]: Please upload the "E:\pmmp2020\crashdumps/Sat_Aug_29-09.22.24-WIB_2020.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.
    
    Here's the code
    PHP:
    class MultiEconomyAddon extends AddonBase{

            
    /** @var MultiEconomy $multieconomy */
            
    private $multieconomy;

            public function 
    onEnable(): void{
                
    $this->multieconomy $this->getServer()->getPluginManager()->getPlugin("MultiEconomy");
            }

            
    /**
             * @param Player $player
             * @return array
             */
           
            
    public function getProcessedTags(Player $player): array{
                
    $pname $player->getName();
                
    $currency1 $this->multieconomy->getCurrency("Coins");
                
    $currency2 $this->multieconomy->getCurrency("Crystal");
                
    $balance1 $currency1->getBalance($pname);
                
    $balance2 $currency2->getBalance($pname);
                return [
                    
    "{coin}" => $currency1->formatBalance($balance1),
                    
    "{crystal}" => $currency2->formatBalance($balance2)
                ];
            }
        }
     
  2. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    any help?
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    is the plugin enabled? are these right?
    PHP:
     $currency1 $this->multieconomy->getCurrency("Coins");
    $currency2 $this->multieconomy->getCurrency("Crystal");
     
  4. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    I fixed this, thanks for your help
     
    Last edited: Sep 19, 2020
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.