Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help ?

Comments in 'Plugin Development' started by KHAV, Sep 2, 2016.

  1. KHAV
    Offline

    KHAV New Member

    Joined:
    Aug 7, 2016
    Posts:
    35
    Minecraft User:
    KHAV
    Hi

    I am working on my plugin
    His name is: luckygift

    So when you type /lucky
    The plugin will take from you economy money and give you lucky items

    But how i can make when you don't have money tell you :

    Message: You Don't have money

    And don't give the player items ;)
  2. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    That's a plugin request...
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Assuming you're using EconomyAPI
    PHP:
    // Get our dependency
    $economy $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");

    if(!
    $economy or !$economy->isEnabled()) {
       
    $this->getLogger()->notice("EconomyAPI can't be used as it's now disabled. Stopping...");
       
    $this->getServer()->getPluginManager()->disablePlugin($this);
       return;
    }

    $money $economy->myMoney($player); // Player's money balance
    $price 100// Your /lucky command price
    if(!$money) {
       
    $player->sendMessage("Sorry but this feature is currently unvailable, try again later.");
       return 
    true;
    }
    if( (
    $money $price) < ) {
       
    $player->sendMessage("You don't have enough money");
       return 
    true;
    }
    Add this to your plugin.yml
    Code:
    depend: EconomyAPI
    
    Last edited: Sep 3, 2016
    MyNameIsTriXz likes this.
  4. KHAV
    Offline

    KHAV New Member

    Joined:
    Aug 7, 2016
    Posts:
    35
    Minecraft User:
    KHAV
    Ok
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Are you kidding me? :mad:

    You're lucky because you know how to quote posts if not I would delete it straight ahead.
    MyNameIsTriXz and PocketKiller like this.
  6. KHAV
    Offline

    KHAV New Member

    Joined:
    Aug 7, 2016
    Posts:
    35
    Minecraft User:
    KHAV
    What you want from me. Say :p
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    We usually say thanks.
  8. KHAV
    Offline

    KHAV New Member

    Joined:
    Aug 7, 2016
    Posts:
    35
    Minecraft User:
    KHAV
    Okay thx
  9. JonsMC
    Offline

    JonsMC Active Member

    Joined:
    Jul 26, 2016
    Posts:
    107
    Minecraft User:
    JonsMC
    I perfer getting economy api using :p:
    PHP:
    use onebone\economyapi\EconomyAPI;
    ...
    $economy EconomyAPI::getInstance();

Share This Page

Advertisement