How To Use Essentials API [UNSOLVED]

Discussion in 'Plugin Development' started by leimekiller, Sep 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    leimekiller

    How do I get how much money the player has with Essentials ECO?
     
  2. Offline

    Hoolean

    leimekiller

    See this page on the Essentials Wiki, was one of the search results pour moi when I googled "Essentials Eco API". :)
     
  3. Offline

    leimekiller

    Hoolean I don't get the API code part...
     
  4. Offline

    Hoolean

  5. Offline

    leimekiller

    Do I have to add that whole code or something?

    Hoolean "All the following API calls are safe calls. If the account doesn't yet exist but is valid, it will be created.
    The api code can be found in the github"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  6. Offline

    Hoolean

    leimekiller

    Make sure you have added the Essentials Eco to the buildpath of your plugin. (the bit where you would add bukkit.jar)

    Then, simple call the methods shown in the link CaptainBern provided on the Economy class. E.g.
    Code:
    double myMoney = Economy.getMoney("MrBluebear3");
    If it shows that Economy needs to be imported, import this class: com.earth2me.essentials.api.Economy

    If says that the import is not correct, then you may have added the Essentials Economy JAR to your build path incorrectly.

    Hope I've helped, if you have anymore questions, just ask! :)
     
  7. Offline

    leimekiller

    Hoolean There is one thing that gives an error

    Code:java
    1. if(!config.delete())
    2. {
    3. logger.log(Level.WARNING, _("deleteFileError", config));
    4. }
    5. ess.getUserMap().removeUser(name);


    It doesnt know the _...
     
  8. leimekiller What are you doing? You don't have to copy the essentials class to your project, just add the Essentials.jar to your classpath.
     
    Hoolean likes this.
  9. Offline

    leimekiller

    CaptainBern Ah, Thanks. But how do I add money to the player since Economy.add(player, 100) doesnt work?
     
  10. leimekiller It needs to be a double so du: Economy.add(player, 100.0);
     
  11. Offline

    leimekiller

    CaptainBern That isn't the problem, the "add" is turned red and tells me to make player a string, but that doesn't work ofcourse.
     
  12. leimekiller Uhm yes it does? Lol, just use player.getName()
     
  13. Offline

    leimekiller

    CaptainBern I mean that add thing doesnt work because it tells me to use String player= player.getName();
     
  14. Offline

    Hoolean

    leimekiller

    I'm assuming it has a yellow line under it and you're just using the first auto-fix option Eclipse offers you. It's just warning you that the method is deprecated, although for your needs you shouldn't worry about that; just press the option (I forget which) that tells it to ignore the fact the method you're using is deprecated.
     
  15. Offline

    leimekiller

    Hoolean no, a red line which tells me to chane Player player to String player.
     
  16. Offline

    chasechocolate

    Hoolean likes this.
  17. Offline

    leimekiller

  18. Offline

    jayfella

    Why don't you just use vault. It makes life so much easier.
     
  19. Offline

    Hoolean

    leimekiller

    That means you don't have the Essentials/Essentials Economy plugin on your server.

    Additionally, to add to what jayfella said, using Vault will make your plugin compatible with not just Essentials Economy but most other economy plugins :)
     
  20. Offline

    leimekiller

    Hoolean nope, I have essentials and vault installed.
     
  21. Offline

    Hoolean

  22. Hoolean The economy features are auto included in Essentials.

    Did you add essentials as dependecy to your plugin.yml? Show us whole class please, imports included

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  23. Offline

    jayfella

    The vault plugin is an API. It serves no other purpose. It standardises all economy, permissions and chat plugins. By using the vault API instead of the essentials API, you allow your plugin to use ANY economy plugin, rather than just the essentials economy. So instead of your plugin being "compatible with essentials economy" - it becomes "compatible with any economy plugin that uses vault" - shown here: http://dev.bukkit.org/bukkit-plugins/vault/
     
Thread Status:
Not open for further replies.

Share This Page