Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support unsupported permissions plugins when Vault is used by falling…

… back to superperms style groups (group.xxx)
  • Loading branch information...
commit 8e4418aace75d16de8c1080db9a0b559d0086dc2 1 parent 58bc9cb
@Hidendra authored
View
9 src/main/java/com/griefcraft/integration/currency/VaultCurrency.java
@@ -56,7 +56,6 @@ private void checkEconomy() {
}
}
- @Override
public boolean isActive() {
// If the economy provider is still null it is possible it hasn't been hooked in yet
// So we just check for it again, since isActive() is called before any econ
@@ -68,43 +67,35 @@ public boolean isActive() {
return economy != null;
}
- @Override
public boolean usingCentralBank() {
return false;
}
- @Override
public String format(double money) {
return economy.format(money);
}
- @Override
public String getMoneyName() {
return economy.currencyNameSingular();
}
- @Override
public double getBalance(Player player) {
return economy.getBalance(player.getName());
}
- @Override
public boolean canAfford(Player player, double money) {
return economy.has(player.getName(), money);
}
- @Override
public boolean canCentralBankAfford(double money) {
return false;
}
- @Override
public double addMoney(Player player, double money) {
economy.depositPlayer(player.getName(), money);
return getBalance(player);
}
- @Override
public double removeMoney(Player player, double money) {
economy.withdrawPlayer(player.getName(), money);
return getBalance(player);
View
24 src/main/java/com/griefcraft/integration/permissions/VaultPermissions.java
@@ -29,24 +29,30 @@
package com.griefcraft.integration.permissions;
import net.milkbowl.vault.permission.Permission;
-
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
-import com.griefcraft.integration.IPermissions;
-
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public class VaultPermissions implements IPermissions {
+public class VaultPermissions extends SuperPermsPermissions {
+
+ @Override
public List<String> getGroups(Player player) {
RegisteredServiceProvider<Permission> serviceProvider = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
- if (serviceProvider == null)
- return new ArrayList<String>();
-
+
+ if (serviceProvider == null) {
+ return super.getGroups(player);
+ }
+
Permission perm = serviceProvider.getProvider();
- return Arrays.asList(perm.getPlayerGroups(player));
+
+ try {
+ return Arrays.asList(perm.getPlayerGroups(player));
+ } catch (UnsupportedOperationException e) {
+ return super.getGroups(player);
+ }
}
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.