Merge remote-tracking branch 'upstream/master'

This commit is contained in:
mung3r 2013-02-06 17:03:29 -08:00
commit 904c18c3b1
28 changed files with 220 additions and 231 deletions

View File

@ -4,8 +4,7 @@ version: 1.2.23-b${BUILD_NUMBER}
authors: [cereal, Sleaker, mung3r]
website: http://dev.bukkit.org/server-mods/vault
load: startup
description: >
Abstraction Library for Bukkit Plugins
description: Abstraction Library for Bukkit Plugins
commands:
vault-info:
description: Displays information about Vault

22
pom.xml
View File

@ -21,11 +21,9 @@
<systemPath>${project.basedir}/lib/DroxPerms-0.4.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>net.krinsoft.privileges</groupId>
<groupId>net.krinsoft</groupId>
<artifactId>Privileges</artifactId>
<version>1.7b127</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Privileges.jar</systemPath>
<version>1.7.4</version>
</dependency>
<dependency>
<groupId>org.tyrannyofheaven.bukkit</groupId>
@ -231,11 +229,9 @@
<systemPath>${project.basedir}/lib/Craftconomy.jar</systemPath>
</dependency>
<dependency>
<groupId>me.greatmancode</groupId>
<groupId>com.greatmancode</groupId>
<artifactId>craftconomy3</artifactId>
<version>3.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftconomy3.jar</systemPath>
<version>3.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.crystalyx.bukkit.simplyperms</groupId>
@ -371,9 +367,17 @@ iConomy 4,5,6 BOSEconomy 6/7, EssentialsEcon, 3Co, MultiConomy, MineConomy, Econ
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<repository>
<id>sdfeconomy-repo</id>
<url>http://omwah.sdf.org/maven/repo/snapshots/</url>
</repository>
<repository>
<id>greatman-repo</id>
<url>http://repo.greatmancode.com/content/groups/public/</url>
</repository>
<repository>
<id>krinsoft</id>
<url>http://files.krinsoft.net:8085/nexus/content/groups/public</url>
</repository>
</repositories>
</project>

View File

@ -31,8 +31,8 @@ public interface Economy {
public boolean isEnabled();
/**
* Gets name of permission method
* @return Name of Permission Method
* Gets name of economy method
* @return Name of Ecoomy Method
*/
public String getName();
@ -196,4 +196,4 @@ public interface Economy {
* @return if the account creation was successful
*/
public boolean createPlayerAccount(String playerName);
}
}

View File

