mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-23 11:05:48 +01:00
resolve merge conflicts with upstream
This commit is contained in:
commit
a2315b26cd
BIN
lib/XPBank.jar
BIN
lib/XPBank.jar
Binary file not shown.
Binary file not shown.
@ -485,7 +485,7 @@ public class Metrics {
|
||||
/**
|
||||
* Gets the graph's name
|
||||
*
|
||||
* @return
|
||||
* @return name of graph
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -511,7 +511,7 @@ public class Metrics {
|
||||
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
* @return
|
||||
* @return returns a Set of Plotter's
|
||||
*/
|
||||
public Set<Plotter> getPlotters() {
|
||||
return Collections.unmodifiableSet(plotters);
|
||||
@ -570,7 +570,7 @@ public class Metrics {
|
||||
/**
|
||||
* Get the current value for the plotted point
|
||||
*
|
||||
* @return
|
||||
* @return returns value
|
||||
*/
|
||||
public abstract int getValue();
|
||||
|
||||
|
@ -29,7 +29,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import de.bananaco.bpermissions.api.ApiLayer;
|
||||
import de.bananaco.bpermissions.api.util.CalculableType;
|
||||
import de.bananaco.bpermissions.api.CalculableType;
|
||||
|
||||
public class Chat_bPermissions2 extends Chat {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
@ -100,11 +100,11 @@ public class Economy_MineConomy extends Economy {
|
||||
}
|
||||
|
||||
public String currencyNameSingular() {
|
||||
return "";
|
||||
return MCCom.getDefaultCurrency();
|
||||
}
|
||||
|
||||
public String currencyNamePlural() {
|
||||
return "";
|
||||
return MCCom.getDefaultCurrency();
|
||||
}
|
||||
|
||||
public double getBalance(String playerName) {
|
||||
@ -239,4 +239,4 @@ public class Economy_MineConomy extends Economy {
|
||||
public int fractionalDigits() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,264 +31,328 @@ import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.mirelatrue.xpbank.API;
|
||||
import com.gmail.mirelatrue.xpbank.Account;
|
||||
import com.gmail.mirelatrue.xpbank.GroupBank;
|
||||
import com.gmail.mirelatrue.xpbank.XPBank;
|
||||
|
||||
|
||||
public class Economy_XPBank extends Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private final String name = "XPBank";
|
||||
private Plugin plugin = null;
|
||||
private XPBank XPB = null;
|
||||
private final String name = "XPBank";
|
||||
private Plugin plugin = null;
|
||||
private XPBank XPB = null;
|
||||
private API api = null;
|
||||
|
||||
public Economy_XPBank(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (XPB == null) {
|
||||
Plugin economy = plugin.getServer().getPluginManager().getPlugin("XPBank");
|
||||
if (economy != null && economy.isEnabled()) {
|
||||
XPB = (XPBank) economy;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
public Economy_XPBank (Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
|
||||
|
||||
public class EconomyServerListener implements Listener {
|
||||
Economy_XPBank economy = null;
|
||||
// Load Plugin in case it was loaded before
|
||||
if (XPB == null) {
|
||||
Plugin economy = plugin.getServer().getPluginManager().getPlugin("XPBank");
|
||||
if (economy != null && economy.isEnabled()) {
|
||||
XPB = (XPBank) economy;
|
||||
api = XPB.getAPI();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EconomyServerListener(Economy_XPBank economy_XPBank) {
|
||||
this.economy = economy_XPBank;
|
||||
}
|
||||
|
||||
public class EconomyServerListener implements Listener {
|
||||
Economy_XPBank economy = null;
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.XPB == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("XPBank");
|
||||
public EconomyServerListener (Economy_XPBank economy_XPBank) {
|
||||
this.economy = economy_XPBank;
|
||||
}
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
economy.XPB = (XPBank) eco;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable (PluginEnableEvent event) {
|
||||
if (economy.XPB == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("XPBank");
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.XPB != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("XPBank")) {
|
||||
economy.XPB = null;
|
||||
log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
economy.XPB = (XPBank) eco;
|
||||
api = XPB.getAPI();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return this.XPB != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return String.format("%d %s", (int) amount, XPBank.currencyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNamePlural() {
|
||||
return XPBank.currencyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNameSingular() {
|
||||
return XPBank.currencyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
return XPB.getBalance(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String playerName, double amount) {
|
||||
if (XPB.getBalance(playerName) >= (int) amount) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
if (!XPB.playerExists(playerName)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player doesn't exist");
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = XPB.getBalance(playerName);
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Amount must be greater than zero");
|
||||
}
|
||||
|
||||
if (value > balance) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format("Insufficient %s", XPBank.currencyName));
|
||||
}
|
||||
|
||||
XPB.addToBalance(playerName, -value);
|
||||
|
||||
return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
if (!XPB.playerExists(playerName)) {
|
||||
// Stupid plugins that use fake players without creating them first...
|
||||
// return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player doesn't exist");
|
||||
this.createPlayerAccount(playerName);
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = XPB.getBalance(playerName);
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Amount must be greater than zero");
|
||||
}
|
||||
|
||||
XPB.addToBalance(playerName, value);
|
||||
|
||||
return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, String player) {
|
||||
if (XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, XPB.getBankBalance(name), ResponseType.FAILURE, "That account already exists");
|
||||
}
|
||||
|
||||
Boolean created = XPB.addBank(name);
|
||||
|
||||
if (!created) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There was an error creating the account");
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, 0, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deleteBank(String name) {
|
||||
if (!XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no account with that name");
|
||||
}
|
||||
|
||||
Boolean deleted = XPB.deleteBank(name);
|
||||
|
||||
if (!deleted) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There was an error deleting the account");
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, 0, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas(String name, double amount) {
|
||||
if (!XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no account with that name");
|
||||
}
|
||||
|
||||
int balance = XPB.getBankBalance(name);
|
||||
|
||||
if (balance >= (int) amount) {
|
||||
return new EconomyResponse(0, balance, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format("The account does not have that much %s", XPBank.currencyName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw(String name, double amount) {
|
||||
if (!XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no account with that name");
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = XPB.getBankBalance(name);
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Amount must be greater than zero");
|
||||
}
|
||||
|
||||
if (value > balance) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format("Insufficient %s", XPBank.currencyName));
|
||||
}
|
||||
|
||||
XPB.addToBankBalance(name, -value);
|
||||
|
||||
return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit(String name, double amount) {
|
||||
if (!XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no account with that name");
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = XPB.getBankBalance(name);
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, "Amount must be greater than zero");
|
||||
}
|
||||
|
||||
XPB.addToBankBalance(name, value);
|
||||
|
||||
return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "XPBank does not support assigning bank owners");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "XPBank does not support assigning bank members");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
if (!XPB.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no account with that name");
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, XPB.getBankBalance(name), ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBanks() {
|
||||
return XPB.getBanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBankSupport() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(String playerName) {
|
||||
return XPB.playerExists(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(String playerName) {
|
||||
return XPB.addPlayer(playerName);
|
||||
}
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable (PluginDisableEvent event) {
|
||||
if (economy.XPB != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("XPBank")) {
|
||||
economy.XPB = null;
|
||||
log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fractionalDigits() {
|
||||
public boolean isEnabled () {
|
||||
return this.XPB != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName () {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBankSupport () {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fractionalDigits () {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format (double amount) {
|
||||
return String.format("%d %s", (int) amount, api.currencyName((int) amount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNamePlural () {
|
||||
return api.getMsg("CurrencyNamePlural");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNameSingular () {
|
||||
return api.getMsg("currencyName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount (String playerName) {
|
||||
Account account = api.getAccount(playerName);
|
||||
|
||||
if (account != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance (String playerName) {
|
||||
Account account = api.getAccount(playerName);
|
||||
|
||||
return account.getBalance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has (String playerName, double amount) {
|
||||
Account account = api.getAccount(playerName);
|
||||
|
||||
if (account.getBalance() >= (int) amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer (String playerName, double amount) {
|
||||
Account account = api.getAccount(playerName);
|
||||
|
||||
if (account == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("Player doesn't exist."));
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = account.getBalance();
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
|
||||
}
|
||||
|
||||
if (value > balance) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
|
||||
}
|
||||
|
||||
account.modifyBalance(-value);
|
||||
|
||||
return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer (String playerName, double amount) {
|
||||
Account account = api.getAccount(playerName);
|
||||
|
||||
if (account == null) {
|
||||
// Stupid plugins that use fake players without creating them first...
|
||||
// return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player doesn't exist");
|
||||
this.createPlayerAccount(playerName);
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = account.getBalance();
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
|
||||
}
|
||||
|
||||
account.addTaxableIncome(value);
|
||||
|
||||
return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank (String name, String player) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank != null) {
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("GroupBankExists"), name));
|
||||
}
|
||||
|
||||
Account account = api.getAccount(player);
|
||||
|
||||
groupBank = api.createGroupBank(name, account);
|
||||
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deleteBank (String name) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
api.deleteGroupBank(groupBank, String.format(api.getMsg("Disbanded"), groupBank.getName()));
|
||||
|
||||
return new EconomyResponse(0, 0, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance (String name) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas (String name, double amount) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = groupBank.getBalance();
|
||||
|
||||
if (balance >= value) {
|
||||
return new EconomyResponse(0, balance, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw (String name, double amount) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = groupBank.getBalance();
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
|
||||
}
|
||||
|
||||
if (value > balance) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
|
||||
}
|
||||
|
||||
groupBank.modifyBalance(-value);
|
||||
|
||||
return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit (String name, double amount) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
int value = (int) amount;
|
||||
int balance = groupBank.getBalance();
|
||||
|
||||
if (value < 1) {
|
||||
return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
|
||||
}
|
||||
|
||||
groupBank.modifyBalance(value);
|
||||
|
||||
return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner (String name, String playerName) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
Account account = api.getAccount(name);
|
||||
|
||||
if (account == null) {
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, api.getMsg("PlayerNotExist"));
|
||||
}
|
||||
|
||||
if (groupBank.getOwner().equalsIgnoreCase(name)) {
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("PlayerNotOwner"), account.getName(), groupBank.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember (String name, String playerName) {
|
||||
GroupBank groupBank = api.getGroupBank(name);
|
||||
|
||||
if (groupBank == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
|
||||
}
|
||||
|
||||
Account account = api.getAccount(name);
|
||||
|
||||
if (account == null) {
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, api.getMsg("PlayerNotExist"));
|
||||
}
|
||||
|
||||
if (groupBank.groupMembers.getMembers().containsKey(playerName)) {
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("NotAMemberOf"), groupBank.getName(), account.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBanks () {
|
||||
return api.getAllGroupBanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount (String playerName) {
|
||||
api.createAccount(playerName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,6 @@ public abstract class Permission {
|
||||
* one that only needs the built-in Bukkit API to add transient permissions to a player. Any subclass
|
||||
* implementing a plugin which provides its own API for this needs to override this method.
|
||||
*
|
||||
* @param world World name
|
||||
* @param player Player name
|
||||
* @param permission Permission node
|
||||
* @return Success or Failure
|
||||
@ -232,10 +231,10 @@ public abstract class Permission {
|
||||
|
||||
/**
|
||||
* Adds a world specific transient permission to the player - ONLY WORKS IN PEX/P3 - otherwise it defaults to GLOBAL!
|
||||
* @param world
|
||||
* @param worldName
|
||||
* @param player
|
||||
* @param permission
|
||||
* @return
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean playerAddTransient(String worldName, Player player, String permission) {
|
||||
return playerAddTransient(player, permission);
|
||||
@ -243,10 +242,10 @@ public abstract class Permission {
|
||||
|
||||
/**
|
||||
* Adds a world specific transient permission to the player - ONLY WORKS IN PEX/P3 - otherwise it defaults to GLOBAL!
|
||||
* @param world
|
||||
* @param worldName
|
||||
* @param player
|
||||
* @param permission
|
||||
* @return
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean playerAddTransient(String worldName, String player, String permission) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
@ -258,10 +257,10 @@ public abstract class Permission {
|
||||
|
||||
/**
|
||||
* Removes a world specific transient permission from the player - Only works in PEX/P3 - otherwise it defaults to Global!
|
||||
* @param world
|
||||
* @param worldName
|
||||
* @param player
|
||||
* @param permission
|
||||
* @return
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
@ -276,7 +275,7 @@ public abstract class Permission {
|
||||
* @param worldName
|
||||
* @param player
|
||||
* @param permission
|
||||
* @return
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
|
||||
return playerRemoveTransient(player, permission);
|
||||
@ -326,7 +325,6 @@ public abstract class Permission {
|
||||
* one that only needs the built-in Bukkit API to remove transient permissions from a player. Any subclass
|
||||
* implementing a plugin which provides its own API for this needs to override this method.
|
||||
*
|
||||
* @param world World name
|
||||
* @param player Player name
|
||||
* @param permission Permission node
|
||||
* @return Success or Failure
|
||||
|
@ -33,8 +33,8 @@ import org.bukkit.plugin.Plugin;
|
||||
import de.bananaco.bpermissions.api.ApiLayer;
|
||||
import de.bananaco.bpermissions.api.World;
|
||||
import de.bananaco.bpermissions.api.WorldManager;
|
||||
import de.bananaco.bpermissions.api.util.Calculable;
|
||||
import de.bananaco.bpermissions.api.util.CalculableType;
|
||||
import de.bananaco.bpermissions.api.Calculable;
|
||||
import de.bananaco.bpermissions.api.CalculableType;
|
||||
|
||||
public class Permission_bPermissions2 extends Permission {
|
||||
|
||||
@ -121,7 +121,7 @@ public class Permission_bPermissions2 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
ApiLayer.addPermission(world, CalculableType.USER, player, de.bananaco.bpermissions.api.util.Permission.loadFromString(permission));
|
||||
ApiLayer.addPermission(world, CalculableType.USER, player, de.bananaco.bpermissions.api.Permission.loadFromString(permission));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public class Permission_bPermissions2 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, String group, String permission) {
|
||||
ApiLayer.addPermission(world, CalculableType.GROUP, group, de.bananaco.bpermissions.api.util.Permission.loadFromString(permission));
|
||||
ApiLayer.addPermission(world, CalculableType.GROUP, group, de.bananaco.bpermissions.api.Permission.loadFromString(permission));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user