├── .github └── workflows │ ├── maven.yml │ └── release.yml ├── .gitignore ├── .mvn └── settings.xml ├── .travis.yml ├── .utility ├── do-publish.sh └── settings.xml ├── README.md ├── license.txt ├── pom.xml └── src └── main └── java └── net └── milkbowl └── vault ├── chat └── Chat.java ├── economy ├── AbstractEconomy.java ├── Economy.java └── EconomyResponse.java └── permission └── Permission.java /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 1.8 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 1.8 23 | - name: Cache Maven packages 24 | uses: actions/cache@v2 25 | with: 26 | path: ~/.m2 27 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} 28 | restore-keys: ${{ runner.os }}-m2 29 | - name: Build Release 30 | run: mvn -B package --file pom.xml 31 | - name: Build javadoc 32 | run: mvn -B javadoc:jar --file pom.xml 33 | - name: Stage the artifact 34 | run: mkdir staging && cp target/*.jar staging 35 | - uses: actions/upload-artifact@v2 36 | with: 37 | name: VaultAPI 38 | path: staging 39 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Publish VaultAPI to GitHub Packages 2 | on: 3 | release: 4 | types: [created] 5 | jobs: 6 | publish: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout main branch 10 | uses: actions/checkout@v2 11 | - name: Checkout gh-pages branch 12 | uses: actions/checkout@v2 13 | with: 14 | ref: gh-pages 15 | path: gh-pages 16 | - uses: actions/setup-java@v1 17 | with: 18 | java-version: 1.8 19 | - name: Build and publish package 20 | env: 21 | GITHUB_TOKEN: ${{ github.token }} 22 | run: | 23 | mvn -B javadoc:javadoc 24 | # mvn -B deploy 25 | - name: Commit javadocs 26 | run: | 27 | cp -Rfv target/javadoc-latest/* gh-pages/ 28 | cd gh-pages 29 | git config --local user.email "action@github.com" 30 | git config --local user.name "GitHub Action" 31 | git commit -m "Update javadoc pages for latest release" -a 32 | - name: Push javadoc changes 33 | uses: ad-m/github-push-action@master 34 | with: 35 | branch: gh-pages 36 | directory: gh-pages 37 | github_token: ${{ github.token }} 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /dependency-reduced-pom.xml 3 | /.classpath 4 | /.project 5 | /.settings 6 | /bin/ 7 | -------------------------------------------------------------------------------- /.mvn/settings.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | github 8 | 9 | 10 | 11 | 12 | github 13 | 14 | 15 | central 16 | https://repo1.maven.org/maven2 17 | true 18 | true 19 | 20 | 21 | github 22 | GitHub Maven Packages 23 | https://maven.pkg.github.com/milkbowl/github-releases 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | github 32 | MilkBowl 33 | ${env.GITHUB_TOKEN} 34 | 35 | 36 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: [ openjdk8 ] 3 | branches: 4 | except: 5 | - gh-pages 6 | sudo: false 7 | env: 8 | global: 9 | - secure: "lkC+9PeVPx0sFEAITPszoHvPV9jnavsJdA3Slo4FakzTB5AlERHszto4RdenAhPf347r8xKL120YvDxDeYvmffpG7NUcRXfQZxod1SRyFEFUUBC0zGHkLiJlBjAqkSEDacruldT4+1BCqRc/A96zj17knmUkvKnyutQtasOGKxk=" 10 | - secure: "UxxyRTgZFxEbzxfpEKFC6bYVKkhVp/kOCy5QZwbctkwQP33l3eEwDUquDVXewwLWgM6yJvWdUq9Va/f2kJ8Z7NMHLj5UTj3zIWdqJ/dZIrZ32Vb6tTawXV56627ANLsGHfw55uqIIHFs3u3HUlucyYhBAxLsxJNR4XbU2IeA8fA=" 11 | - secure: "ljUPRZkuNEqck8RIHONVD7lCr1a/aslagOQ27uB0EpuOMGfeBlDdAlpo+GnRSs2bsfvUGX9nmcgGPR6mTcV0fzHaSBg+p/BPWBuzo9wEs39H4wn8yVU70pu/wCEuRhGlFw4GE0mYp8pbHMHrc8WdxsF3dt4kAGsdVhivXuz9HHI=" 12 | after_success: 13 | - .utility/do-publish.sh 14 | -------------------------------------------------------------------------------- /.utility/do-publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | current_dir=`pwd` 3 | 4 | if [[ "$TRAVIS_REPO_SLUG" != "MilkBowl/VaultAPI" || "$TRAVIS_PULL_REQUEST" == "true" || "$TRAVIS_BRANCH" != "master" ]] 5 | then 6 | echo 'Travis can only publish docs for release builds.' 7 | return 0 8 | fi 9 | 10 | mvn clean javadoc:javadoc javadoc:jar deploy --settings .utility/settings.xml 11 | 12 | # Get to the Travis build directory, configure git and clone the repo 13 | cd $HOME 14 | git config --global user.email "travis@travis-ci.org" 15 | git config --global user.name "travis-ci" 16 | git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/MilkBowl/VaultAPI gh-pages > /dev/null 17 | 18 | # Commit and Push the Changes 19 | cd gh-pages 20 | git rm -rf * 21 | cp -Rfv $current_dir/target/javadoc-latest/* ./ 22 | git add -f . 23 | git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages" 24 | git push -fq origin gh-pages > /dev/null 25 | -------------------------------------------------------------------------------- /.utility/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | pub-repo 5 | ${env.DEPLOY_USER} 6 | ${env.DEPLOY_PASS} 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VaultAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI) 2 | 3 | How to include the API with Maven: 4 | ```xml 5 | 6 | 7 | jitpack.io 8 | https://jitpack.io 9 | 10 | 11 | 12 | 13 | com.github.MilkBowl 14 | VaultAPI 15 | 1.7 16 | provided 17 | 18 | 19 | ``` 20 | 21 | How to include the API with Gradle: 22 | ```groovy 23 | repositories { 24 | maven { url 'https://jitpack.io' } 25 | } 26 | dependencies { 27 | compileOnly "com.github.MilkBowl:VaultAPI:1.7" 28 | } 29 | ``` 30 | 31 | **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. 32 | 33 | ## Why Vault? 34 | I have no preference which library suits your plugin and development efforts 35 | best. Really, I thought a central suite (rather...Vault) of solutions was the 36 | the proper avenue than focusing on a single category of plugin. That's where 37 | the idea for Vault came into play. 38 | 39 | So, what features do I _think_ you'll like the most? 40 | 41 | * No need to include my source code in your plugin 42 | * Broad range of supported plugins 43 | * Choice! 44 | 45 | ## License 46 | Copyright (C) 2011-2018 Morgan Humes 47 | 48 | Vault is free software: you can redistribute it and/or modify 49 | it under the terms of the GNU Lesser General Public License as published by 50 | the Free Software Foundation, either version 3 of the License, or 51 | (at your option) any later version. 52 | 53 | Vault is distributed in the hope that it will be useful, 54 | but WITHOUT ANY WARRANTY; without even the implied warranty of 55 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 56 | GNU Lesser General Public License for more details. 57 | 58 | You should have received a copy of the GNU Lesser General Public License 59 | along with Vault. If not, see . 60 | 61 | ## Building 62 | VaultAPI comes with all libraries needed to build from the current branch. 63 | 64 | ## Implementing Vault 65 | Implementing Vault is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: 66 | 67 | ```java 68 | package com.example.plugin; 69 | 70 | import net.milkbowl.vault.chat.Chat; 71 | import net.milkbowl.vault.economy.Economy; 72 | import net.milkbowl.vault.economy.EconomyResponse; 73 | import net.milkbowl.vault.permission.Permission; 74 | 75 | import org.bukkit.command.Command; 76 | import org.bukkit.command.CommandSender; 77 | import org.bukkit.entity.Player; 78 | import org.bukkit.plugin.RegisteredServiceProvider; 79 | import org.bukkit.plugin.java.JavaPlugin; 80 | 81 | public class ExamplePlugin extends JavaPlugin { 82 | 83 | private static Economy econ = null; 84 | private static Permission perms = null; 85 | private static Chat chat = null; 86 | 87 | @Override 88 | public void onDisable() { 89 | getLogger().info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion())); 90 | } 91 | 92 | @Override 93 | public void onEnable() { 94 | if (!setupEconomy() ) { 95 | getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())); 96 | getServer().getPluginManager().disablePlugin(this); 97 | return; 98 | } 99 | setupPermissions(); 100 | setupChat(); 101 | } 102 | 103 | private boolean setupEconomy() { 104 | if (getServer().getPluginManager().getPlugin("Vault") == null) { 105 | return false; 106 | } 107 | RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); 108 | if (rsp == null) { 109 | return false; 110 | } 111 | econ = rsp.getProvider(); 112 | return econ != null; 113 | } 114 | 115 | private boolean setupChat() { 116 | RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Chat.class); 117 | chat = rsp.getProvider(); 118 | return chat != null; 119 | } 120 | 121 | private boolean setupPermissions() { 122 | RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); 123 | perms = rsp.getProvider(); 124 | return perms != null; 125 | } 126 | 127 | public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { 128 | if(!(sender instanceof Player)) { 129 | getLogger().info("Only players are supported for this Example Plugin, but you should not do this!!!"); 130 | return true; 131 | } 132 | 133 | Player player = (Player) sender; 134 | 135 | if(command.getLabel().equals("test-economy")) { 136 | // Lets give the player 1.05 currency (note that SOME economic plugins require rounding!) 137 | sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName())))); 138 | EconomyResponse r = econ.depositPlayer(player, 1.05); 139 | if(r.transactionSuccess()) { 140 | sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance))); 141 | } else { 142 | sender.sendMessage(String.format("An error occured: %s", r.errorMessage)); 143 | } 144 | return true; 145 | } else if(command.getLabel().equals("test-permission")) { 146 | // Lets test if user has the node "example.plugin.awesome" to determine if they are awesome or just suck 147 | if(perms.has(player, "example.plugin.awesome")) { 148 | sender.sendMessage("You are awesome!"); 149 | } else { 150 | sender.sendMessage("You suck!"); 151 | } 152 | return true; 153 | } else { 154 | return false; 155 | } 156 | } 157 | 158 | public static Economy getEconomy() { 159 | return econ; 160 | } 161 | 162 | public static Permission getPermissions() { 163 | return perms; 164 | } 165 | 166 | public static Chat getChat() { 167 | return chat; 168 | } 169 | } 170 | ``` 171 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | net.milkbowl.vault 5 | VaultAPI 6 | 1.7 7 | 8 | VaultAPI 9 | Vault is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves. 10 | 11 | Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon 12 | 13 | http://dev.bukkit.org/server-mods/vault/ 14 | 15 | 16 | UTF-8 17 | 1.13.1-R0.1-SNAPSHOT 18 | 19 | 20 | 21 | 22 | MilkBowl 23 | https://github.com/MilkBowl 24 | 25 | 26 | 27 | https://github.com/MilkBowl/VaultAPI 28 | scm:git:git://github.com:MilkBowl/VaultAPI.git 29 | scm:git:git@github.com:MilkBowl/VaultAPI.git 30 | 31 | 32 | 33 | Travis-CI 34 | https://travis-ci.org/MilkBowl/VaultAPI 35 | 36 | 37 | 38 | GitHub 39 | https://github.com/MilkBowl/VaultAPI/issues 40 | 41 | 42 | 43 | 44 | spigot-repo 45 | https://hub.spigotmc.org/nexus/content/groups/public/ 46 | 47 | 48 | 49 | 50 | 51 | github 52 | GitHub Packages 53 | https://maven.pkg.github.com/milkbowl/github-releases 54 | 55 | 56 | 57 | 58 | 59 | org.bukkit 60 | bukkit 61 | ${bukkitVersion} 62 | provided 63 | 64 | 65 | 66 | junit 67 | junit 68 | 4.13.1 69 | jar 70 | test 71 | true 72 | 73 | 74 | 75 | 76 | clean install 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-compiler-plugin 81 | 3.8.1 82 | 83 | 1.8 84 | 1.8 85 | 86 | 87 | 88 | org.apache.maven.plugins 89 | maven-source-plugin 90 | 3.2.1 91 | 92 | 93 | attach-sources 94 | verify 95 | 96 | jar-no-fork 97 | 98 | 99 | 100 | 101 | 102 | org.apache.maven.plugins 103 | maven-javadoc-plugin 104 | 3.2.0 105 | 106 | public 107 | Vault 108 | false 109 | true 110 | true 111 | true 112 | true 113 | Milkbowl, 2020]]> 114 | ${project.build.directory} 115 | javadoc-latest 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/main/java/net/milkbowl/vault/chat/Chat.java: -------------------------------------------------------------------------------- 1 | /* This file is part of Vault. 2 | 3 | Vault is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Vault is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with Vault. If not, see . 15 | */ 16 | package net.milkbowl.vault.chat; 17 | 18 | import net.milkbowl.vault.permission.Permission; 19 | 20 | import org.bukkit.OfflinePlayer; 21 | import org.bukkit.World; 22 | import org.bukkit.entity.Player; 23 | 24 | /** 25 | * The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them 26 | * 27 | */ 28 | public abstract class Chat { 29 | 30 | private Permission perms; 31 | 32 | public Chat(Permission perms) { 33 | this.perms = perms; 34 | } 35 | /** 36 | * Gets name of permission method 37 | * @return Name of Permission Method 38 | */ 39 | abstract public String getName(); 40 | 41 | /** 42 | * Checks if permission method is enabled. 43 | * @return Success or Failure 44 | */ 45 | abstract public boolean isEnabled(); 46 | 47 | /** 48 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. 49 | * 50 | * Get players prefix 51 | * @param world World name 52 | * @param player Player name 53 | * @return Prefix 54 | */ 55 | @Deprecated 56 | abstract public String getPlayerPrefix(String world, String player); 57 | 58 | /** 59 | * Get a players prefix in the given world 60 | * Use NULL for world if requesting a global prefix 61 | * 62 | * @param world World name 63 | * @param player OfflinePlayer 64 | * @return Prefix 65 | */ 66 | public String getPlayerPrefix(String world, OfflinePlayer player) { 67 | return getPlayerPrefix(world, player.getName()); 68 | } 69 | 70 | /** 71 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. 72 | * 73 | * Get players prefix 74 | * @param world World Object 75 | * @param player Player name 76 | * @return Prefix 77 | */ 78 | @Deprecated 79 | public String getPlayerPrefix(World world, String player) { 80 | return getPlayerPrefix(world.getName(), player); 81 | } 82 | 83 | /** 84 | * Get players prefix from the world they are currently in. 85 | * May or may not return the global prefix depending on implementation. 86 | * 87 | * @param player Player Object 88 | * @return Prefix 89 | */ 90 | public String getPlayerPrefix(Player player) { 91 | return getPlayerPrefix(player.getWorld().getName(), player); 92 | } 93 | 94 | /** 95 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. 96 | * 97 | * Set players prefix 98 | * @param world World name 99 | * @param player Player name 100 | * @param prefix Prefix 101 | */ 102 | @Deprecated 103 | abstract public void setPlayerPrefix(String world, String player, String prefix); 104 | 105 | /** 106 | * Sets players prefix in the given world. 107 | * Use NULL for world for setting in the Global scope. 108 | * 109 | * @param world World name 110 | * @param player OfflinePlayer 111 | * @param prefix Prefix 112 | */ 113 | public void setPlayerPrefix(String world, OfflinePlayer player, String prefix) { 114 | setPlayerPrefix(world, player.getName(), prefix); 115 | } 116 | 117 | /** 118 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. 119 | * 120 | * Set players prefix in the given world. 121 | * 122 | * @param world World Object 123 | * @param player Player name 124 | * @param prefix Prefix 125 | */ 126 | @Deprecated 127 | public void setPlayerPrefix(World world, String player, String prefix) { 128 | setPlayerPrefix(world.getName(), player, prefix); 129 | } 130 | 131 | /** 132 | * Set players prefix in the world they are currently in. 133 | * 134 | * @param player Player Object 135 | * @param prefix Prefix 136 | */ 137 | public void setPlayerPrefix(Player player, String prefix) { 138 | setPlayerPrefix(player.getWorld().getName(), player, prefix); 139 | } 140 | 141 | /** 142 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. 143 | * 144 | * Get players suffix 145 | * @param world World name 146 | * @param player Player name 147 | * @return Suffix 148 | */ 149 | @Deprecated 150 | abstract public String getPlayerSuffix(String world, String player); 151 | 152 | /** 153 | * Get players suffix in the specified world. 154 | * 155 | * @param world World name 156 | * @param player OfflinePlayer name 157 | * @return Suffix 158 | */ 159 | public String getPlayerSuffix(String world, OfflinePlayer player) { 160 | return getPlayerSuffix(world, player.getName()); 161 | } 162 | 163 | /** 164 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. 165 | * 166 | * Get players suffix 167 | * @param world World Object 168 | * @param player Player name 169 | * @return Suffix 170 | */ 171 | @Deprecated 172 | public String getPlayerSuffix(World world, String player) { 173 | return getPlayerSuffix(world.getName(), player); 174 | } 175 | 176 | /** 177 | * Get players suffix in the world they are currently in. 178 | * 179 | * @param player Player Object 180 | * @return Suffix 181 | */ 182 | public String getPlayerSuffix(Player player) { 183 | return getPlayerSuffix(player.getWorld().getName(), player); 184 | } 185 | 186 | /** 187 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. 188 | * 189 | * Set players suffix 190 | * @param world World name 191 | * @param player Player name 192 | * @param suffix Suffix 193 | */ 194 | @Deprecated 195 | abstract public void setPlayerSuffix(String world, String player, String suffix); 196 | 197 | /** 198 | * Set players suffix for the world specified 199 | * 200 | * @param world World name 201 | * @param player OfflinePlayer 202 | * @param suffix Suffix 203 | */ 204 | public void setPlayerSuffix(String world, OfflinePlayer player, String suffix) { 205 | setPlayerSuffix(world, player.getName(), suffix); 206 | } 207 | 208 | /** 209 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. 210 | * 211 | * Set players suffix 212 | * @param world World Object 213 | * @param player Player name 214 | * @param suffix Suffix 215 | */ 216 | @Deprecated 217 | public void setPlayerSuffix(World world, String player, String suffix) { 218 | setPlayerSuffix(world.getName(), player, suffix); 219 | } 220 | 221 | /** 222 | * Set players suffix in the world they currently occupy. 223 | * 224 | * @param player Player Object 225 | * @param suffix Suffix 226 | */ 227 | public void setPlayerSuffix(Player player, String suffix) { 228 | setPlayerSuffix(player.getWorld().getName(), player, suffix); 229 | } 230 | 231 | /** 232 | * Get group prefix 233 | * @param world World name 234 | * @param group Group name 235 | * @return Prefix 236 | */ 237 | abstract public String getGroupPrefix(String world, String group); 238 | 239 | /** 240 | * Get group prefix 241 | * @param world World Object 242 | * @param group Group name 243 | * @return Prefix 244 | */ 245 | public String getGroupPrefix(World world, String group) { 246 | return getGroupPrefix(world.getName(), group); 247 | } 248 | 249 | /** 250 | * Set group prefix 251 | * @param world World name 252 | * @param group Group name 253 | * @param prefix Prefix 254 | */ 255 | abstract public void setGroupPrefix(String world, String group, String prefix); 256 | 257 | /** 258 | * Set group prefix 259 | * @param world World Object 260 | * @param group Group name 261 | * @param prefix Prefix 262 | */ 263 | public void setGroupPrefix(World world, String group, String prefix) { 264 | setGroupPrefix(world.getName(), group, prefix); 265 | } 266 | 267 | /** 268 | * Get group suffix 269 | * @param world World name 270 | * @param group Group name 271 | * @return Suffix 272 | */ 273 | abstract public String getGroupSuffix(String world, String group); 274 | 275 | /** 276 | * Get group suffix 277 | * @param world World Object 278 | * @param group Group name 279 | * @return Suffix 280 | */ 281 | public String getGroupSuffix(World world, String group) { 282 | return getGroupSuffix(world.getName(), group); 283 | } 284 | 285 | /** 286 | * Set group suffix 287 | * @param world World name 288 | * @param group Group name 289 | * @param suffix Suffix 290 | */ 291 | abstract public void setGroupSuffix(String world, String group, String suffix); 292 | 293 | /** 294 | * Set group suffix 295 | * @param world World Object 296 | * @param group Group name 297 | * @param suffix Suffix 298 | */ 299 | public void setGroupSuffix(World world, String group, String suffix) { 300 | setGroupSuffix(world.getName(), group, suffix); 301 | } 302 | 303 | /** 304 | * Get a players informational node (Integer) value 305 | * @param world World name 306 | * @param player OfflinePlayer 307 | * @param node Permission node 308 | * @param defaultValue Default value 309 | * @return Value 310 | */ 311 | public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue) { 312 | return getPlayerInfoInteger(world, player.getName(), node, defaultValue); 313 | } 314 | 315 | /** 316 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. 317 | * Get a players informational node (Integer) value 318 | * @param world World name 319 | * @param player Player name 320 | * @param node Permission node 321 | * @param defaultValue Default value 322 | * @return Value 323 | */ 324 | @Deprecated 325 | abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue); 326 | 327 | /** 328 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. 329 | * 330 | * Get a players informational node (Integer) value 331 | * @param world World Object 332 | * @param player Player name 333 | * @param node Permission node 334 | * @param defaultValue Default value 335 | * @return Value 336 | */ 337 | @Deprecated 338 | public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) { 339 | return getPlayerInfoInteger(world.getName(), player, node, defaultValue); 340 | } 341 | 342 | /** 343 | * Get a players informational node (Integer) value 344 | * @param player Player Object 345 | * @param node Permission node 346 | * @param defaultValue Default value 347 | * @return Value 348 | */ 349 | public int getPlayerInfoInteger(Player player, String node, int defaultValue) { 350 | return getPlayerInfoInteger(player.getWorld().getName(), player, node, defaultValue); 351 | } 352 | 353 | /** 354 | * Set a players informational node (Integer) value 355 | * @param world World name 356 | * @param player OfflinePlayer 357 | * @param node Permission node 358 | * @param value Value to set 359 | */ 360 | public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value) { 361 | setPlayerInfoInteger(world, player.getName(), node, value); 362 | } 363 | 364 | /** 365 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. 366 | * 367 | * Set a players informational node (Integer) value 368 | * @param world World name 369 | * @param player Player name 370 | * @param node Permission node 371 | * @param value Value to set 372 | */ 373 | @Deprecated 374 | abstract public void setPlayerInfoInteger(String world, String player, String node, int value); 375 | 376 | /** 377 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. 378 | * 379 | * Set a players informational node (Integer) value 380 | * @param world World Object 381 | * @param player Player name 382 | * @param node Permission node 383 | * @param value Value to set 384 | */ 385 | @Deprecated 386 | public void setPlayerInfoInteger(World world, String player, String node, int value) { 387 | setPlayerInfoInteger(world.getName(), player, node, value); 388 | } 389 | 390 | /** 391 | * Set a players informational node (Integer) value 392 | * @param player Player Object 393 | * @param node Permission node 394 | * @param value Value to set 395 | */ 396 | public void setPlayerInfoInteger(Player player, String node, int value) { 397 | setPlayerInfoInteger(player.getWorld().getName(), player, node, value); 398 | } 399 | 400 | /** 401 | * Get a groups informational node (Integer) value 402 | * @param world World name 403 | * @param group Group name 404 | * @param node Permission node 405 | * @param defaultValue Default value 406 | * @return Value 407 | */ 408 | abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue); 409 | 410 | /** 411 | * Get a groups informational node (Integer) value 412 | * @param world World Object 413 | * @param group Group name 414 | * @param node Permission node 415 | * @param defaultValue Default value 416 | * @return Value 417 | */ 418 | public int getGroupInfoInteger(World world, String group, String node, int defaultValue) { 419 | return getGroupInfoInteger(world.getName(), group, node, defaultValue); 420 | } 421 | 422 | /** 423 | * Set a groups informational node (Integer) value 424 | * @param world World name 425 | * @param group Group name 426 | * @param node Permission node 427 | * @param value Value to set 428 | */ 429 | abstract public void setGroupInfoInteger(String world, String group, String node, int value); 430 | 431 | /** 432 | * Set a groups informational node (Integer) value 433 | * @param world World Object 434 | * @param group Group name 435 | * @param node Permission node 436 | * @param value Value to set 437 | */ 438 | public void setGroupInfoInteger(World world, String group, String node, int value) { 439 | setGroupInfoInteger(world.getName(), group, node, value); 440 | } 441 | 442 | /** 443 | * Get a players informational node (Double) value 444 | * @param world World name 445 | * @param player OfflinePlayer 446 | * @param node Permission node 447 | * @param defaultValue Default value 448 | * @return Value 449 | */ 450 | public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue) { 451 | return getPlayerInfoDouble(world, player.getName(), node, defaultValue); 452 | } 453 | 454 | /** 455 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. 456 | * 457 | * Get a players informational node (Double) value 458 | * @param world World name 459 | * @param player Player name 460 | * @param node Permission node 461 | * @param defaultValue Default value 462 | * @return Value 463 | */ 464 | @Deprecated 465 | abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue); 466 | 467 | /** 468 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead 469 | * 470 | * Get a players informational node (Double) value 471 | * @param world World Object 472 | * @param player Player name 473 | * @param node Permission node 474 | * @param defaultValue Default value 475 | * @return Value 476 | */ 477 | @Deprecated 478 | public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) { 479 | return getPlayerInfoDouble(world.getName(), player, node, defaultValue); 480 | } 481 | 482 | /** 483 | * Get a players informational node (Double) value 484 | * @param player Player Object 485 | * @param node Permission node 486 | * @param defaultValue Default value 487 | * @return Value 488 | */ 489 | public double getPlayerInfoDouble(Player player, String node, double defaultValue) { 490 | return getPlayerInfoDouble(player.getWorld().getName(), player, node, defaultValue); 491 | } 492 | 493 | /** 494 | * Set a players informational node (Double) value 495 | * @param world World name 496 | * @param player OfflinePlayer 497 | * @param node Permission node 498 | * @param value Value to set 499 | */ 500 | public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value) { 501 | setPlayerInfoDouble(world, player.getName(), node, value); 502 | } 503 | 504 | /** 505 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. 506 | * Set a players informational node (Double) value 507 | * @param world World name 508 | * @param player Player name 509 | * @param node Permission node 510 | * @param value Value to set 511 | */ 512 | @Deprecated 513 | abstract public void setPlayerInfoDouble(String world, String player, String node, double value); 514 | 515 | /** 516 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. 517 | * Set a players informational node (Double) value 518 | * @param world World Object 519 | * @param player Player name 520 | * @param node Permission node 521 | * @param value Value to set 522 | */ 523 | @Deprecated 524 | public void setPlayerInfoDouble(World world, String player, String node, double value) { 525 | setPlayerInfoDouble(world.getName(), player, node, value); 526 | } 527 | 528 | /** 529 | * Set a players informational node (Double) value 530 | * @param player Player Object 531 | * @param node Permission node 532 | * @param value Value to set 533 | */ 534 | public void setPlayerInfoDouble(Player player, String node, double value) { 535 | setPlayerInfoDouble(player.getWorld().getName(), player, node, value); 536 | } 537 | 538 | /** 539 | * Get a groups informational node (Double) value 540 | * @param world World name 541 | * @param group Group name 542 | * @param node Permission node 543 | * @param defaultValue Default value 544 | * @return Value 545 | */ 546 | abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue); 547 | 548 | /** 549 | * Get a groups informational node (Double) value 550 | * @param world World Object 551 | * @param group Group name 552 | * @param node Permission node 553 | * @param defaultValue Default value 554 | * @return Value 555 | */ 556 | public double getGroupInfoDouble(World world, String group, String node, double defaultValue) { 557 | return getGroupInfoDouble(world.getName(), group, node, defaultValue); 558 | } 559 | 560 | /** 561 | * Set a groups informational node (Double) value 562 | * @param world World name 563 | * @param group Group name 564 | * @param node Permission node 565 | * @param value Value to set 566 | */ 567 | abstract public void setGroupInfoDouble(String world, String group, String node, double value); 568 | 569 | /** 570 | * Set a groups informational node (Double) value 571 | * @param world World Object 572 | * @param group Group name 573 | * @param node Permission node 574 | * @param value Value to set 575 | */ 576 | public void setGroupInfoDouble(World world, String group, String node, double value) { 577 | setGroupInfoDouble(world.getName(), group, node, value); 578 | } 579 | 580 | /** 581 | * Get a players informational node (Boolean) value 582 | * @param world World name 583 | * @param player OfflinePlayer 584 | * @param node Permission node 585 | * @param defaultValue Default value 586 | * @return Value 587 | */ 588 | public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue) { 589 | return getPlayerInfoBoolean(world, player.getName(), node, defaultValue); 590 | } 591 | 592 | /** 593 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. 594 | * 595 | * Get a players informational node (Boolean) value 596 | * @param world World name 597 | * @param player Player name 598 | * @param node Permission node 599 | * @param defaultValue Default value 600 | * @return Value 601 | */ 602 | @Deprecated 603 | abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue); 604 | 605 | /** 606 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. 607 | * 608 | * Get a players informational node (Boolean) value 609 | * @param world World Object 610 | * @param player Player name 611 | * @param node Permission node 612 | * @param defaultValue Default value 613 | * @return Value 614 | */ 615 | @Deprecated 616 | public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) { 617 | return getPlayerInfoBoolean(world.getName(), player, node, defaultValue); 618 | } 619 | 620 | /** 621 | * Get a players informational node (Boolean) value 622 | * @param player Player Object 623 | * @param node Permission node 624 | * @param defaultValue Default value 625 | * @return Value 626 | */ 627 | public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) { 628 | return getPlayerInfoBoolean(player.getWorld().getName(), player, node, defaultValue); 629 | } 630 | 631 | /** 632 | * Set a players informational node (Boolean) value 633 | * @param world World name 634 | * @param player OfflinePlayer 635 | * @param node Permission node 636 | * @param value Value to set 637 | */ 638 | public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value) { 639 | setPlayerInfoBoolean(world, player.getName(), node, value); 640 | } 641 | 642 | /** 643 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. 644 | * Set a players informational node (Boolean) value 645 | * @param world World name 646 | * @param player Player name 647 | * @param node Permission node 648 | * @param value Value to set 649 | */ 650 | @Deprecated 651 | abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value); 652 | 653 | /** 654 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. 655 | * Set a players informational node (Boolean) value 656 | * @param world World Object 657 | * @param player Player name 658 | * @param node Permission node 659 | * @param value Value to set 660 | */ 661 | @Deprecated 662 | public void setPlayerInfoBoolean(World world, String player, String node, boolean value) { 663 | setPlayerInfoBoolean(world.getName(), player, node, value); 664 | } 665 | 666 | /** 667 | * Set a players informational node (Boolean) value 668 | * @param player Player Object 669 | * @param node Permission node 670 | * @param value Value to set 671 | */ 672 | public void setPlayerInfoBoolean(Player player, String node, boolean value) { 673 | setPlayerInfoBoolean(player.getWorld().getName(), player, node, value); 674 | } 675 | 676 | /** 677 | * Get a groups informational node (Boolean) value 678 | * @param world Name of World 679 | * @param group Name of Group 680 | * @param node Permission node 681 | * @param defaultValue Default value 682 | * @return Value 683 | */ 684 | abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue); 685 | 686 | /** 687 | * Set a players informational node (Boolean) value 688 | * @param world World Object 689 | * @param group Group name 690 | * @param node Permission node 691 | * @param defaultValue Default value 692 | * @return Value 693 | */ 694 | public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) { 695 | return getGroupInfoBoolean(world.getName(), group, node, defaultValue); 696 | } 697 | 698 | /** 699 | * Set a groups informational node (Boolean) value 700 | * @param world World name 701 | * @param group Group name 702 | * @param node Permission node 703 | * @param value Value to set 704 | */ 705 | abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value); 706 | 707 | /** 708 | * Set a players informational node (Boolean) value 709 | * @param world World Object 710 | * @param group Group name 711 | * @param node Permission node 712 | * @param value Value to set 713 | */ 714 | public void setGroupInfoBoolean(World world, String group, String node, boolean value) { 715 | setGroupInfoBoolean(world.getName(), group, node, value); 716 | } 717 | 718 | /** 719 | * Get a players informational node (String) value 720 | * @param world World name 721 | * @param player OfflinePlayer 722 | * @param node Permission node 723 | * @param defaultValue Default value 724 | * @return Value 725 | */ 726 | public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue) { 727 | return getPlayerInfoString(world, player.getName(), node, defaultValue); 728 | } 729 | 730 | /** 731 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. 732 | * 733 | * Get a players informational node (String) value 734 | * @param world World name 735 | * @param player Player name 736 | * @param node Permission node 737 | * @param defaultValue Default value 738 | * @return Value 739 | */ 740 | @Deprecated 741 | abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue); 742 | 743 | /** 744 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. 745 | * Get a players informational node (String) value 746 | * @param world World Object 747 | * @param player Player name 748 | * @param node Permission node 749 | * @param defaultValue Default value 750 | * @return Value 751 | */ 752 | @Deprecated 753 | public String getPlayerInfoString(World world, String player, String node, String defaultValue) { 754 | return getPlayerInfoString(world.getName(), player, node, defaultValue); 755 | } 756 | 757 | /** 758 | * Get a players informational node (String) value 759 | * @param player Player Object 760 | * @param node Permission node 761 | * @param defaultValue Default value 762 | * @return Value 763 | */ 764 | public String getPlayerInfoString(Player player, String node, String defaultValue) { 765 | return getPlayerInfoString(player.getWorld().getName(), player, node, defaultValue); 766 | } 767 | 768 | /** 769 | * Set a players informational node (String) value 770 | * @param world World name 771 | * @param player OfflinePlayer 772 | * @param node Permission node 773 | * @param value Value to set 774 | */ 775 | public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value) { 776 | setPlayerInfoString(world, player.getName(), node, value); 777 | } 778 | 779 | /** 780 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. 781 | * Set a players informational node (String) value 782 | * @param world World name 783 | * @param player Player name 784 | * @param node Permission node 785 | * @param value Value to set 786 | */ 787 | @Deprecated 788 | abstract public void setPlayerInfoString(String world, String player, String node, String value); 789 | 790 | /** 791 | * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. 792 | * Set a players informational node (String) value 793 | * @param world World name 794 | * @param player Player name 795 | * @param node Permission node 796 | * @param value Value to set 797 | */ 798 | @Deprecated 799 | public void setPlayerInfoString(World world, String player, String node, String value) { 800 | setPlayerInfoString(world.getName(), player, node, value); 801 | } 802 | 803 | /** 804 | * Set a players informational node (String) value 805 | * @param player Player Object 806 | * @param node Permission node 807 | * @param value Value ot set 808 | */ 809 | public void setPlayerInfoString(Player player, String node, String value) { 810 | setPlayerInfoString(player.getWorld().getName(), player, node, value); 811 | } 812 | 813 | /** 814 | * Get a groups informational node (String) value 815 | * @param world Name of World 816 | * @param group Name of Group 817 | * @param node Permission node 818 | * @param defaultValue Default value 819 | * @return Value 820 | */ 821 | abstract public String getGroupInfoString(String world, String group, String node, String defaultValue); 822 | 823 | /** 824 | * Set a players informational node (String) value 825 | * @param world World Object 826 | * @param group Group name 827 | * @param node Permission node 828 | * @param defaultValue Default value 829 | * @return Value 830 | */ 831 | public String getGroupInfoString(World world, String group, String node, String defaultValue) { 832 | return getGroupInfoString(world.getName(), group, node, defaultValue); 833 | } 834 | 835 | /** 836 | * Set a groups informational node (String) value 837 | * @param world World name 838 | * @param group Group name 839 | * @param node Permission node 840 | * @param value Value to set 841 | */ 842 | abstract public void setGroupInfoString(String world, String group, String node, String value); 843 | 844 | /** 845 | * Set a groups informational node (String) value 846 | * @param world World name 847 | * @param group Group name 848 | * @param node Permission node 849 | * @param value Value to set 850 | */ 851 | public void setGroupInfoString(World world, String group, String node, String value) { 852 | setGroupInfoString(world.getName(), group, node, value); 853 | } 854 | 855 | /** 856 | * Check if player is member of a group. 857 | * @param world World name 858 | * @param player OfflinePlayer 859 | * @param group Group name 860 | * @return Success or Failure 861 | */ 862 | public boolean playerInGroup(String world, OfflinePlayer player, String group) { 863 | return perms.playerInGroup(world, player, group); 864 | } 865 | 866 | /** 867 | * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. 868 | * Check if player is member of a group. 869 | * @param world World name 870 | * @param player Player name 871 | * @param group Group name 872 | * @return Success or Failure 873 | */ 874 | @Deprecated 875 | public boolean playerInGroup(String world, String player, String group) { 876 | return perms.playerInGroup(world, player, group); 877 | } 878 | 879 | /** 880 | * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. 881 | * Check if player is member of a group. 882 | * @param world World Object 883 | * @param player Player name 884 | * @param group Group name 885 | * @return Success or Failure 886 | */ 887 | @Deprecated 888 | public boolean playerInGroup(World world, String player, String group) { 889 | return playerInGroup(world.getName(), player, group); 890 | } 891 | 892 | /** 893 | * Check if player is member of a group. 894 | * @param player Player Object 895 | * @param group Group name 896 | * @return Success or Failure 897 | */ 898 | public boolean playerInGroup(Player player, String group) { 899 | return playerInGroup(player.getWorld().getName(), player, group); 900 | } 901 | 902 | /** 903 | * Gets the list of groups that this player has 904 | * @param world World name 905 | * @param player OfflinePlayer 906 | * @return Array of groups 907 | */ 908 | public String[] getPlayerGroups(String world, OfflinePlayer player) { 909 | return perms.getPlayerGroups(world, player); 910 | } 911 | 912 | /** 913 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. 914 | * Gets the list of groups that this player has 915 | * @param world World name 916 | * @param player Player name 917 | * @return Array of groups 918 | */ 919 | @Deprecated 920 | public String[] getPlayerGroups(String world, String player) { 921 | return perms.getPlayerGroups(world, player); 922 | } 923 | 924 | /** 925 | * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. 926 | * Gets the list of groups that this player has 927 | * @param world World Object 928 | * @param player Player name 929 | * @return Array of groups 930 | */ 931 | @Deprecated 932 | public String[] getPlayerGroups(World world, String player) { 933 | return getPlayerGroups(world.getName(), player); 934 | } 935 | 936 | /** 937 | * Gets the list of groups that this player has 938 | * @param player Player Object 939 | * @return Array of groups 940 | */ 941 | public String[] getPlayerGroups(Player player) { 942 | return getPlayerGroups(player.getWorld().getName(), player); 943 | } 944 | 945 | /** 946 | * Gets players primary group 947 | * @param world World name 948 | * @param player OfflinePlayer 949 | * @return Players primary group 950 | */ 951 | public String getPrimaryGroup(String world, OfflinePlayer player) { 952 | return perms.getPrimaryGroup(world, player); 953 | } 954 | 955 | /** 956 | * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. 957 | * Gets players primary group 958 | * @param world World name 959 | * @param player Player name 960 | * @return Players primary group 961 | */ 962 | @Deprecated 963 | public String getPrimaryGroup(String world, String player) { 964 | return perms.getPrimaryGroup(world, player); 965 | } 966 | 967 | /** 968 | * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. 969 | * Gets players primary group 970 | * @param world World Object 971 | * @param player Player name 972 | * @return Players primary group 973 | */ 974 | @Deprecated 975 | public String getPrimaryGroup(World world, String player) { 976 | return getPrimaryGroup(world.getName(), player); 977 | } 978 | 979 | /** 980 | * Get players primary group 981 | * @param player Player Object 982 | * @return Players primary group 983 | */ 984 | public String getPrimaryGroup(Player player) { 985 | return getPrimaryGroup(player.getWorld().getName(), player); 986 | } 987 | 988 | /** 989 | * Returns a list of all known groups 990 | * @return an Array of String of all groups 991 | */ 992 | public String[] getGroups() { 993 | return perms.getGroups(); 994 | } 995 | } 996 | -------------------------------------------------------------------------------- /src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java: -------------------------------------------------------------------------------- 1 | package net.milkbowl.vault.economy; 2 | 3 | import org.bukkit.OfflinePlayer; 4 | 5 | @SuppressWarnings("deprecation") 6 | public abstract class AbstractEconomy implements Economy { 7 | 8 | @Override 9 | public boolean hasAccount(OfflinePlayer player) { 10 | if (player.getName() == null) return false; 11 | return hasAccount(player.getName()); 12 | } 13 | 14 | @Override 15 | public boolean hasAccount(OfflinePlayer player, String worldName) { 16 | if (player.getName() == null) return false; 17 | return hasAccount(player.getName(), worldName); 18 | } 19 | 20 | @Override 21 | public double getBalance(OfflinePlayer player) { 22 | return getBalance(player.getName()); 23 | } 24 | 25 | @Override 26 | public double getBalance(OfflinePlayer player, String world) { 27 | return getBalance(player.getName(), world); 28 | } 29 | 30 | @Override 31 | public boolean has(OfflinePlayer player, double amount) { 32 | if (player.getName() == null) return false; 33 | return has(player.getName(), amount); 34 | } 35 | 36 | @Override 37 | public boolean has(OfflinePlayer player, String worldName, double amount) { 38 | if (player.getName() == null) return false; 39 | return has(player.getName(), worldName, amount); 40 | } 41 | 42 | @Override 43 | public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) { 44 | return withdrawPlayer(player.getName(), amount); 45 | } 46 | 47 | @Override 48 | public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount) { 49 | return withdrawPlayer(player.getName(), worldName, amount); 50 | } 51 | 52 | @Override 53 | public EconomyResponse depositPlayer(OfflinePlayer player, double amount) { 54 | return depositPlayer(player.getName(), amount); 55 | } 56 | 57 | @Override 58 | public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount) { 59 | return depositPlayer(player.getName(), worldName, amount); 60 | } 61 | 62 | @Override 63 | public EconomyResponse createBank(String name, OfflinePlayer player) { 64 | return createBank(name, player.getName()); 65 | } 66 | 67 | @Override 68 | public EconomyResponse isBankOwner(String name, OfflinePlayer player) { 69 | return isBankOwner(name, player.getName()); 70 | } 71 | 72 | @Override 73 | public EconomyResponse isBankMember(String name, OfflinePlayer player) { 74 | return isBankMember(name, player.getName()); 75 | } 76 | 77 | @Override 78 | public boolean createPlayerAccount(OfflinePlayer player) { 79 | return createPlayerAccount(player.getName()); 80 | } 81 | 82 | @Override 83 | public boolean createPlayerAccount(OfflinePlayer player, String worldName) { 84 | return createPlayerAccount(player.getName(), worldName); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/net/milkbowl/vault/economy/Economy.java: -------------------------------------------------------------------------------- 1 | /* This file is part of Vault. 2 | 3 | Vault is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Vault is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with Vault. If not, see . 15 | */ 16 | 17 | package net.milkbowl.vault.economy; 18 | 19 | import java.util.List; 20 | 21 | import org.bukkit.OfflinePlayer; 22 | 23 | /** 24 | * The main economy API 25 | * 26 | */ 27 | public interface Economy { 28 | 29 | /** 30 | * Checks if economy method is enabled. 31 | * @return Success or Failure 32 | */ 33 | public boolean isEnabled(); 34 | 35 | /** 36 | * Gets name of economy method 37 | * @return Name of Economy Method 38 | */ 39 | public String getName(); 40 | 41 | /** 42 | * Returns true if the given implementation supports banks. 43 | * @return true if the implementation supports banks 44 | */ 45 | public boolean hasBankSupport(); 46 | 47 | /** 48 | * Some economy plugins round off after a certain number of digits. 49 | * This function returns the number of digits the plugin keeps 50 | * or -1 if no rounding occurs. 51 | * @return number of digits after the decimal point kept 52 | */ 53 | public int fractionalDigits(); 54 | 55 | /** 56 | * Format amount into a human readable String This provides translation into 57 | * economy specific formatting to improve consistency between plugins. 58 | * 59 | * @param amount to format 60 | * @return Human readable string describing amount 61 | */ 62 | public String format(double amount); 63 | 64 | /** 65 | * Returns the name of the currency in plural form. 66 | * If the economy being used does not support currency names then an empty string will be returned. 67 | * 68 | * @return name of the currency (plural) 69 | */ 70 | public String currencyNamePlural(); 71 | 72 | 73 | /** 74 | * Returns the name of the currency in singular form. 75 | * If the economy being used does not support currency names then an empty string will be returned. 76 | * 77 | * @return name of the currency (singular) 78 | */ 79 | public String currencyNameSingular(); 80 | 81 | /** 82 | * 83 | * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. 84 | */ 85 | @Deprecated 86 | public boolean hasAccount(String playerName); 87 | 88 | /** 89 | * Checks if this player has an account on the server yet 90 | * This will always return true if the player has joined the server at least once 91 | * as all major economy plugins auto-generate a player account when the player joins the server 92 | * 93 | * @param player to check 94 | * @return if the player has an account 95 | */ 96 | public boolean hasAccount(OfflinePlayer player); 97 | 98 | /** 99 | * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. 100 | */ 101 | @Deprecated 102 | public boolean hasAccount(String playerName, String worldName); 103 | 104 | /** 105 | * Checks if this player has an account on the server yet on the given world 106 | * This will always return true if the player has joined the server at least once 107 | * as all major economy plugins auto-generate a player account when the player joins the server 108 | * 109 | * @param player to check in the world 110 | * @param worldName world-specific account 111 | * @return if the player has an account 112 | */ 113 | public boolean hasAccount(OfflinePlayer player, String worldName); 114 | 115 | /** 116 | * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead. 117 | */ 118 | @Deprecated 119 | public double getBalance(String playerName); 120 | 121 | /** 122 | * Gets balance of a player 123 | * 124 | * @param player of the player 125 | * @return Amount currently held in players account 126 | */ 127 | public double getBalance(OfflinePlayer player); 128 | 129 | /** 130 | * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead. 131 | */ 132 | @Deprecated 133 | public double getBalance(String playerName, String world); 134 | 135 | /** 136 | * Gets balance of a player on the specified world. 137 | * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned. 138 | * @param player to check 139 | * @param world name of the world 140 | * @return Amount currently held in players account 141 | */ 142 | public double getBalance(OfflinePlayer player, String world); 143 | 144 | /** 145 | * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} instead. 146 | */ 147 | @Deprecated 148 | public boolean has(String playerName, double amount); 149 | 150 | /** 151 | * Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS 152 | * 153 | * @param player to check 154 | * @param amount to check for 155 | * @return True if player has amount, False else wise 156 | */ 157 | public boolean has(OfflinePlayer player, double amount); 158 | 159 | /** 160 | * @deprecated As of VaultAPI 1.4 use @{link {@link #has(OfflinePlayer, String, double)} instead. 161 | */ 162 | @Deprecated 163 | public boolean has(String playerName, String worldName, double amount); 164 | 165 | /** 166 | * Checks if the player account has the amount in a given world - DO NOT USE NEGATIVE AMOUNTS 167 | * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned. 168 | * 169 | * @param player to check 170 | * @param worldName to check with 171 | * @param amount to check for 172 | * @return True if player has amount, False else wise 173 | */ 174 | public boolean has(OfflinePlayer player, String worldName, double amount); 175 | 176 | /** 177 | * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} instead. 178 | */ 179 | @Deprecated 180 | public EconomyResponse withdrawPlayer(String playerName, double amount); 181 | 182 | /** 183 | * Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS 184 | * 185 | * @param player to withdraw from 186 | * @param amount Amount to withdraw 187 | * @return Detailed response of transaction 188 | */ 189 | public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount); 190 | 191 | /** 192 | * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead. 193 | */ 194 | @Deprecated 195 | public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount); 196 | 197 | /** 198 | * Withdraw an amount from a player on a given world - DO NOT USE NEGATIVE AMOUNTS 199 | * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned. 200 | * @param player to withdraw from 201 | * @param worldName - name of the world 202 | * @param amount Amount to withdraw 203 | * @return Detailed response of transaction 204 | */ 205 | public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount); 206 | 207 | /** 208 | * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead. 209 | */ 210 | @Deprecated 211 | public EconomyResponse depositPlayer(String playerName, double amount); 212 | 213 | /** 214 | * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS 215 | * 216 | * @param player to deposit to 217 | * @param amount Amount to deposit 218 | * @return Detailed response of transaction 219 | */ 220 | public EconomyResponse depositPlayer(OfflinePlayer player, double amount); 221 | 222 | /** 223 | * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead. 224 | */ 225 | @Deprecated 226 | public EconomyResponse depositPlayer(String playerName, String worldName, double amount); 227 | 228 | /** 229 | * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS 230 | * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned. 231 | * 232 | * @param player to deposit to 233 | * @param worldName name of the world 234 | * @param amount Amount to deposit 235 | * @return Detailed response of transaction 236 | */ 237 | public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount); 238 | 239 | /** 240 | * @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead. 241 | */ 242 | @Deprecated 243 | public EconomyResponse createBank(String name, String player); 244 | 245 | /** 246 | * Creates a bank account with the specified name and the player as the owner 247 | * @param name of account 248 | * @param player the account should be linked to 249 | * @return EconomyResponse Object 250 | */ 251 | public EconomyResponse createBank(String name, OfflinePlayer player); 252 | 253 | /** 254 | * Deletes a bank account with the specified name. 255 | * @param name of the back to delete 256 | * @return if the operation completed successfully 257 | */ 258 | public EconomyResponse deleteBank(String name); 259 | 260 | /** 261 | * Returns the amount the bank has 262 | * @param name of the account 263 | * @return EconomyResponse Object 264 | */ 265 | public EconomyResponse bankBalance(String name); 266 | 267 | /** 268 | * Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS 269 | * 270 | * @param name of the account 271 | * @param amount to check for 272 | * @return EconomyResponse Object 273 | */ 274 | public EconomyResponse bankHas(String name, double amount); 275 | 276 | /** 277 | * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS 278 | * 279 | * @param name of the account 280 | * @param amount to withdraw 281 | * @return EconomyResponse Object 282 | */ 283 | public EconomyResponse bankWithdraw(String name, double amount); 284 | 285 | /** 286 | * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS 287 | * 288 | * @param name of the account 289 | * @param amount to deposit 290 | * @return EconomyResponse Object 291 | */ 292 | public EconomyResponse bankDeposit(String name, double amount); 293 | 294 | /** 295 | * @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead. 296 | */ 297 | @Deprecated 298 | public EconomyResponse isBankOwner(String name, String playerName); 299 | 300 | /** 301 | * Check if a player is the owner of a bank account 302 | * 303 | * @param name of the account 304 | * @param player to check for ownership 305 | * @return EconomyResponse Object 306 | */ 307 | public EconomyResponse isBankOwner(String name, OfflinePlayer player); 308 | 309 | /** 310 | * @deprecated As of VaultAPI 1.4 use {{@link #isBankMember(String, OfflinePlayer)} instead. 311 | */ 312 | @Deprecated 313 | public EconomyResponse isBankMember(String name, String playerName); 314 | 315 | /** 316 | * Check if the player is a member of the bank account 317 | * 318 | * @param name of the account 319 | * @param player to check membership 320 | * @return EconomyResponse Object 321 | */ 322 | public EconomyResponse isBankMember(String name, OfflinePlayer player); 323 | 324 | /** 325 | * Gets the list of banks 326 | * @return the List of Banks 327 | */ 328 | public List getBanks(); 329 | 330 | /** 331 | * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer)} instead. 332 | */ 333 | @Deprecated 334 | public boolean createPlayerAccount(String playerName); 335 | 336 | /** 337 | * Attempts to create a player account for the given player 338 | * @param player OfflinePlayer 339 | * @return if the account creation was successful 340 | */ 341 | public boolean createPlayerAccount(OfflinePlayer player); 342 | 343 | /** 344 | * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer, String)} instead. 345 | */ 346 | @Deprecated 347 | public boolean createPlayerAccount(String playerName, String worldName); 348 | 349 | /** 350 | * Attempts to create a player account for the given player on the specified world 351 | * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then false will always be returned. 352 | * @param player OfflinePlayer 353 | * @param worldName String name of the world 354 | * @return if the account creation was successful 355 | */ 356 | public boolean createPlayerAccount(OfflinePlayer player, String worldName); 357 | } 358 | -------------------------------------------------------------------------------- /src/main/java/net/milkbowl/vault/economy/EconomyResponse.java: -------------------------------------------------------------------------------- 1 | /* This file is part of Vault. 2 | 3 | Vault is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Vault is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with Vault. If not, see . 15 | */ 16 | package net.milkbowl.vault.economy; 17 | 18 | /** 19 | * Indicates a typical Return for an Economy method. 20 | * It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows 21 | * the method, or if the operation was a success or failure. 22 | * 23 | */ 24 | public class EconomyResponse { 25 | 26 | /** 27 | * Enum for types of Responses indicating the status of a method call. 28 | */ 29 | public static enum ResponseType { 30 | SUCCESS(1), 31 | FAILURE(2), 32 | NOT_IMPLEMENTED(3); 33 | 34 | private int id; 35 | 36 | ResponseType(int id) { 37 | this.id = id; 38 | } 39 | 40 | int getId() { 41 | return id; 42 | } 43 | } 44 | 45 | /** 46 | * Amount modified by calling method 47 | */ 48 | public final double amount; 49 | /** 50 | * New balance of account 51 | */ 52 | public final double balance; 53 | /** 54 | * Success or failure of call. Using Enum of ResponseType to determine valid 55 | * outcomes 56 | */ 57 | public final ResponseType type; 58 | /** 59 | * Error message if the variable 'type' is ResponseType.FAILURE 60 | */ 61 | public final String errorMessage; 62 | 63 | /** 64 | * Constructor for EconomyResponse 65 | * @param amount Amount modified during operation 66 | * @param balance New balance of account 67 | * @param type Success or failure type of the operation 68 | * @param errorMessage Error message if necessary (commonly null) 69 | */ 70 | public EconomyResponse(double amount, double balance, ResponseType type, String errorMessage) { 71 | this.amount = amount; 72 | this.balance = balance; 73 | this.type = type; 74 | this.errorMessage = errorMessage; 75 | } 76 | 77 | /** 78 | * Checks if an operation was successful 79 | * @return Value 80 | */ 81 | public boolean transactionSuccess() { 82 | return type == ResponseType.SUCCESS; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/net/milkbowl/vault/permission/Permission.java: -------------------------------------------------------------------------------- 1 | /* This file is part of Vault. 2 | 3 | Vault is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Vault is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with Vault. If not, see . 15 | */ 16 | package net.milkbowl.vault.permission; 17 | 18 | import java.util.logging.Logger; 19 | 20 | import org.bukkit.OfflinePlayer; 21 | import org.bukkit.World; 22 | import org.bukkit.command.CommandSender; 23 | import org.bukkit.entity.Player; 24 | import org.bukkit.permissions.PermissionAttachment; 25 | import org.bukkit.permissions.PermissionAttachmentInfo; 26 | import org.bukkit.plugin.Plugin; 27 | 28 | /** 29 | * The main Permission API - allows for group and player based permission tests 30 | * 31 | */ 32 | public abstract class Permission { 33 | 34 | protected static final Logger log = Logger.getLogger("Minecraft"); 35 | protected Plugin plugin = null; 36 | 37 | /** 38 | * Gets name of permission method 39 | * @return Name of Permission Method 40 | */ 41 | abstract public String getName(); 42 | 43 | /** 44 | * Checks if permission method is enabled. 45 | * @return Success or Failure 46 | */ 47 | abstract public boolean isEnabled(); 48 | 49 | /** 50 | * Returns if the permission system is or attempts to be compatible with super-perms. 51 | * @return True if this permission implementation works with super-perms 52 | */ 53 | abstract public boolean hasSuperPermsCompat(); 54 | 55 | /** 56 | * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. 57 | */ 58 | @Deprecated 59 | public boolean has(String world, String player, String permission) { 60 | if (world == null) { 61 | return playerHas((String) null, player, permission); 62 | } 63 | return playerHas(world, player, permission); 64 | } 65 | 66 | /** 67 | * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. 68 | */ 69 | @Deprecated 70 | public boolean has(World world, String player, String permission) { 71 | if (world == null) { 72 | return playerHas((String) null, player, permission); 73 | } 74 | return playerHas(world.getName(), player, permission); 75 | } 76 | 77 | /** 78 | * Checks if a CommandSender has a permission node. 79 | * This will return the result of bukkits, generic .hasPermission() method and is identical in all cases. 80 | * This method will explicitly fail if the registered permission system does not register permissions in bukkit. 81 | * 82 | * For easy checking of a commandsender 83 | * @param sender to check permissions on 84 | * @param permission to check for 85 | * @return true if the sender has the permission 86 | */ 87 | public boolean has(CommandSender sender, String permission) { 88 | return sender.hasPermission(permission); 89 | } 90 | 91 | /** 92 | * Checks if player has a permission node. (Short for playerHas(...) 93 | * @param player Player Object 94 | * @param permission Permission node 95 | * @return Success or Failure 96 | */ 97 | public boolean has(Player player, String permission) { 98 | return player.hasPermission(permission); 99 | } 100 | 101 | /** 102 | * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. 103 | */ 104 | @Deprecated 105 | abstract public boolean playerHas(String world, String player, String permission); 106 | 107 | /** 108 | * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. 109 | */ 110 | @Deprecated 111 | public boolean playerHas(World world, String player, String permission) { 112 | if (world == null) { 113 | return playerHas((String) null, player, permission); 114 | } 115 | return playerHas(world.getName(), player, permission); 116 | } 117 | 118 | /** 119 | * Checks if player has a permission node. 120 | * Supports NULL value for World if the permission system registered supports global permissions. 121 | * But May return odd values if the servers registered permission system does not have a global permission store. 122 | * 123 | * @param world String world name 124 | * @param player to check 125 | * @param permission Permission node 126 | * @return Success or Failure 127 | */ 128 | public boolean playerHas(String world, OfflinePlayer player, String permission) { 129 | if (world == null) { 130 | return has((String) null, player.getName(), permission); 131 | } 132 | return has(world, player.getName(), permission); 133 | } 134 | 135 | /** 136 | * Checks if player has a permission node. 137 | * Defaults to world-specific permission check if the permission system supports it. 138 | * See {@link #playerHas(String, OfflinePlayer, String)} for explicit global or world checks. 139 | * 140 | * @param player Player Object 141 | * @param permission Permission node 142 | * @return Success or Failure 143 | */ 144 | public boolean playerHas(Player player, String permission) { 145 | return has(player, permission); 146 | } 147 | 148 | /** 149 | * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. 150 | * Add permission to a player. 151 | * Supports NULL value for World if the permission system registered supports global permissions. 152 | * But May return odd values if the servers registered permission system does not have a global permission store. 153 | * 154 | * @param world World name 155 | * @param player Player name 156 | * @param permission Permission node 157 | * @return Success or Failure 158 | */ 159 | @Deprecated 160 | abstract public boolean playerAdd(String world, String player, String permission); 161 | 162 | /** 163 | * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. 164 | */ 165 | @Deprecated 166 | public boolean playerAdd(World world, String player, String permission) { 167 | if (world == null) { 168 | return playerAdd((String) null, player, permission); 169 | } 170 | return playerAdd(world.getName(), player, permission); 171 | } 172 | 173 | /** 174 | * Add permission to a player. 175 | * Supports NULL value for World if the permission system registered supports global permissions. 176 | * But May return odd values if the servers registered permission system does not have a global permission store. 177 | * 178 | * @param world String world name 179 | * @param player to add to 180 | * @param permission Permission node 181 | * @return Success or Failure 182 | */ 183 | public boolean playerAdd(String world, OfflinePlayer player, String permission) { 184 | if (world == null) { 185 | return playerAdd((String) null, player.getName(), permission); 186 | } 187 | return playerAdd(world, player.getName(), permission); 188 | } 189 | 190 | /** 191 | * Add permission to a player ONLY for the world the player is currently on. 192 | * This is a world-specific operation, if you want to add global permission you must explicitly use NULL for the world. 193 | * See {@link #playerAdd(String, OfflinePlayer, String)} for global permission use. 194 | * 195 | * @param player Player Object 196 | * @param permission Permission node 197 | * @return Success or Failure 198 | */ 199 | public boolean playerAdd(Player player, String permission) { 200 | return playerAdd(player.getWorld().getName(), player, permission); 201 | } 202 | 203 | /** 204 | * Add transient permission to a player. 205 | * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. 206 | * one that only needs the built-in Bukkit API to add transient permissions to a player. 207 | * 208 | * @param player to add to 209 | * @param permission Permission node 210 | * @return Success or Failure 211 | */ 212 | public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException { 213 | if (player.isOnline()) { 214 | return playerAddTransient((Player) player, permission); 215 | } 216 | throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!"); 217 | } 218 | 219 | /** 220 | * Add transient permission to a player. 221 | * This operation adds a permission onto the player object in bukkit via Bukkit's permission interface. 222 | * 223 | * @param player Player Object 224 | * @param permission Permission node 225 | * @return Success or Failure 226 | */ 227 | public boolean playerAddTransient(Player player, String permission) { 228 | for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { 229 | if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { 230 | paInfo.getAttachment().setPermission(permission, true); 231 | return true; 232 | } 233 | } 234 | 235 | PermissionAttachment attach = player.addAttachment(plugin); 236 | attach.setPermission(permission, true); 237 | 238 | return true; 239 | } 240 | 241 | /** 242 | * Adds a world specific transient permission to the player, may only work with some permission managers. 243 | * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! 244 | * 245 | * @param worldName to check on 246 | * @param player to add to 247 | * @param permission to test 248 | * @return Success or Failure 249 | */ 250 | public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) { 251 | return playerAddTransient(player, permission); 252 | } 253 | 254 | /** 255 | * Adds a world specific transient permission to the player, may only work with some permission managers. 256 | * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! 257 | * 258 | * @param worldName to check on 259 | * @param player to check 260 | * @param permission to check for 261 | * @return Success or Failure 262 | */ 263 | public boolean playerAddTransient(String worldName, Player player, String permission) { 264 | return playerAddTransient(player, permission); 265 | } 266 | 267 | /** 268 | * Removes a world specific transient permission from the player, may only work with some permission managers. 269 | * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! 270 | * 271 | * @param worldName to remove for 272 | * @param player to remove for 273 | * @param permission to remove 274 | * @return Success or Failure 275 | */ 276 | public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) { 277 | return playerRemoveTransient(player, permission); 278 | } 279 | 280 | /** 281 | * Removes a world specific transient permission from the player, may only work with some permission managers. 282 | * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! 283 | * 284 | * @param worldName to check on 285 | * @param player to check 286 | * @param permission to check for 287 | * @return Success or Failure 288 | */ 289 | public boolean playerRemoveTransient(String worldName, Player player, String permission) { 290 | return playerRemoveTransient((OfflinePlayer) player, permission); 291 | } 292 | 293 | /** 294 | * @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead. 295 | */ 296 | @Deprecated 297 | abstract public boolean playerRemove(String world, String player, String permission); 298 | 299 | /** 300 | * Remove permission from a player. 301 | * Supports NULL value for World if the permission system registered supports global permissions. 302 | * But May return odd values if the servers registered permission system does not have a global permission store. 303 | * 304 | * @param world World name 305 | * @param player OfflinePlayer 306 | * @param permission Permission node 307 | * @return Success or Failure 308 | */ 309 | public boolean playerRemove(String world, OfflinePlayer player, String permission) { 310 | if (world == null) { 311 | return playerRemove((String) null, player.getName(), permission); 312 | } 313 | return playerRemove(world, player.getName(), permission); 314 | } 315 | 316 | /** 317 | * Remove permission from a player. 318 | * Supports NULL value for World if the permission system registered supports global permissions. 319 | * But May return odd values if the servers registered permission system does not have a global permission store. 320 | * 321 | * @param world World name 322 | * @param player Player name 323 | * @param permission Permission node 324 | * @return Success or Failure 325 | */ 326 | @Deprecated 327 | public boolean playerRemove(World world, String player, String permission) { 328 | if (world == null) { 329 | return playerRemove((String) null, player, permission); 330 | } 331 | return playerRemove(world.getName(), player, permission); 332 | } 333 | 334 | /** 335 | * Remove permission from a player. 336 | * Will attempt to remove permission from the player on the player's current world. This is NOT a global operation. 337 | * 338 | * @param player Player Object 339 | * @param permission Permission node 340 | * @return Success or Failure 341 | */ 342 | public boolean playerRemove(Player player, String permission) { 343 | return playerRemove(player.getWorld().getName(), player, permission); 344 | } 345 | 346 | 347 | /** 348 | * Remove transient permission from a player. 349 | * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. 350 | * one that only needs the built-in Bukkit API to remove transient permissions from a player. Any subclass 351 | * implementing a plugin which provides its own API for this needs to override this method. 352 | * 353 | * @param player OfflinePlayer 354 | * @param permission Permission node 355 | * @return Success or Failure 356 | */ 357 | public boolean playerRemoveTransient(OfflinePlayer player, String permission) { 358 | if (player.isOnline()) { 359 | return playerRemoveTransient((Player) player, permission); 360 | } else { 361 | return false; 362 | } 363 | } 364 | 365 | /** 366 | * Remove transient permission from a player. 367 | * 368 | * @param player Player Object 369 | * @param permission Permission node 370 | * @return Success or Failure 371 | */ 372 | public boolean playerRemoveTransient(Player player, String permission) { 373 | for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { 374 | if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { 375 | paInfo.getAttachment().unsetPermission(permission); 376 | return true; 377 | } 378 | } 379 | return false; 380 | } 381 | 382 | /** 383 | * Checks if group has a permission node. 384 | * Supports NULL value for World if the permission system registered supports global permissions. 385 | * But May return odd values if the servers registered permission system does not have a global permission store. 386 | * 387 | * @param world World name 388 | * @param group Group name 389 | * @param permission Permission node 390 | * @return Success or Failure 391 | */ 392 | abstract public boolean groupHas(String world, String group, String permission); 393 | 394 | /** 395 | * Checks if group has a permission node. 396 | * Supports NULL value for World if the permission system registered supports global permissions. 397 | * But May return odd values if the servers registered permission system does not have a global permission store. 398 | * 399 | * @param world World Object 400 | * @param group Group name 401 | * @param permission Permission node 402 | * @return Success or Failure 403 | */ 404 | public boolean groupHas(World world, String group, String permission) { 405 | if (world == null) { 406 | return groupHas((String) null, group, permission); 407 | } 408 | return groupHas(world.getName(), group, permission); 409 | } 410 | 411 | /** 412 | * Add permission to a group. 413 | * Supports NULL value for World if the permission system registered supports global permissions. 414 | * But May return odd values if the servers registered permission system does not have a global permission store. 415 | * 416 | * @param world World name 417 | * @param group Group name 418 | * @param permission Permission node 419 | * @return Success or Failure 420 | */ 421 | abstract public boolean groupAdd(String world, String group, String permission); 422 | 423 | /** 424 | * Add permission to a group. 425 | * Supports NULL value for World if the permission system registered supports global permissions. 426 | * But May return odd values if the servers registered permission system does not have a global permission store. 427 | * 428 | * @param world World Object 429 | * @param group Group name 430 | * @param permission Permission node 431 | * @return Success or Failure 432 | */ 433 | public boolean groupAdd(World world, String group, String permission) { 434 | if (world == null) { 435 | return groupAdd((String) null, group, permission); 436 | } 437 | return groupAdd(world.getName(), group, permission); 438 | } 439 | 440 | /** 441 | * Remove permission from a group. 442 | * Supports NULL value for World if the permission system registered supports global permissions. 443 | * But May return odd values if the servers registered permission system does not have a global permission store. 444 | * 445 | * @param world World name 446 | * @param group Group name 447 | * @param permission Permission node 448 | * @return Success or Failure 449 | */ 450 | abstract public boolean groupRemove(String world, String group, String permission); 451 | 452 | /** 453 | * Remove permission from a group. 454 | * Supports NULL value for World if the permission system registered supports global permissions. 455 | * But May return odd values if the servers registered permission system does not have a global permission store. 456 | * 457 | * @param world World Object 458 | * @param group Group name 459 | * @param permission Permission node 460 | * @return Success or Failure 461 | */ 462 | public boolean groupRemove(World world, String group, String permission) { 463 | if (world == null) { 464 | return groupRemove((String) null, group, permission); 465 | } 466 | return groupRemove(world.getName(), group, permission); 467 | } 468 | 469 | /** 470 | * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. 471 | */ 472 | @Deprecated 473 | abstract public boolean playerInGroup(String world, String player, String group); 474 | 475 | /** 476 | * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. 477 | */ 478 | @Deprecated 479 | public boolean playerInGroup(World world, String player, String group) { 480 | if (world == null) { 481 | return playerInGroup((String) null, player, group); 482 | } 483 | return playerInGroup(world.getName(), player, group); 484 | } 485 | 486 | /** 487 | * Check if player is member of a group. 488 | * Supports NULL value for World if the permission system registered supports global permissions. 489 | * But May return odd values if the servers registered permission system does not have a global permission store. 490 | * 491 | * @param world World Object 492 | * @param player to check 493 | * @param group Group name 494 | * @return Success or Failure 495 | */ 496 | public boolean playerInGroup(String world, OfflinePlayer player, String group) { 497 | if (world == null) { 498 | return playerInGroup((String) null, player.getName(), group); 499 | } 500 | return playerInGroup(world, player.getName(), group); 501 | } 502 | 503 | /** 504 | * Check if player is member of a group. 505 | * This method will ONLY check groups for which the player is in that are defined for the current world. 506 | * This may result in odd return behaviour depending on what permission system has been registered. 507 | * 508 | * @param player Player Object 509 | * @param group Group name 510 | * @return Success or Failure 511 | */ 512 | public boolean playerInGroup(Player player, String group) { 513 | return playerInGroup(player.getWorld().getName(), player, group); 514 | } 515 | 516 | /** 517 | * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. 518 | */ 519 | @Deprecated 520 | abstract public boolean playerAddGroup(String world, String player, String group); 521 | 522 | /** 523 | * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. 524 | */ 525 | @Deprecated 526 | public boolean playerAddGroup(World world, String player, String group) { 527 | if (world == null) { 528 | return playerAddGroup((String) null, player, group); 529 | } 530 | return playerAddGroup(world.getName(), player, group); 531 | } 532 | 533 | /** 534 | * Add player to a group. 535 | * Supports NULL value for World if the permission system registered supports global permissions. 536 | * But May return odd values if the servers registered permission system does not have a global permission store. 537 | * 538 | * @param world String world name 539 | * @param player to add 540 | * @param group Group name 541 | * @return Success or Failure 542 | */ 543 | public boolean playerAddGroup(String world, OfflinePlayer player, String group) { 544 | if (world == null) { 545 | return playerAddGroup((String) null, player.getName(), group); 546 | } 547 | return playerAddGroup(world, player.getName(), group); 548 | } 549 | 550 | /** 551 | * Add player to a group. 552 | * This will add a player to the group on the current World. This may return odd results if the permission system 553 | * being used on the server does not support world-specific groups, or if the group being added to is a global group. 554 | * 555 | * @param player Player Object 556 | * @param group Group name 557 | * @return Success or Failure 558 | */ 559 | public boolean playerAddGroup(Player player, String group) { 560 | return playerAddGroup(player.getWorld().getName(), player, group); 561 | } 562 | 563 | /** 564 | * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. 565 | */ 566 | @Deprecated 567 | abstract public boolean playerRemoveGroup(String world, String player, String group); 568 | 569 | /** 570 | * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. 571 | */ 572 | @Deprecated 573 | public boolean playerRemoveGroup(World world, String player, String group) { 574 | if (world == null) { 575 | return playerRemoveGroup((String) null, player, group); 576 | } 577 | return playerRemoveGroup(world.getName(), player, group); 578 | } 579 | 580 | /** 581 | * Remove player from a group. 582 | * Supports NULL value for World if the permission system registered supports global permissions. 583 | * But May return odd values if the servers registered permission system does not have a global permission store. 584 | * 585 | * @param world World Object 586 | * @param player to remove 587 | * @param group Group name 588 | * @return Success or Failure 589 | */ 590 | public boolean playerRemoveGroup(String world, OfflinePlayer player, String group) { 591 | if (world == null) { 592 | return playerRemoveGroup((String) null, player.getName(), group); 593 | } 594 | return playerRemoveGroup(world, player.getName(), group); 595 | } 596 | 597 | /** 598 | * Remove player from a group. 599 | * This will add a player to the group on the current World. This may return odd results if the permission system 600 | * being used on the server does not support world-specific groups, or if the group being added to is a global group. 601 | * 602 | * @param player Player Object 603 | * @param group Group name 604 | * @return Success or Failure 605 | */ 606 | public boolean playerRemoveGroup(Player player, String group) { 607 | return playerRemoveGroup(player.getWorld().getName(), player, group); 608 | } 609 | 610 | /** 611 | * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. 612 | */ 613 | @Deprecated 614 | abstract public String[] getPlayerGroups(String world, String player); 615 | 616 | /** 617 | * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. 618 | */ 619 | @Deprecated 620 | public String[] getPlayerGroups(World world, String player) { 621 | if (world == null) { 622 | return getPlayerGroups((String) null, player); 623 | } 624 | return getPlayerGroups(world.getName(), player); 625 | } 626 | 627 | /** 628 | * Gets the list of groups that this player has 629 | * Supports NULL value for World if the permission system registered supports global permissions. 630 | * But May return odd values if the servers registered permission system does not have a global permission store. 631 | * 632 | * @param world String world name 633 | * @param player OfflinePlayer 634 | * @return Array of groups 635 | */ 636 | public String[] getPlayerGroups(String world, OfflinePlayer player) { 637 | return getPlayerGroups(world, player.getName()); 638 | } 639 | 640 | /** 641 | * Returns a list of world-specific groups that this player is currently in. May return unexpected results if 642 | * you are looking for global groups, or if the registered permission system does not support world-specific groups. 643 | * See {@link #getPlayerGroups(String, OfflinePlayer)} for better control of World-specific or global groups. 644 | * 645 | * @param player Player Object 646 | * @return Array of groups 647 | */ 648 | public String[] getPlayerGroups(Player player) { 649 | return getPlayerGroups(player.getWorld().getName(), player); 650 | } 651 | 652 | /** 653 | * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. 654 | */ 655 | @Deprecated 656 | abstract public String getPrimaryGroup(String world, String player); 657 | 658 | /** 659 | * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. 660 | */ 661 | @Deprecated 662 | public String getPrimaryGroup(World world, String player) { 663 | if (world == null) { 664 | return getPrimaryGroup((String) null, player); 665 | } 666 | return getPrimaryGroup(world.getName(), player); 667 | } 668 | 669 | /** 670 | * Gets players primary group 671 | * Supports NULL value for World if the permission system registered supports global permissions. 672 | * But May return odd values if the servers registered permission system does not have a global permission store. 673 | * 674 | * @param world String world name 675 | * @param player to get from 676 | * @return Players primary group 677 | */ 678 | public String getPrimaryGroup(String world, OfflinePlayer player) { 679 | return getPrimaryGroup(world, player.getName()); 680 | } 681 | 682 | /** 683 | * Get players primary group. 684 | * Defaults to the players current world, so may return only world-specific groups. 685 | * In most cases {@link #getPrimaryGroup(String, OfflinePlayer)} is preferable. 686 | * 687 | * @param player Player Object 688 | * @return Players primary group 689 | */ 690 | public String getPrimaryGroup(Player player) { 691 | return getPrimaryGroup(player.getWorld().getName(), player); 692 | } 693 | 694 | /** 695 | * Returns a list of all known groups 696 | * @return an Array of String of all groups 697 | */ 698 | abstract public String[] getGroups(); 699 | 700 | /** 701 | * Returns true if the given implementation supports groups. 702 | * @return true if the implementation supports groups 703 | */ 704 | abstract public boolean hasGroupSupport(); 705 | } --------------------------------------------------------------------------------