Implementing economy plugins

Discussion in 'Plugin Development' started by cdsboy2000, Jun 12, 2013.

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

    cdsboy2000

    How would you allow your plugin to work with other economy plugins on the server? Is that even possible, or would I have to make my own economy within my plugin?

    Thanks,
    -cdsboy2000
     
  2. Offline

    x0pk1n

    Use it's API....
     
  3. Offline

    cdsboy2000

    Sorry, I'm a bit of a noob with Bukkit plugins right now. I've heard that term, but have no idea how to use it. Could you explain?
     
  4. Offline

    Rprrr

    No.

    Use Vault's API.
     
    Wizardo367 likes this.
  5. Offline

    x0pk1n

    What if you don't have valut installed hum? So yes you can just use it's API.
     
  6. Offline

    cdsboy2000

    I still don't know what that means. Could you guide me to a tutorial?
     
  7. Offline

    x0pk1n

    It is much in the same way as you added the Bukkit .jar, do that and then you can call the methods and such from there program. The methods and such can be found in the API, usually on the plugins page. But be sure when writing your plugin to check the other plugin is there, or else it may cause errors on servers when they try to call those methods and dont have the plugin.
     
  8. Offline

    cdsboy2000

    The Vault page is still a bit confusing, does anyone know the basics of using it?
     
  9. Offline

    bennie3211

    Code:
    package me.bennie3211.kit;
     
    import java.util.ArrayList;
     
    import net.milkbowl.vault.economy.Economy;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Kits extends JavaPlugin
    {
            public static Economy econ = null;
       
            private boolean setupEconomy()
            {
                    if (getServer().getPluginManager().getPlugin("Vault") == null)
                    {
                            return false;
                    }
                    RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
               
                    if (rsp == null)
                    {
                            return false;
                    }
               
                    econ = rsp.getProvider();
                    return econ != null;
            }
       
            public void onEnable()
            {
                    if (!setupEconomy()) //check if economy plugin is found
                    {
                            System.out.println("[SEVERE] PvPkits disabled due to no Vault dependency found!");
                            System.out.println("[WARNING] PvPkits can't run without the plugin Vault!");
                            getServer().getPluginManager().disablePlugin(this);
                            return;
                    }
               
                    System.out.println("[" + prefix + ChatColor.WHITE + "] Plugin is running.");
            }
    }
    I use this to check if Vault is installed!

    Edit: the imports are wrong, ik, i copied only the vault things.
     
  10. Offline

    x0pk1n

    You DONT have to use valut. People use it as it is a standar, so if you plugin works with valut then it can work with all other plugin that use it.
     
  11. Offline

    Rprrr


    You can, indeed, but without Vault you'd have to implement the API's of 100s of economy plugins by yourself. ;) Not a very clever idea, really.

    Also, Vault is in the top 3 of BukkitDev-downloads, so nearly every server has got it. Vault is just a better idea.
     
  12. Offline

    x0pk1n

    I very much dodut you need to implement 100's, you would just do it for the main ones and in most cases i bet there API is the same for basic methods/uses. Anyways if he wants to add support for a single one adding it through the API is easier. Along with it being probaly being easier, seeing he had to ask how he probaly isn't that advanced.
     
  13. Offline

    Rprrr

    x0pk1n

    Vault is the easiest to use, extremely lightweight, the most used in plugins, the most installed on servers (of nearly all plugins) and the best documented, aswell. I think that's alot easier than going through lots of different, usually poorly documented, API's by yourself.

    And, there are quite a few (+ 25) economy plugins out there, that are all used quite alot. Vault doesn't support just 5 of those plugins, but 23. Which means you won't have to go through all those API's by yourself, because that's exactly what Vault does (that saves time, yup, it does).

    I think forcing your users to use a certain economy plugin is worse than forcing your user to use Vault (which they probably have already installed, and if not, it's incredibly easy and can be done in seconds).

    To be honest, I don't really see why you think Vault is such a bad thing. There is a reason why nearly every plugin that has something to do with permission, chat or economy uses Vault.
     
  14. Offline

    x0pk1n

    Rprrr Never used vault, so i have no idea of it's ease of use. I've always just used the API's. Maybe ill go check it out if it supports alot of plugins. TBH i never said it was a bad thing, i was simply sayying you could do it another way which wasnt as difficult as you were sayying.
     
Thread Status:
Not open for further replies.

Share This Page