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

How Would i make my plugin compatible with economy api so i can take money and add money

Discussion in 'Development' started by abimalek, Oct 22, 2017.

  1. abimalek

    abimalek Witch

    Messages:
    74
    GitHub:
    megagastpvp
    How Would i make my plugin compatible with economy api so i can take money and add money
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    First of all you must get EconomyAPI Plugin
    PHP:
    /** @var Plugin $economy */
    public $economy;

    public function 
    onEnable(){
    $this->economy $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");
    }[

    To get money use following
    PHP:
    /** @var Player $player */
    $this->economy->myMoney($player);

    To add money you can use addMoney() function
    PHP:
    /** @var Player $player */
    $this->economy->addMoney($player100);


    For more information check this links:
    https://github.com/onebone/EconomyS...PI/src/onebone/economyapi/EconomyAPI.php#L213
    https://github.com/onebone/EconomyS...PI/src/onebone/economyapi/EconomyAPI.php#L167
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    consider creating an interface for economy related to allow you to easily swap with economy plugins
     
  4. Karanpatel567

    Karanpatel567 Baby Zombie

    Messages:
    115
    GitHub:
    Karanpatel567
    Economy::Instance
     
  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.