@ -158,7 +158,7 @@ public class Economy_3co implements Economy {
if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("3co");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.economy = (ECO) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -126,7 +126,7 @@ public class Economy_AEco implements Economy {
if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("AEco");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.economy = AEco.ECONOMY;
try {
createWallet = economy.getClass().getMethod("createWallet", String.class);

View File

@ -171,7 +171,7 @@ public class Economy_BOSE6 implements Economy {
if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) {
if (bose != null && bose.getDescription().getVersion().startsWith("0.6")) {
economy.economy = (BOSEconomy) bose;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -132,7 +132,7 @@ public class Economy_BOSE7 implements Economy {
if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.7")) {
if (bose != null && bose.getDescription().getVersion().startsWith("0.7")) {
economy.economy = (BOSEconomy) bose;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -51,7 +51,7 @@ public class Economy_CommandsEX implements net.milkbowl.vault.economy.Economy {
if (economy.economy == null) {
Plugin cex = plugin.getServer().getPluginManager().getPlugin("CommandsEX");
if (cex != null && cex.isEnabled()) {
if (cex != null) {
economy.economy = (CommandsEX) cex;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -52,7 +52,7 @@ public class Economy_Craftconomy implements Economy {
// Load Plugin in case it was loaded before
if (economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) {
if (ec != null && ec.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) {
economy = (Craftconomy) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
}

View File

@ -71,7 +71,7 @@ public class Economy_Craftconomy3 implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
if (ec != null && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
economy.economy = (BukkitLoader) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}
@ -105,22 +105,22 @@ public class Economy_Craftconomy3 implements Economy {
@Override
public String format(double amount) {
return Common.getInstance().format(null, Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID), amount);
return Common.getInstance().format(null, Common.getInstance().getCurrencyManager().getDefaultCurrency(), amount);
}
@Override
public String currencyNameSingular() {
return Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName();
return Common.getInstance().getCurrencyManager().getDefaultCurrency().getName();
}
@Override
public String currencyNamePlural() {
return Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getPlural();
return Common.getInstance().getCurrencyManager().getDefaultCurrency().getPlural();
}
@Override
public double getBalance(String playerName) {
return Common.getInstance().getAccountManager().getAccount(playerName).getBalance(Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName());
return Common.getInstance().getAccountManager().getAccount(playerName).getBalance(Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
}
@Override
@ -131,8 +131,8 @@ public class Economy_Craftconomy3 implements Economy {
double balance;
Account account = Common.getInstance().getAccountManager().getAccount(playerName);
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName())) {
balance = account.withdraw(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName());
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
balance = account.withdraw(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "");
} else {
return new EconomyResponse(0, getBalance(playerName), ResponseType.FAILURE, "Insufficient funds");
@ -147,7 +147,7 @@ public class Economy_Craftconomy3 implements Economy {
Account account = Common.getInstance().getAccountManager().getAccount(playerName);
double balance = account.deposit(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName());
double balance = account.deposit(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);
}
@ -185,7 +185,7 @@ public class Economy_Craftconomy3 implements Economy {
if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + name)) {
Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + name);
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getCurrency(CurrencyManager.defaultCurrencyID).getName())) {
if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.SUCCESS, "");
} else {
return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.FAILURE, "The bank does not have enough money!");
@ -267,7 +267,7 @@ public class Economy_Craftconomy3 implements Economy {
ArrayList<String> list = new ArrayList<String>();
Iterator<AccountTable> iterator = accountList.iterator();
while (iterator.hasNext()) {
list.add(iterator.next().name.replaceFirst(Account.BANK_PREFIX, ""));
list.add(iterator.next().getName().replaceFirst(Account.BANK_PREFIX, ""));
}
return list;

View File

@ -27,144 +27,140 @@ import net.milkbowl.vault.economy.EconomyResponse;
public class Economy_Dosh implements Economy {
Plugin plugin;
Dosh doshPlugin;
boolean isEnabled = false;
DoshAPIHandler apiHandle;
public Economy_Dosh(Plugin _plugin) {
plugin = _plugin;
if (plugin.getServer().getPluginManager().isPluginEnabled("Dosh")) {
doshPlugin = (Dosh) plugin.getServer().getPluginManager().getPlugin("Dosh");
apiHandle = new DoshAPIHandler();
isEnabled = true;
} else {
return;
}
}
@Override
public boolean isEnabled() {
return isEnabled;
}
@Override
public String getName() {
return "Dosh";
}
@Override
public boolean hasBankSupport() {
return false;
}
Plugin plugin;
Dosh doshPlugin;
DoshAPIHandler apiHandle;
@Override
public int fractionalDigits() {
return 0;
}
public Economy_Dosh(Plugin _plugin) {
plugin = _plugin;
@Override
public String format(double amount) {
return null;
}
if (plugin.getServer().getPluginManager().isPluginEnabled("Dosh")) {
doshPlugin = (Dosh) plugin.getServer().getPluginManager().getPlugin("Dosh");
apiHandle = new DoshAPIHandler();
} else {
return;
}
}
@Override
public String currencyNamePlural() {
return Dosh.getSettings().moneyName + "s";
}
@Override
public boolean isEnabled() {
return apiHandle != null;
}
@Override
public String currencyNameSingular() {
return Dosh.getSettings().moneyName;
}
@Override
public String getName() {
return "Dosh";
}
@Override
public boolean hasAccount(String playerName) {
return true;
}
@Override
public boolean hasBankSupport() {
return false;
}
@Override
public double getBalance(String playerName) {
return DoshAPIHandler.getUserBal(playerName);
}
@Override
public int fractionalDigits() {
return 0;
}
@Override
public boolean has(String playerName, double amount) {
return (getBalance(playerName) - amount) > 0;
}
@Override
public String format(double amount) {
return null;
}
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
if (DoshAPIHandler.subtractMoney(playerName, amount)) {
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "Worked!");
}
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Didnt work!");
}
@Override
public String currencyNamePlural() {
return Dosh.getSettings().moneyName + "s";
}
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
DoshAPIHandler.addUserBal(playerName, amount);
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "It worked!");
}
@Override
public String currencyNameSingular() {
return Dosh.getSettings().moneyName;
}
@Override
public EconomyResponse createBank(String name, String player) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public boolean hasAccount(String playerName) {
return true;
}
@Override
public EconomyResponse deleteBank(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public double getBalance(String playerName) {
return DoshAPIHandler.getUserBal(playerName);
}
@Override
public EconomyResponse bankBalance(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public boolean has(String playerName, double amount) {
return (getBalance(playerName) - amount) > 0;
}
@Override
public EconomyResponse bankHas(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
if (DoshAPIHandler.subtractMoney(playerName, amount)) {
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "Worked!");
}
@Override
public EconomyResponse bankDeposit(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Didnt work!");
@Override
public EconomyResponse isBankOwner(String name, String playerName) {
return null;
}
}
@Override
public EconomyResponse isBankMember(String name, String playerName) {
return null;
}
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
DoshAPIHandler.addUserBal(playerName, amount);
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "It worked!");
}
@Override
public List<String> getBanks() {
return null;
}
@Override
public EconomyResponse createBank(String name, String player) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse deleteBank(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankBalance(String name) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankHas(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse bankDeposit(String name, double amount) {
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
}
@Override
public EconomyResponse isBankOwner(String name, String playerName) {
return null;
}
@Override
public EconomyResponse isBankMember(String name, String playerName) {
return null;
}
@Override
public List<String> getBanks() {
return null;
}
@Override
public boolean createPlayerAccount(String playerName) {
return false;
}
public class DoshAPIHandler extends MoneyUtils {}
@Override
public boolean createPlayerAccount(String playerName) {
return false;
}
public class DoshAPIHandler extends MoneyUtils {}
}

View File

@ -68,7 +68,7 @@ public class Economy_EconXP implements Economy {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.econ = (EconXP) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -184,7 +184,7 @@ public class Economy_Essentials implements Economy {
if (economy.ess == null) {
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials");
if (essentials != null && essentials.isEnabled()) {
if (essentials != null) {
economy.ess = (Essentials) essentials;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -112,7 +112,7 @@ public class Economy_GoldIsMoney implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -266,7 +266,7 @@ public class Economy_GoldIsMoney2 implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -67,7 +67,7 @@ public class Economy_Gringotts implements Economy {
if (economy.gringotts == null) {
Plugin grngts = plugin.getServer().getPluginManager().getPlugin("Gringotts");
if (grngts != null && grngts.isEnabled()) {
if (grngts != null) {
economy.gringotts = (Gringotts) grngts;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -113,7 +113,7 @@ public class Economy_McMoney implements Economy {
if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("McMoney");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.economy = McMoneyAPI.getInstance();
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -69,7 +69,7 @@ public class Economy_MineConomy implements Economy {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.econ = (MineConomy) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -159,7 +159,7 @@ public class Economy_MultiCurrency implements Economy {
if (economy.economy == null) {
Plugin mcur = plugin.getServer().getPluginManager().getPlugin("MultiCurrency");
if (mcur != null && mcur.isEnabled()) {
if (mcur != null) {
economy.economy = (Currency) mcur;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -73,7 +73,7 @@ public class Economy_XPBank implements Economy {
if (economy.XPB == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("XPBank");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.XPB = (XPBank) eco;
api = XPB.getAPI();
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));

View File

@ -65,7 +65,7 @@ public class Economy_eWallet implements Economy {
if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet");
if (eco != null && eco.isEnabled()) {
if (eco != null) {
economy.econ = (ECO) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -174,7 +174,7 @@ public class Economy_iConomy4 implements Economy {
if (economy.economy == null) {
Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy");
if (iConomy != null && iConomy.isEnabled() && iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) {
if (iConomy != null && iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) {
economy.economy = (iConomy) iConomy;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -116,7 +116,7 @@ public class Economy_iConomy5 implements Economy {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iConomy.iConomy")) {
if (ec != null && ec.getClass().getName().equals("com.iConomy.iConomy")) {
economy.economy = (iConomy) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}

View File

@ -73,7 +73,7 @@ public class Economy_iConomy6 implements Economy {
public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
if (ec != null && ec.getClass().getName().equals("com.iCo6.iConomy")) {
String version = ec.getDescription().getVersion().split("\\.")[0];
name += version;
economy.economy = (iConomy) ec;

View File

@ -50,11 +50,9 @@ public class Permission_GroupManager extends Permission {
// Load Plugin in case it was loaded before
if (groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
if (perms != null) {
if (perms.isEnabled()) {
groupManager = (GroupManager) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
if (perms != null && perms.isEnabled()) {
groupManager = (GroupManager) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
@ -70,12 +68,10 @@ public class Permission_GroupManager extends Permission {
public void onPluginEnable(PluginEnableEvent event) {
if (permission.groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
if (perms != null) {
if (perms.isEnabled()) {
permission.groupManager = (GroupManager) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
permission.groupManager = (GroupManager) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}

View File

@ -69,7 +69,7 @@ public class Permission_PermissionsEx extends Permission {
@Override
public boolean playerInGroup(String worldName, String playerName, String groupName) {
return PermissionsEx.getPermissionManager().getUser(playerName).inGroup(groupName);
return PermissionsEx.getPermissionManager().getUser(playerName).inGroup(groupName);
}
public class PermissionServerListener implements Listener {
@ -85,18 +85,16 @@ public class Permission_PermissionsEx extends Permission {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
if (perms != null) {
if (perms.isEnabled()) {
try {
if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) {
log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name));
return;
}
} catch (NumberFormatException e) {
// Do nothing
try {
if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) {
log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name));
return;
}
permission.permission = (PermissionsEx) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
} catch (NumberFormatException e) {
// Do nothing
}
permission.permission = (PermissionsEx) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}
@ -131,8 +129,8 @@ public class Permission_PermissionsEx extends Permission {
@Override
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
PermissionsEx.getPermissionManager().getUser(playerName).removeGroup(groupName);
return true;
PermissionsEx.getPermissionManager().getUser(playerName).removeGroup(groupName);
return true;
}
@Override
@ -215,7 +213,7 @@ public class Permission_PermissionsEx extends Permission {
return false;
}
}
@Override
public boolean playerAddTransient(String worldName, String player, String permission) {
PermissionUser pPlayer = PermissionsEx.getPermissionManager().getUser(player);
@ -226,62 +224,62 @@ public class Permission_PermissionsEx extends Permission {
return false;
}
}
@Override
public boolean playerAddTransient(String worldName, Player player, String permission) {
return playerAddTransient(worldName, player.getName(), permission);
return playerAddTransient(worldName, player.getName(), permission);
}
@Override
public boolean playerAddTransient(String player, String permission) {
return playerAddTransient(null, player, permission);
return playerAddTransient(null, player, permission);
}
@Override
public boolean playerAddTransient(Player player, String permission) {
return playerAddTransient(null, player.getName(), permission);
return playerAddTransient(null, player.getName(), permission);
}
@Override
public boolean playerRemoveTransient(String worldName, String player, String permission) {
PermissionUser pPlayer = PermissionsEx.getPermissionManager().getUser(player);
if (pPlayer != null) {
pPlayer.removeTimedPermission(permission, worldName);
return true;
} else {
return false;
}
PermissionUser pPlayer = PermissionsEx.getPermissionManager().getUser(player);
if (pPlayer != null) {
pPlayer.removeTimedPermission(permission, worldName);
return true;
} else {
return false;
}
}
@Override
public boolean playerRemoveTransient(Player player, String permission) {
return playerRemoveTransient(null, player.getName(), permission);
return playerRemoveTransient(null, player.getName(), permission);
}
@Override
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
return playerRemoveTransient(worldName, player.getName(), permission);
return playerRemoveTransient(worldName, player.getName(), permission);
}
@Override
public boolean playerRemoveTransient(String player, String permission) {
return playerRemoveTransient(null, player, permission);
}
@Override
public String[] getGroups() {
PermissionGroup[] groups = PermissionsEx.getPermissionManager().getGroups();
if (groups == null || groups.length == 0)
return null;
String[] groupNames = new String[groups.length];
for (int i = 0; i < groups.length; i++) {
groupNames[i] = groups[i].getName();
}
return groupNames;
}
@Override
public boolean playerRemoveTransient(String player, String permission) {
return playerRemoveTransient(null, player, permission);
}
@Override
public boolean hasSuperPermsCompat() {
return true;
}
@Override
public String[] getGroups() {
PermissionGroup[] groups = PermissionsEx.getPermissionManager().getGroups();
if (groups == null || groups.length == 0)
return null;
String[] groupNames = new String[groups.length];
for (int i = 0; i < groups.length; i++) {
groupNames[i] = groups[i].getName();
}
return groupNames;
}
@Override
public boolean hasSuperPermsCompat() {
return true;
}
}

View File

@ -47,10 +47,8 @@ public class Permission_Privileges extends Permission {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Privileges");
if (perms != null) {
if (perms.isEnabled()) {
permission.privs = (Privileges) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
permission.privs = (Privileges) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}

View File

@ -63,10 +63,8 @@ public class Permission_SimplyPerms extends Permission{
Plugin perms = plugin.getServer().getPluginManager().getPlugin("SimplyPerms");
if (perms != null) {
if (perms.isEnabled()) {
permission.perms = ((SimplyPlugin) perms).getAPI();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
permission.perms = ((SimplyPlugin) perms).getAPI();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}