mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-27 04:55:33 +01:00
coding style.
This commit is contained in:
parent
b52b2443ab
commit
2551f28e48
@ -77,15 +77,17 @@ public class VaultEco implements Method {
|
||||
}
|
||||
|
||||
public MethodAccount getAccount(String name) {
|
||||
if(!hasAccount(name))
|
||||
if(!hasAccount(name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new VaultAccount(name, this.economy);
|
||||
}
|
||||
|
||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||
if(!hasBankAccount(bank, name))
|
||||
if(!hasBankAccount(bank, name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new VaultBankAccount(bank, economy);
|
||||
}
|
||||
|
@ -108,8 +108,9 @@ public class Chat_DroxPerms extends Chat {
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Integer.valueOf(s);
|
||||
@ -126,8 +127,9 @@ public class Chat_DroxPerms extends Chat {
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Integer.valueOf(s);
|
||||
@ -144,8 +146,9 @@ public class Chat_DroxPerms extends Chat {
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Double.valueOf(s);
|
||||
@ -162,8 +165,9 @@ public class Chat_DroxPerms extends Chat {
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Double.valueOf(s);
|
||||
|
@ -134,8 +134,9 @@ public class Chat_bPermissions extends Chat {
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
@ -152,8 +153,9 @@ public class Chat_bPermissions extends Chat {
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
@ -170,8 +172,9 @@ public class Chat_bPermissions extends Chat {
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
@ -188,8 +191,9 @@ public class Chat_bPermissions extends Chat {
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
@ -222,9 +226,9 @@ public class Chat_bPermissions extends Chat {
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
else {
|
||||
} else {
|
||||
Boolean val = Boolean.valueOf(s);
|
||||
return val != null ? val : defaultValue;
|
||||
}
|
||||
|
@ -135,8 +135,9 @@ public class Chat_bPermissions2 extends Chat {
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
@ -153,8 +154,9 @@ public class Chat_bPermissions2 extends Chat {
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
@ -171,8 +173,9 @@ public class Chat_bPermissions2 extends Chat {
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
@ -189,8 +192,9 @@ public class Chat_bPermissions2 extends Chat {
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
|
||||
String s = getGroupInfoString(world, group, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
@ -207,9 +211,9 @@ public class Chat_bPermissions2 extends Chat {
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
else {
|
||||
} else {
|
||||
Boolean val = Boolean.valueOf(s);
|
||||
return val != null ? val : defaultValue;
|
||||
}
|
||||
|
@ -96,11 +96,13 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String player) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
if (p == null)
|
||||
if (p == null) {
|
||||
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
|
||||
}
|
||||
|
||||
if (!p.getWorld().getName().equals(world))
|
||||
if (!p.getWorld().getName().equals(world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return iChat.getPrefix(p);
|
||||
}
|
||||
@ -113,11 +115,13 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String player) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
if (p == null)
|
||||
if (p == null) {
|
||||
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
|
||||
}
|
||||
|
||||
if (!p.getWorld().getName().equals(world))
|
||||
if (!p.getWorld().getName().equals(world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return iChat.getSuffix(p);
|
||||
}
|
||||
@ -151,8 +155,9 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
String val = getPlayerInfoString(world, player, node, null);
|
||||
if (val == null)
|
||||
if (val == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
Integer i = defaultValue;
|
||||
try {
|
||||
@ -181,8 +186,9 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
String val = getPlayerInfoString(world, player, node, null);
|
||||
if (val == null)
|
||||
if (val == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
double d = defaultValue;
|
||||
try {
|
||||
@ -211,9 +217,9 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
|
||||
String val = getPlayerInfoString(world, player, node, null);
|
||||
if (val == null)
|
||||
if (val == null) {
|
||||
return defaultValue;
|
||||
else {
|
||||
} else {
|
||||
Boolean v = Boolean.valueOf(val);
|
||||
return v != null ? v : defaultValue;
|
||||
}
|
||||
@ -237,11 +243,13 @@ public class Chat_iChat extends Chat {
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
if (p == null)
|
||||
if (p == null) {
|
||||
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
|
||||
}
|
||||
|
||||
if (!p.getWorld().getName().equals(world))
|
||||
if (!p.getWorld().getName().equals(world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String val = iChat.getInfo(p, node);
|
||||
|
||||
|
@ -142,8 +142,9 @@ public class Chat_mChat extends Chat {
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Integer.valueOf(s);
|
||||
@ -170,8 +171,9 @@ public class Chat_mChat extends Chat {
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
|
||||
String s = getPlayerInfoString(world, player, node, null);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try {
|
||||
return Double.valueOf(s);
|
||||
|
@ -201,8 +201,9 @@ public class Economy_BOSE6 implements Economy {
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, String player) {
|
||||
boolean success = economy.addBankOwner(name, player, false);
|
||||
if (success)
|
||||
if (success) {
|
||||
return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, "");
|
||||
}
|
||||
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account.");
|
||||
}
|
||||
@ -217,23 +218,24 @@ public class Economy_BOSE6 implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas(String name, double amount) {
|
||||
if (!economy.bankExists(name))
|
||||
if (!economy.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
}
|
||||
|
||||
double bankMoney = economy.getBankMoney(name);
|
||||
if (bankMoney < amount)
|
||||
if (bankMoney < amount) {
|
||||
return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!");
|
||||
else
|
||||
} else {
|
||||
return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, "");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw(String name, double amount) {
|
||||
EconomyResponse er = bankHas(name, amount);
|
||||
if (!er.transactionSuccess())
|
||||
if (!er.transactionSuccess()) {
|
||||
return er;
|
||||
else {
|
||||
} else {
|
||||
economy.addBankMoney(name, (int) -amount, true);
|
||||
return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, "");
|
||||
}
|
||||
@ -241,9 +243,9 @@ public class Economy_BOSE6 implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit(String name, double amount) {
|
||||
if (!economy.bankExists(name))
|
||||
if (!economy.bankExists(name)) {
|
||||
return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
else {
|
||||
} else {
|
||||
economy.addBankMoney(name, (int) amount, true);
|
||||
return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, "");
|
||||
}
|
||||
@ -251,9 +253,9 @@ public class Economy_BOSE6 implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
if (!economy.bankExists(name))
|
||||
if (!economy.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
else if (economy.isBankOwner(name, playerName)) {
|
||||
} else if (economy.isBankOwner(name, playerName)) {
|
||||
return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, "");
|
||||
} else
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!");
|
||||
@ -261,9 +263,9 @@ public class Economy_BOSE6 implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
if (!economy.bankExists(name))
|
||||
if (!economy.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
else if (economy.isBankMember(name, playerName)) {
|
||||
} else if (economy.isBankMember(name, playerName)) {
|
||||
return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, "");
|
||||
} else
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!");
|
||||
@ -271,8 +273,9 @@ public class Economy_BOSE6 implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
if (!economy.bankExists(name))
|
||||
if (!economy.bankExists(name)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
}
|
||||
|
||||
double bankMoney = economy.getBankMoney(name);
|
||||
return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null);
|
||||
|
@ -185,10 +185,11 @@ public class Economy_Craftconomy implements Economy {
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
Bank bank = BankHandler.getBank(name);
|
||||
if (bank.hasEnough(amount))
|
||||
if (bank.hasEnough(amount)) {
|
||||
return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
|
||||
else
|
||||
} else {
|
||||
return new EconomyResponse(0, bank.getDefaultBalance(), ResponseType.FAILURE, "The bank does not have enough money!");
|
||||
}
|
||||
}
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
}
|
||||
@ -200,12 +201,10 @@ public class Economy_Craftconomy implements Economy {
|
||||
}
|
||||
|
||||
EconomyResponse er = bankHas(name, amount);
|
||||
if (!er.transactionSuccess())
|
||||
if (!er.transactionSuccess()) {
|
||||
return er;
|
||||
else
|
||||
{
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
} else {
|
||||
if (BankHandler.exists(name)) {
|
||||
Bank bank = BankHandler.getBank(name);
|
||||
double balance = bank.substractMoney(amount);
|
||||
return new EconomyResponse(0, balance, ResponseType.SUCCESS, "");
|
||||
@ -221,8 +220,7 @@ public class Economy_Craftconomy implements Economy {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
|
||||
}
|
||||
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
if (BankHandler.exists(name)) {
|
||||
Bank bank = BankHandler.getBank(name);
|
||||
double balance = bank.addMoney(amount);
|
||||
return new EconomyResponse(0, balance, ResponseType.SUCCESS, "");
|
||||
@ -232,11 +230,9 @@ public class Economy_Craftconomy implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
if (BankHandler.exists(name)) {
|
||||
Bank bank = BankHandler.getBank(name);
|
||||
if (bank.getOwner().equals(playerName))
|
||||
{
|
||||
if (bank.getOwner().equals(playerName)) {
|
||||
return new EconomyResponse(0, bank.getDefaultBalance(), ResponseType.SUCCESS, "");
|
||||
}
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "This player is not the owner of the bank!");
|
||||
@ -247,16 +243,13 @@ public class Economy_Craftconomy implements Economy {
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
EconomyResponse er = isBankOwner(name,playerName);
|
||||
if (er.transactionSuccess())
|
||||
if (er.transactionSuccess()) {
|
||||
return er;
|
||||
else
|
||||
{
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
} else {
|
||||
if (BankHandler.exists(name)) {
|
||||
Bank bank = BankHandler.getBank(name);
|
||||
Iterator<String> iterator = bank.getMembers().iterator();
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
while(iterator.hasNext()) {
|
||||
if (iterator.next().equals(playerName))
|
||||
return new EconomyResponse(0,bank.getDefaultBalance(), ResponseType.SUCCESS, "");
|
||||
}
|
||||
@ -268,8 +261,7 @@ public class Economy_Craftconomy implements Economy {
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
if (BankHandler.exists(name))
|
||||
{
|
||||
if (BankHandler.exists(name)) {
|
||||
return new EconomyResponse(0, BankHandler.getBank(name).getDefaultBalance(), ResponseType.SUCCESS, "");
|
||||
}
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
|
||||
|
@ -112,8 +112,9 @@ public class Economy_CurrencyCore implements Economy {
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
AccountContext account = this.currency.getAccountManager().getAccount(playerName);
|
||||
if (account == null)
|
||||
if (account == null) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return account.getBalance();
|
||||
}
|
||||
@ -121,10 +122,11 @@ public class Economy_CurrencyCore implements Economy {
|
||||
@Override
|
||||
public boolean has(String playerName, double amount) {
|
||||
AccountContext account = this.currency.getAccountManager().getAccount(playerName);
|
||||
if (account == null)
|
||||
if (account == null) {
|
||||
return false;
|
||||
else
|
||||
} else {
|
||||
return account.hasBalance(amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +123,9 @@ public class Economy_Gringotts implements Economy {
|
||||
@Override
|
||||
public boolean hasAccount(String playerName) {
|
||||
AccountHolder owner = gringotts.accountHolderFactory.getAccount(playerName);
|
||||
if (owner == null) return false;
|
||||
if (owner == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return gringotts.accounting.getAccount(owner) != null;
|
||||
}
|
||||
@ -131,7 +133,9 @@ public class Economy_Gringotts implements Economy {
|
||||
@Override
|
||||
public double getBalance(String playerName){
|
||||
AccountHolder owner = gringotts.accountHolderFactory.getAccount(playerName);
|
||||
if (owner == null) return 0;
|
||||
if (owner == null) {
|
||||
return 0;
|
||||
}
|
||||
Account account = gringotts.accounting.getAccount(owner);
|
||||
return account.balance();
|
||||
}
|
||||
@ -149,8 +153,9 @@ public class Economy_Gringotts implements Economy {
|
||||
}
|
||||
|
||||
AccountHolder accountHolder = gringotts.accountHolderFactory.getAccount(playerName);
|
||||
if (accountHolder == null)
|
||||
if (accountHolder == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, playerName + " is not a valid account holder.");
|
||||
}
|
||||
|
||||
Account account = gringotts.accounting.getAccount( accountHolder );
|
||||
|
||||
@ -171,16 +176,17 @@ public class Economy_Gringotts implements Economy {
|
||||
}
|
||||
|
||||
AccountHolder accountHolder = gringotts.accountHolderFactory.getAccount(playerName);
|
||||
if (accountHolder == null)
|
||||
if (accountHolder == null) {
|
||||
return new EconomyResponse(0, 0, ResponseType.FAILURE, playerName + " is not a valid account holder.");
|
||||
}
|
||||
|
||||
Account account = gringotts.accounting.getAccount( accountHolder );
|
||||
|
||||
if (account.add(amount))
|
||||
if (account.add(amount)) {
|
||||
return new EconomyResponse( amount, account.balance(), ResponseType.SUCCESS, null);
|
||||
else
|
||||
} else {
|
||||
return new EconomyResponse( 0, account.balance(), ResponseType.FAILURE, "Not enough capacity to store that amount!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,8 +126,9 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
@ -144,8 +145,9 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
@ -174,8 +176,9 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
|
||||
perms.addGroupPermission(worldName, groupName, permission);
|
||||
return true;
|
||||
@ -183,16 +186,18 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
perms.removeGroupPermission(worldName, groupName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
try {
|
||||
return perms.safeGetGroup(worldName, groupName).hasPermission(permission);
|
||||
} catch (Exception e) {
|
||||
@ -238,8 +243,9 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(String worldName, String player, String permission) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
try {
|
||||
perms.safeGetUser(worldName, player).addTransientPermission(permission);
|
||||
return true;
|
||||
@ -265,8 +271,9 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
||||
if (worldName == null)
|
||||
if (worldName == null) {
|
||||
worldName = "*";
|
||||
}
|
||||
|
||||
try {
|
||||
perms.safeGetUser(worldName, player).removeTransientPermission(permission);
|
||||
|
@ -92,12 +92,14 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.addPlayerNode(permission, player);
|
||||
return true;
|
||||
@ -105,12 +107,14 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, String player, String permission) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.removePlayerNode(permission, player);
|
||||
return true;
|
||||
@ -120,30 +124,36 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String world, String group, String permission) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set.getGroupNodes(group) == null)
|
||||
if (set.getGroupNodes(group) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return set.getGroupNodes(group).contains(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, String group, String permission) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set.getGroupNodes(group) == null)
|
||||
if (set.getGroupNodes(group) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.addNode(permission, group);
|
||||
return true;
|
||||
@ -151,15 +161,18 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String world, String group, String permission) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set.getGroupNodes(group) == null)
|
||||
if (set.getGroupNodes(group) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.removeNode(permission, group);
|
||||
return true;
|
||||
@ -167,30 +180,36 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, String player, String group) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set.getGroups(player) == null)
|
||||
if (set.getGroups(player) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return set.getGroups(player).contains(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, String player, String group) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set.getGroupNodes(group) == null)
|
||||
if (set.getGroupNodes(group) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.addGroup(player, group);
|
||||
return true;
|
||||
@ -198,12 +217,14 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, String player, String group) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set.removeGroup(player, group);
|
||||
return true;
|
||||
@ -211,12 +232,14 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String player) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> groups = set.getGroups(player);
|
||||
return groups == null ? null : groups.toArray(new String[0]);
|
||||
@ -224,18 +247,21 @@ public class Permission_bPermissions extends Permission {
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String player) {
|
||||
if (world == null)
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PermissionSet set = perms.getPermissionSet(world);
|
||||
if (set == null)
|
||||
if (set == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> groups = set.getGroups(player);
|
||||
if (groups == null || groups.isEmpty())
|
||||
if (groups == null || groups.isEmpty()) {
|
||||
return null;
|
||||
else
|
||||
} else {
|
||||
return groups.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,8 +94,9 @@ public class Permission_zPermissions extends Permission {
|
||||
if (p == null) {
|
||||
Map<String, Boolean> perms = service.getPlayerPermissions(world, null, player);
|
||||
Boolean value = perms.get(permission.toLowerCase());
|
||||
if (value != null)
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
// Use default at this point
|
||||
org.bukkit.permissions.Permission perm = Bukkit.getPluginManager().getPermission(permission);
|
||||
if (perm != null) {
|
||||
@ -129,12 +130,14 @@ public class Permission_zPermissions extends Permission {
|
||||
public boolean groupHas(String world, String group, String permission) {
|
||||
Map<String, Boolean> perms = service.getGroupPermissions(world, null, group);
|
||||
Boolean value = perms.get(permission.toLowerCase());
|
||||
if (value != null)
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
// Use default, if possible
|
||||
org.bukkit.permissions.Permission perm = Bukkit.getPluginManager().getPermission(permission);
|
||||
if (perm != null)
|
||||
if (perm != null) {
|
||||
return perm.getDefault().getValue(false); // OP flag assumed to be false...
|
||||
}
|
||||
// Who knows...
|
||||
return false;
|
||||
}
|
||||
@ -192,10 +195,11 @@ public class Permission_zPermissions extends Permission {
|
||||
public String getPrimaryGroup(String world, String player) {
|
||||
// Has no concept of primary group... use highest-priority assigned group instead
|
||||
List<String> groups = service.getPlayerAssignedGroups(player);
|
||||
if (!groups.isEmpty())
|
||||
if (!groups.isEmpty()) {
|
||||
return groups.get(0);
|
||||
else
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user