{"id":13666965,"url":"https://github.com/MilkBowl/VaultAPI","last_synced_at":"2025-04-26T15:31:57.167Z","repository":{"id":16836248,"uuid":"19595764","full_name":"MilkBowl/VaultAPI","owner":"MilkBowl","description":"API Component of Vault","archived":false,"fork":false,"pushed_at":"2024-08-10T03:32:14.000Z","size":512,"stargazers_count":273,"open_issues_count":18,"forks_count":109,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-11T02:34:34.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"LarryMad/recipes","license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MilkBowl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2014-05-09T02:08:32.000Z","updated_at":"2024-11-07T09:16:18.000Z","dependencies_parsed_at":"2024-03-31T22:44:45.171Z","dependency_job_id":null,"html_url":"https://github.com/MilkBowl/VaultAPI","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MilkBowl%2FVaultAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MilkBowl%2FVaultAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MilkBowl%2FVaultAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MilkBowl%2FVaultAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MilkBowl","download_url":"https://codeload.github.com/MilkBowl/VaultAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251008690,"owners_count":21522156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T07:00:20.335Z","updated_at":"2025-04-26T15:31:56.845Z","avatar_url":"https://github.com/MilkBowl.png","language":"Java","funding_links":[],"categories":["Plugins"],"sub_categories":["Library Plugins"],"readme":"# VaultAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI)\n\nHow to include the API with Maven: \n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.MilkBowl\u003c/groupId\u003e\n        \u003cartifactId\u003eVaultAPI\u003c/artifactId\u003e\n        \u003cversion\u003e1.7\u003c/version\u003e\n        \u003cscope\u003eprovided\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nHow to include the API with Gradle:\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\ndependencies {\n    compileOnly \"com.github.MilkBowl:VaultAPI:1.7\"\n}\n```\n\n**Note**: The VaultAPI version has 2 numbers (major.minor), unlike Vault, which has 3. The 2 numbers in the VaultAPI will always correspond to the 2 beginning numbers in a Vault version to make it clear what versions your plugin will for sure work with.\n\n## Why Vault?\nI have no preference which library suits your plugin and development efforts\nbest.  Really, I thought a central suite (rather...Vault) of solutions was the\nthe proper avenue than focusing on a single category of plugin.  That's where\nthe idea for Vault came into play.\n\nSo, what features do I _think_ you'll like the most?\n\n * No need to include my source code in your plugin\n * Broad range of supported plugins\n * Choice!\n\n## License\nCopyright (C) 2011-2018 Morgan Humes \u003cmorgan@lanaddict.com\u003e\n\nVault is free software: you can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nVault is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with Vault.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\n## Building\nVaultAPI comes with all libraries needed to build from the current branch.\n\n## Implementing Vault\nImplementing Vault is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below:\n\n```java\npackage com.example.plugin;\n\nimport net.milkbowl.vault.chat.Chat;\nimport net.milkbowl.vault.economy.Economy;\nimport net.milkbowl.vault.economy.EconomyResponse;\nimport net.milkbowl.vault.permission.Permission;\n\nimport org.bukkit.command.Command;\nimport org.bukkit.command.CommandSender;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.RegisteredServiceProvider;\nimport org.bukkit.plugin.java.JavaPlugin;\n\npublic class ExamplePlugin extends JavaPlugin {\n    \n    private static Economy econ = null;\n    private static Permission perms = null;\n    private static Chat chat = null;\n\n    @Override\n    public void onDisable() {\n        getLogger().info(String.format(\"[%s] Disabled Version %s\", getDescription().getName(), getDescription().getVersion()));\n    }\n\n    @Override\n    public void onEnable() {\n        if (!setupEconomy() ) {\n            getLogger().severe(String.format(\"[%s] - Disabled due to no Vault dependency found!\", getDescription().getName()));\n            getServer().getPluginManager().disablePlugin(this);\n            return;\n        }\n        setupPermissions();\n        setupChat();\n    }\n    \n    private boolean setupEconomy() {\n        if (getServer().getPluginManager().getPlugin(\"Vault\") == null) {\n            return false;\n        }\n        RegisteredServiceProvider\u003cEconomy\u003e rsp = getServer().getServicesManager().getRegistration(Economy.class);\n        if (rsp == null) {\n            return false;\n        }\n        econ = rsp.getProvider();\n        return econ != null;\n    }\n    \n    private boolean setupChat() {\n        RegisteredServiceProvider\u003cChat\u003e rsp = getServer().getServicesManager().getRegistration(Chat.class);\n        chat = rsp.getProvider();\n        return chat != null;\n    }\n    \n    private boolean setupPermissions() {\n        RegisteredServiceProvider\u003cPermission\u003e rsp = getServer().getServicesManager().getRegistration(Permission.class);\n        perms = rsp.getProvider();\n        return perms != null;\n    }\n    \n    public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {\n        if(!(sender instanceof Player)) {\n            getLogger().info(\"Only players are supported for this Example Plugin, but you should not do this!!!\");\n            return true;\n        }\n        \n        Player player = (Player) sender;\n        \n        if(command.getLabel().equals(\"test-economy\")) {\n            // Lets give the player 1.05 currency (note that SOME economic plugins require rounding!)\n            sender.sendMessage(String.format(\"You have %s\", econ.format(econ.getBalance(player.getName()))));\n            EconomyResponse r = econ.depositPlayer(player, 1.05);\n            if(r.transactionSuccess()) {\n                sender.sendMessage(String.format(\"You were given %s and now have %s\", econ.format(r.amount), econ.format(r.balance)));\n            } else {\n                sender.sendMessage(String.format(\"An error occured: %s\", r.errorMessage));\n            }\n            return true;\n        } else if(command.getLabel().equals(\"test-permission\")) {\n            // Lets test if user has the node \"example.plugin.awesome\" to determine if they are awesome or just suck\n            if(perms.has(player, \"example.plugin.awesome\")) {\n                sender.sendMessage(\"You are awesome!\");\n            } else {\n                sender.sendMessage(\"You suck!\");\n            }\n            return true;\n        } else {\n            return false;\n        }\n    }\n    \n    public static Economy getEconomy() {\n        return econ;\n    }\n    \n    public static Permission getPermissions() {\n        return perms;\n    }\n    \n    public static Chat getChat() {\n        return chat;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMilkBowl%2FVaultAPI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMilkBowl%2FVaultAPI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMilkBowl%2FVaultAPI/lists"}