mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-12-27 11:27:47 +01:00
Formatting
This commit is contained in:
parent
bfe8259216
commit
d783b66be0
@ -44,14 +44,14 @@ import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Vault extends JavaPlugin {
|
||||
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Remove all Service Registrations
|
||||
getServer().getServicesManager().unregisterAll(this);
|
||||
|
||||
|
||||
log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class Vault extends JavaPlugin {
|
||||
// Load Vault Addons
|
||||
loadEconomy();
|
||||
loadPermission();
|
||||
|
||||
|
||||
getCommand("vault-info").setExecutor(this);
|
||||
getCommand("vault-reload").setExecutor(this);
|
||||
log.info(String.format("[%s] Enabled Version %s", getDescription().getName(), getDescription().getVersion()));
|
||||
@ -71,14 +71,14 @@ public class Vault extends JavaPlugin {
|
||||
*/
|
||||
private void loadEconomy() {
|
||||
// Try to load 3co
|
||||
if(packageExists(new String[] { "me.ic3d.eco.ECO" })) {
|
||||
if (packageExists(new String[] { "me.ic3d.eco.ECO" })) {
|
||||
Economy econ = new Economy_3co(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.economy.Economy.class, econ, this, ServicePriority.Normal);
|
||||
log.info(String.format("[%s][Economy] 3co found: %s", getDescription().getName(), econ.isEnabled() ? "Loaded" : "Waiting"));
|
||||
} else {
|
||||
log.info(String.format("[%s][Economy] 3co not found.", getDescription().getName()));
|
||||
}
|
||||
|
||||
|
||||
// Try to load BOSEconomy
|
||||
if (packageExists(new String[] { "cosine.boseconomy.BOSEconomy" })) {
|
||||
Economy bose = new Economy_BOSE(this);
|
||||
@ -114,7 +114,7 @@ public class Vault extends JavaPlugin {
|
||||
} else {
|
||||
log.info(String.format("[%s][Economy] iConomy 5 not found.", getDescription().getName()));
|
||||
}
|
||||
|
||||
|
||||
// Try to load iConomy 6
|
||||
if (packageExists(new String[] { "com.iCo6.iConomy" })) {
|
||||
Economy icon6 = new Economy_iConomy6(this);
|
||||
@ -124,28 +124,28 @@ public class Vault extends JavaPlugin {
|
||||
log.info(String.format("[%s][Economy] iConomy 6 not found.", getDescription().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to load Permission Addons
|
||||
*/
|
||||
private void loadPermission() {
|
||||
// Try to load PermissionsEx
|
||||
if(packageExists(new String[] { "ru.tehkode.permissions.bukkit.PermissionsEx" })) {
|
||||
if (packageExists(new String[] { "ru.tehkode.permissions.bukkit.PermissionsEx" })) {
|
||||
Permission ePerms = new Permission_PermissionsEx(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, ePerms, this, ServicePriority.Normal);
|
||||
log.info(String.format("[%s][Permission] PermissionsEx found: %s", getDescription().getName(), ePerms.isEnabled() ? "Loaded" : "Waiting"));
|
||||
} else {
|
||||
log.info(String.format("[%s][Permission] PermissionsEx not found.", getDescription().getName()));
|
||||
}
|
||||
//Try to load GroupManager
|
||||
if(packageExists(new String[] { "org.anjocaido.groupmanager.GroupManager" })) {
|
||||
Permission gPerms = new Permission_GroupManager(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, gPerms, this, ServicePriority.Normal);
|
||||
log.info(String.format("[%s][Permission] GroupManager found: %s", getDescription().getName(), gPerms.isEnabled() ? "Loaded" : "Waiting"));
|
||||
// Try to load GroupManager
|
||||
if (packageExists(new String[] { "org.anjocaido.groupmanager.GroupManager" })) {
|
||||
Permission gPerms = new Permission_GroupManager(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, gPerms, this, ServicePriority.Normal);
|
||||
log.info(String.format("[%s][Permission] GroupManager found: %s", getDescription().getName(), gPerms.isEnabled() ? "Loaded" : "Waiting"));
|
||||
} else {
|
||||
log.info(String.format("[%s][Permission] GroupManager not found.", getDescription().getName()));
|
||||
}
|
||||
|
||||
|
||||
// Try to load Permissions 3 (Yeti)
|
||||
if (packageExists(new String[] { "com.nijiko.permissions.ModularControl" })) {
|
||||
Permission nPerms = new Permission_Permissions3(this);
|
||||
@ -154,26 +154,25 @@ public class Vault extends JavaPlugin {
|
||||
} else {
|
||||
log.info(String.format("[%s][Permission] Permissions 3 (Yeti) not found.", getDescription().getName()));
|
||||
}
|
||||
|
||||
//Try to load Permissions 2 (Phoenix)
|
||||
if (packageExists(new String[] { "com.nijiko.permissions.Control"} )) {
|
||||
Permission oPerms = new Permission_Permissions2(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Lowest);
|
||||
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting"));
|
||||
|
||||
// Try to load Permissions 2 (Phoenix)
|
||||
if (packageExists(new String[] { "com.nijiko.permissions.Control" })) {
|
||||
Permission oPerms = new Permission_Permissions2(this);
|
||||
getServer().getServicesManager().register(net.milkbowl.vault.permission.Permission.class, oPerms, this, ServicePriority.Lowest);
|
||||
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) found: %s", getDescription().getName(), oPerms.isEnabled() ? "Loaded" : "Waiting"));
|
||||
} else {
|
||||
log.info(String.format("[%s][Permission] Permissions 2 (Phoenix) not found.", getDescription().getName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||
if(sender instanceof Player) {
|
||||
if (sender instanceof Player) {
|
||||
// Check if Player
|
||||
// If so, ignore command if player is not Op
|
||||
Player p = (Player) sender;
|
||||
if(!p.isOp()) {
|
||||
if (!p.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (!(sender instanceof ConsoleCommandSender)) {
|
||||
@ -181,37 +180,37 @@ public class Vault extends JavaPlugin {
|
||||
// Ignore it if not originated from Console!
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (command.getLabel().equals("vault-info")) {
|
||||
|
||||
|
||||
// Get String of Registered Economy Services
|
||||
String registeredEcons = null;
|
||||
Collection<RegisteredServiceProvider<Economy>> econs = this.getServer().getServicesManager().getRegistrations(net.milkbowl.vault.economy.Economy.class);
|
||||
for(RegisteredServiceProvider<Economy> econ : econs) {
|
||||
for (RegisteredServiceProvider<Economy> econ : econs) {
|
||||
Economy e = econ.getProvider();
|
||||
if(registeredEcons == null) {
|
||||
if (registeredEcons == null) {
|
||||
registeredEcons = e.getName();
|
||||
} else {
|
||||
registeredEcons += ", " + e.getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get String of Registered Permission Services
|
||||
String registeredPerms = null;
|
||||
Collection<RegisteredServiceProvider<Permission>> perms = this.getServer().getServicesManager().getRegistrations(net.milkbowl.vault.permission.Permission.class);
|
||||
for(RegisteredServiceProvider<Permission> perm : perms) {
|
||||
for (RegisteredServiceProvider<Permission> perm : perms) {
|
||||
Permission p = perm.getProvider();
|
||||
if(registeredPerms == null) {
|
||||
if (registeredPerms == null) {
|
||||
registeredPerms = p.getName();
|
||||
} else {
|
||||
registeredPerms += ", " + p.getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get Economy & Permission primary Services
|
||||
Economy econ = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class).getProvider();
|
||||
Permission perm = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class).getProvider();
|
||||
|
||||
|
||||
// Send user some info!
|
||||
sender.sendMessage(String.format("[%s] Vault v%s Information", getDescription().getName(), getDescription().getVersion()));
|
||||
sender.sendMessage(String.format("[%s] Economy: %s [%s]", getDescription().getName(), econ.getName(), registeredEcons));
|
||||
@ -224,11 +223,12 @@ public class Vault extends JavaPlugin {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines if all packages in a String array are within the Classpath
|
||||
* This is the best way to determine if a specific plugin exists and will be loaded.
|
||||
* If the plugin package isn't loaded, we shouldn't bother waiting for it!
|
||||
* This is the best way to determine if a specific plugin exists and will be
|
||||
* loaded. If the plugin package isn't loaded, we shouldn't bother waiting
|
||||
* for it!
|
||||
* @param packages String Array of package names to check
|
||||
* @return Success or Failure
|
||||
*/
|
||||
|
@ -20,36 +20,35 @@
|
||||
package net.milkbowl.vault.economy;
|
||||
|
||||
public interface Economy {
|
||||
|
||||
|
||||
/**
|
||||
* Checks if economy method is enabled.
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
|
||||
|
||||
/**
|
||||
* Gets name of permission method
|
||||
* @return Name of Permission Method
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
|
||||
/**
|
||||
* Format amount into a human readable String
|
||||
* This provides translation into economy specific formatting
|
||||
* to improve consistency between plugins. Should be used when
|
||||
* possible.
|
||||
* Format amount into a human readable String This provides translation into
|
||||
* economy specific formatting to improve consistency between plugins.
|
||||
* Should be used when possible.
|
||||
* @param amount
|
||||
* @return Human readable string describing amount
|
||||
*/
|
||||
public String format(double amount);
|
||||
|
||||
|
||||
/**
|
||||
* Gets balance of a player
|
||||
* @param playerName
|
||||
* @return Amount currently held in players account
|
||||
*/
|
||||
public double getBalance(String playerName);
|
||||
|
||||
|
||||
/**
|
||||
* Withdraw an amount from a player
|
||||
* @param playerName Name of player
|
||||
@ -57,7 +56,7 @@ public interface Economy {
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount);
|
||||
|
||||
|
||||
/**
|
||||
* Deposit an amount to a player
|
||||
* @param playerName Name of player
|
||||
|
@ -28,17 +28,18 @@ public class EconomyResponse {
|
||||
SUCCESS(1),
|
||||
FAILURE(2),
|
||||
NOT_IMPLEMENTED(3);
|
||||
|
||||
|
||||
private int id;
|
||||
|
||||
ResponseType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Amount modified by calling method
|
||||
*/
|
||||
@ -48,15 +49,15 @@ public class EconomyResponse {
|
||||
*/
|
||||
public final double balance;
|
||||
/**
|
||||
* Success or failure of call.
|
||||
* Using Enum of ResponseType to determine valid outcomes
|
||||
* Success or failure of call. Using Enum of ResponseType to determine valid
|
||||
* outcomes
|
||||
*/
|
||||
public final ResponseType type;
|
||||
/**
|
||||
* Error message if the variable 'type' is ResponseType.FAILURE
|
||||
*/
|
||||
public final String errorMessage;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for EconomyResponse
|
||||
* @param amount Amount modified during operation
|
||||
@ -70,7 +71,7 @@ public class EconomyResponse {
|
||||
this.type = type;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if an operation was successful
|
||||
* @return Value
|
||||
|
@ -35,7 +35,7 @@ import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public class Economy_3co implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "3co";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
@ -68,7 +68,7 @@ public class Economy_3co implements Economy {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(economy == null) {
|
||||
if (economy == null) {
|
||||
return false;
|
||||
} else {
|
||||
return economy.isEnabled();
|
||||
@ -78,7 +78,7 @@ public class Economy_3co implements Economy {
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
final double balance;
|
||||
|
||||
|
||||
balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
|
||||
|
||||
final double fBalance = balance;
|
||||
@ -90,24 +90,24 @@ public class Economy_3co implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot withdraw negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
|
||||
amount = Math.ceil(amount);
|
||||
balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
|
||||
if(balance - amount < 0) {
|
||||
if (balance - amount < 0) {
|
||||
errorMessage = "Insufficient funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
economy.setMoney(plugin.getServer().getPlayer(playerName), (int) (balance - amount));
|
||||
@ -122,13 +122,13 @@ public class Economy_3co implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot deposit negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getMoney(plugin.getServer().getPlayer(playerName));
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
amount = Math.ceil(amount);
|
||||
@ -147,14 +147,14 @@ public class Economy_3co implements Economy {
|
||||
public String getMoneyNameSingular() {
|
||||
return economy.getSingularCurrency();
|
||||
}
|
||||
|
||||
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_3co economy = null;
|
||||
|
||||
|
||||
public EconomyServerListener(Economy_3co economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("3co");
|
||||
@ -165,7 +165,7 @@ public class Economy_3co implements Economy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.economy != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("Essentials")) {
|
||||
|
@ -32,12 +32,11 @@ import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
|
||||
import cosine.boseconomy.BOSEconomy;
|
||||
|
||||
public class Economy_BOSE implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "BOSEconomy";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
@ -70,7 +69,7 @@ public class Economy_BOSE implements Economy {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(economy == null) {
|
||||
if (economy == null) {
|
||||
return false;
|
||||
} else {
|
||||
return economy.isEnabled();
|
||||
@ -80,7 +79,7 @@ public class Economy_BOSE implements Economy {
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
final double balance;
|
||||
|
||||
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
final double fBalance = balance;
|
||||
@ -92,37 +91,37 @@ public class Economy_BOSE implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot withdraw negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
|
||||
amount = Math.ceil(amount);
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
if(balance - amount < 0) {
|
||||
if (balance - amount < 0) {
|
||||
errorMessage = "Insufficient funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
if(economy.setPlayerMoney(playerName, (int) (balance - amount), false)) {
|
||||
if (economy.setPlayerMoney(playerName, (int) (balance - amount), false)) {
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
} else {
|
||||
errorMessage = "Error withdrawing funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
}
|
||||
@ -132,28 +131,28 @@ public class Economy_BOSE implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot deposit negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
amount = Math.ceil(amount);
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
if(economy.setPlayerMoney(playerName, (int) (balance + amount), false)) {
|
||||
if (economy.setPlayerMoney(playerName, (int) (balance + amount), false)) {
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
} else {
|
||||
errorMessage = "Error withdrawing funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = (double) economy.getPlayerMoney(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
}
|
||||
@ -165,14 +164,14 @@ public class Economy_BOSE implements Economy {
|
||||
public String getMoneyNameSingular() {
|
||||
return economy.getMoneyName();
|
||||
}
|
||||
|
||||
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_BOSE economy = null;
|
||||
|
||||
|
||||
public EconomyServerListener(Economy_BOSE economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
|
||||
@ -183,7 +182,7 @@ public class Economy_BOSE implements Economy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.economy != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("Essentials")) {
|
||||
|
@ -38,22 +38,22 @@ import com.earth2me.essentials.api.UserDoesNotExistException;
|
||||
|
||||
public class Economy_Essentials implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "Essentials Economy";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private Essentials ess = null;
|
||||
private EconomyServerListener economyServerListener = null;
|
||||
|
||||
|
||||
public Economy_Essentials(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
economyServerListener = new EconomyServerListener(this);
|
||||
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (ess == null) {
|
||||
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials");
|
||||
@ -62,17 +62,17 @@ public class Economy_Essentials implements Economy {
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(ess == null) {
|
||||
if (ess == null) {
|
||||
return false;
|
||||
} else {
|
||||
return ess.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -88,11 +88,11 @@ public class Economy_Essentials implements Economy {
|
||||
createPlayerAccount(playerName);
|
||||
balance = 0;
|
||||
}
|
||||
|
||||
|
||||
final double fBalance = balance;
|
||||
return fBalance;
|
||||
}
|
||||
|
||||
|
||||
private boolean createPlayerAccount(String playerName) {
|
||||
try {
|
||||
com.earth2me.essentials.api.Economy.add(playerName, 0);
|
||||
@ -109,7 +109,7 @@ public class Economy_Essentials implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
|
||||
try {
|
||||
com.earth2me.essentials.api.Economy.subtract(playerName, amount);
|
||||
balance = com.earth2me.essentials.api.Economy.getMoney(playerName);
|
||||
@ -136,7 +136,7 @@ public class Economy_Essentials implements Economy {
|
||||
errorMessage = "User does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
@ -145,13 +145,13 @@ public class Economy_Essentials implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
|
||||
try {
|
||||
com.earth2me.essentials.api.Economy.add(playerName, amount);
|
||||
balance = com.earth2me.essentials.api.Economy.getMoney(playerName);
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
} catch (UserDoesNotExistException e) {
|
||||
if(createPlayerAccount(playerName)) {
|
||||
if (createPlayerAccount(playerName)) {
|
||||
return depositPlayer(playerName, amount);
|
||||
} else {
|
||||
amount = 0;
|
||||
@ -172,17 +172,17 @@ public class Economy_Essentials implements Economy {
|
||||
errorMessage = "Loan was not permitted";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_Essentials economy = null;
|
||||
|
||||
|
||||
public EconomyServerListener(Economy_Essentials economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.ess == null) {
|
||||
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials");
|
||||
@ -193,7 +193,7 @@ public class Economy_Essentials implements Economy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.ess != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("Essentials")) {
|
||||
|
@ -37,24 +37,24 @@ import com.nijiko.coelho.iConomy.system.Account;
|
||||
|
||||
public class Economy_iConomy4 implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "iConomy 4";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
protected iConomy economy = null;
|
||||
private EconomyServerListener economyServerListener = null;
|
||||
|
||||
|
||||
public Economy_iConomy4(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
economyServerListener = new EconomyServerListener(this);
|
||||
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if(economy == null) {
|
||||
if (economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy.class")) {
|
||||
economy = (iConomy) ec;
|
||||
@ -65,7 +65,7 @@ public class Economy_iConomy4 implements Economy {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(economy == null) {
|
||||
if (economy == null) {
|
||||
return false;
|
||||
} else {
|
||||
return economy.isEnabled();
|
||||
@ -81,7 +81,7 @@ public class Economy_iConomy4 implements Economy {
|
||||
public String format(double amount) {
|
||||
return iConomy.getBank().format(amount);
|
||||
}
|
||||
|
||||
|
||||
public String getMoneyNamePlural() {
|
||||
return iConomy.getBank().getCurrency() + "s";
|
||||
}
|
||||
@ -93,13 +93,13 @@ public class Economy_iConomy4 implements Economy {
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
final double balance;
|
||||
|
||||
|
||||
balance = getAccountBalance(playerName);
|
||||
|
||||
|
||||
final double fBalance = balance;
|
||||
return fBalance;
|
||||
}
|
||||
|
||||
|
||||
private double getAccountBalance(String playerName) {
|
||||
Account account = iConomy.getBank().getAccount(playerName);
|
||||
if (account == null) {
|
||||
@ -114,33 +114,33 @@ public class Economy_iConomy4 implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot withdraw negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = getAccountBalance(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
balance = getAccountBalance(playerName);
|
||||
if(balance >= amount) {
|
||||
if (balance >= amount) {
|
||||
Account account = iConomy.getBank().getAccount(playerName);
|
||||
if(account == null) {
|
||||
if (account == null) {
|
||||
return new EconomyResponse(0, 0, EconomyResponse.ResponseType.FAILURE, "Could not find account");
|
||||
}
|
||||
account.subtract(amount);
|
||||
|
||||
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
balance = getAccountBalance(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
} else {
|
||||
errorMessage = "Error withdrawing funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = getAccountBalance(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
}
|
||||
@ -150,35 +150,35 @@ public class Economy_iConomy4 implements Economy {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
if(amount < 0) {
|
||||
|
||||
if (amount < 0) {
|
||||
errorMessage = "Cannot deposit negative funds";
|
||||
type = EconomyResponse.ResponseType.FAILURE;
|
||||
amount = 0;
|
||||
balance = getAccountBalance(playerName);
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
|
||||
Account account = iConomy.getBank().getAccount(playerName);
|
||||
if(account == null) {
|
||||
if (account == null) {
|
||||
iConomy.getBank().addAccount(playerName);
|
||||
account = iConomy.getBank().getAccount(playerName);
|
||||
}
|
||||
account.add(amount);
|
||||
balance = getAccountBalance(playerName);
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
|
||||
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_iConomy4 economy = null;
|
||||
|
||||
|
||||
public EconomyServerListener(Economy_iConomy4 economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
@ -189,7 +189,7 @@ public class Economy_iConomy4 implements Economy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.economy != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("iConomy")) {
|
||||
|
@ -39,7 +39,7 @@ import com.iConomy.system.Holdings;
|
||||
|
||||
public class Economy_iConomy5 implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "iConomy 5";
|
||||
private JavaPlugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
|
@ -20,92 +20,93 @@ import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
||||
public class Economy_iConomy6 implements Economy {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private String name = "iConomy 6";
|
||||
private JavaPlugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
protected iConomy economy = null;
|
||||
private Accounts accounts;
|
||||
private EconomyServerListener economyServerListener = null;
|
||||
private String name = "iConomy 6";
|
||||
private JavaPlugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
protected iConomy economy = null;
|
||||
private Accounts accounts;
|
||||
private EconomyServerListener economyServerListener = null;
|
||||
|
||||
public Economy_iConomy6(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginManager = this.plugin.getServer().getPluginManager();
|
||||
public Economy_iConomy6(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
economyServerListener = new EconomyServerListener(this);
|
||||
economyServerListener = new EconomyServerListener(this);
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, economyServerListener, Priority.Monitor, plugin);
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
economy = (iConomy) ec;
|
||||
accounts = new Accounts();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_iConomy6 economy = null;
|
||||
// Load Plugin in case it was loaded before
|
||||
if (economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
economy = (iConomy) ec;
|
||||
accounts = new Accounts();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EconomyServerListener(Economy_iConomy6 economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
private class EconomyServerListener extends ServerListener {
|
||||
Economy_iConomy6 economy = null;
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
public EconomyServerListener(Economy_iConomy6 economy) {
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
economy.economy = (iConomy) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.economy != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("iConomy")) {
|
||||
economy.economy = null;
|
||||
log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
economy.economy = (iConomy) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (economy == null) {
|
||||
return false;
|
||||
} else {
|
||||
return economy.isEnabled();
|
||||
}
|
||||
}
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (economy.economy != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("iConomy")) {
|
||||
economy.economy = null;
|
||||
log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (economy == null) {
|
||||
return false;
|
||||
} else {
|
||||
return economy.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return iConomy.format(amount);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
if (accounts.exists(playerName))
|
||||
return accounts.get(playerName).getHoldings().getBalance();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return iConomy.format(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
double balance;
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
if (accounts.exists(playerName))
|
||||
return accounts.get(playerName).getHoldings().getBalance();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
@ -123,11 +124,11 @@ public class Economy_iConomy6 implements Economy {
|
||||
errorMessage = "Insufficient funds";
|
||||
return new EconomyResponse(balance, balance, type, errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
double balance;
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
double balance;
|
||||
EconomyResponse.ResponseType type;
|
||||
String errorMessage = null;
|
||||
|
||||
@ -138,6 +139,6 @@ public class Economy_iConomy6 implements Economy {
|
||||
type = EconomyResponse.ResponseType.SUCCESS;
|
||||
|
||||
return new EconomyResponse(amount, balance, type, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,15 +29,15 @@ public abstract class Permission {
|
||||
* @return Name of Permission Method
|
||||
*/
|
||||
abstract public String getName();
|
||||
|
||||
|
||||
/**
|
||||
* Checks if permission method is enabled.
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean isEnabled();
|
||||
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* @param world World name
|
||||
* @param player Player name
|
||||
* @param permission Permission node
|
||||
@ -46,8 +46,9 @@ public abstract class Permission {
|
||||
public boolean has(String world, String player, String permission) {
|
||||
return playerHas(world, player, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* @param world World Object
|
||||
* @param player Player name
|
||||
* @param permission Permission node
|
||||
@ -56,8 +57,9 @@ public abstract class Permission {
|
||||
public boolean has(World world, String player, String permission) {
|
||||
return playerHas(world.getName(), player, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* Checks if player has a permission node. (Short for playerHas(...)
|
||||
* @param player Player Object
|
||||
* @param permission Permission node
|
||||
* @return Success or Failure
|
||||
@ -65,7 +67,7 @@ public abstract class Permission {
|
||||
public boolean has(Player player, String permission) {
|
||||
return playerHas(player.getWorld().getName(), player.getName(), permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node.
|
||||
* @param world World name
|
||||
@ -74,6 +76,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerHas(String world, String player, String permission);
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node.
|
||||
* @param world World Object
|
||||
@ -84,6 +87,7 @@ public abstract class Permission {
|
||||
public boolean playerHas(World world, String player, String permission) {
|
||||
return playerHas(world.getName(), player, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player has a permission node.
|
||||
* @param player Player Object
|
||||
@ -93,7 +97,7 @@ public abstract class Permission {
|
||||
public boolean playerHas(Player player, String permission) {
|
||||
return playerHas(player.getWorld().getName(), player.getName(), permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add permission to a player.
|
||||
* @param world World name
|
||||
@ -102,6 +106,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerAdd(String world, String player, String permission);
|
||||
|
||||
/**
|
||||
* Add permission to a player.
|
||||
* @param world World Object
|
||||
@ -112,6 +117,7 @@ public abstract class Permission {
|
||||
public boolean playerAdd(World world, String player, String permission) {
|
||||
return playerAdd(world.getName(), player, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add permission to a player.
|
||||
* @param player Player Object
|
||||
@ -121,7 +127,7 @@ public abstract class Permission {
|
||||
public boolean playerAdd(Player player, String permission) {
|
||||
return playerAdd(player.getWorld().getName(), player.getName(), permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove permission from a player.
|
||||
* @param world World name
|
||||
@ -130,6 +136,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerRemove(String world, String player, String permission);
|
||||
|
||||
/**
|
||||
* Remove permission from a player.
|
||||
* @param world World name
|
||||
@ -140,6 +147,7 @@ public abstract class Permission {
|
||||
public boolean playerRemove(World world, String player, String permission) {
|
||||
return playerRemove(world.getName(), player, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove permission from a player.
|
||||
* @param player Player Object
|
||||
@ -149,7 +157,7 @@ public abstract class Permission {
|
||||
public boolean playerRemove(Player player, String permission) {
|
||||
return playerRemove(player.getWorld().getName(), player.getName(), permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if group has a permission node.
|
||||
* @param world World name
|
||||
@ -158,6 +166,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean groupHas(String world, String group, String permission);
|
||||
|
||||
/**
|
||||
* Checks if group has a permission node.
|
||||
* @param world World Object
|
||||
@ -168,7 +177,7 @@ public abstract class Permission {
|
||||
public boolean groupHas(World world, String group, String permission) {
|
||||
return groupHas(world.getName(), group, permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add permission to a group.
|
||||
* @param world World name
|
||||
@ -177,6 +186,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean groupAdd(String world, String group, String permission);
|
||||
|
||||
/**
|
||||
* Add permission to a group.
|
||||
* @param world World Object
|
||||
@ -187,7 +197,7 @@ public abstract class Permission {
|
||||
public boolean groupAdd(World world, String group, String permission) {
|
||||
return groupAdd(world.getName(), group, permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove permission from a group.
|
||||
* @param world World name
|
||||
@ -196,6 +206,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean groupRemove(String world, String group, String permission);
|
||||
|
||||
/**
|
||||
* Remove permission from a group.
|
||||
* @param world World Object
|
||||
@ -206,7 +217,7 @@ public abstract class Permission {
|
||||
public boolean groupRemove(World world, String group, String permission) {
|
||||
return groupRemove(world.getName(), group, permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if player is member of a group.
|
||||
* @param world World name
|
||||
@ -215,6 +226,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerInGroup(String world, String player, String group);
|
||||
|
||||
/**
|
||||
* Check if player is member of a group.
|
||||
* @param world World Object
|
||||
@ -225,6 +237,7 @@ public abstract class Permission {
|
||||
public boolean playerInGroup(World world, String player, String group) {
|
||||
return playerInGroup(world.getName(), player, group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if player is member of a group.
|
||||
* @param player Player Object
|
||||
@ -234,7 +247,7 @@ public abstract class Permission {
|
||||
public boolean playerInGroup(Player player, String group) {
|
||||
return playerInGroup(player.getWorld().getName(), player.getName(), group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add player to a group.
|
||||
* @param world World name
|
||||
@ -243,6 +256,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerAddGroup(String world, String player, String group);
|
||||
|
||||
/**
|
||||
* Add player to a group.
|
||||
* @param world World Object
|
||||
@ -253,6 +267,7 @@ public abstract class Permission {
|
||||
public boolean playerAddGroup(World world, String player, String group) {
|
||||
return playerAddGroup(world.getName(), player, group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add player to a group.
|
||||
* @param player Player Object
|
||||
@ -262,7 +277,7 @@ public abstract class Permission {
|
||||
public boolean playerAddGroup(Player player, String group) {
|
||||
return playerAddGroup(player.getWorld().getName(), player.getName(), group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove player from a group.
|
||||
* @param world World name
|
||||
@ -271,6 +286,7 @@ public abstract class Permission {
|
||||
* @return Success or Failure
|
||||
*/
|
||||
abstract public boolean playerRemoveGroup(String world, String player, String group);
|
||||
|
||||
/**
|
||||
* Remove player from a group.
|
||||
* @param world World Object
|
||||
@ -281,6 +297,7 @@ public abstract class Permission {
|
||||
public boolean playerRemoveGroup(World world, String player, String group) {
|
||||
return playerRemoveGroup(world.getName(), player, group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove player from a group.
|
||||
* @param player Player Object
|
||||
@ -290,16 +307,17 @@ public abstract class Permission {
|
||||
public boolean playerRemoveGroup(Player player, String group) {
|
||||
return playerRemoveGroup(player.getWorld().getName(), player.getName(), group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a players informational node (Integer) value
|
||||
* @param world World name
|
||||
* @param world World name
|
||||
* @param player Player name
|
||||
* @param node Permission node
|
||||
* @param defaultValue Default value
|
||||
* @return Value
|
||||
*/
|
||||
abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue);
|
||||
|
||||
/**
|
||||
* Get a players informational node (Integer) value
|
||||
* @param world World Object
|
||||
@ -311,6 +329,7 @@ public abstract class Permission {
|
||||
public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) {
|
||||
return getPlayerInfoInteger(world.getName(), player, node, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a players informational node (Integer) value
|
||||
* @param player Player Object
|
||||
@ -321,7 +340,7 @@ public abstract class Permission {
|
||||
public int getPlayerInfoInteger(Player player, String node, int defaultValue) {
|
||||
return getPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a players informational node (Integer) value
|
||||
* @param world World name
|
||||
@ -330,6 +349,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setPlayerInfoInteger(String world, String player, String node, int value);
|
||||
|
||||
/**
|
||||
* Set a players informational node (Integer) value
|
||||
* @param world World Object
|
||||
@ -340,6 +360,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoInteger(World world, String player, String node, int value) {
|
||||
setPlayerInfoInteger(world.getName(), player, node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a players informational node (Integer) value
|
||||
* @param player Player Object
|
||||
@ -349,7 +370,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoInteger(Player player, String node, int value) {
|
||||
setPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a groups informational node (Integer) value
|
||||
* @param world World name
|
||||
@ -359,6 +380,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue);
|
||||
|
||||
/**
|
||||
* Get a groups informational node (Integer) value
|
||||
* @param world World Object
|
||||
@ -370,7 +392,7 @@ public abstract class Permission {
|
||||
public int getGroupInfoInteger(World world, String group, String node, int defaultValue) {
|
||||
return getGroupInfoInteger(world.getName(), group, node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a groups informational node (Integer) value
|
||||
* @param world World name
|
||||
@ -379,6 +401,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setGroupInfoInteger(String world, String group, String node, int value);
|
||||
|
||||
/**
|
||||
* Set a groups informational node (Integer) value
|
||||
* @param world World Object
|
||||
@ -389,7 +412,7 @@ public abstract class Permission {
|
||||
public void setGroupInfoInteger(World world, String group, String node, int value) {
|
||||
setGroupInfoInteger(world.getName(), group, node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a players informational node (Double) value
|
||||
* @param world World name
|
||||
@ -399,6 +422,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue);
|
||||
|
||||
/**
|
||||
* Get a players informational node (Double) value
|
||||
* @param world World Object
|
||||
@ -410,6 +434,7 @@ public abstract class Permission {
|
||||
public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) {
|
||||
return getPlayerInfoDouble(world.getName(), player, node, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a players informational node (Double) value
|
||||
* @param player Player Object
|
||||
@ -420,7 +445,7 @@ public abstract class Permission {
|
||||
public double getPlayerInfoDouble(Player player, String node, double defaultValue) {
|
||||
return getPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a players informational node (Double) value
|
||||
* @param world World name
|
||||
@ -429,6 +454,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setPlayerInfoDouble(String world, String player, String node, double value);
|
||||
|
||||
/**
|
||||
* Set a players informational node (Double) value
|
||||
* @param world World Object
|
||||
@ -439,6 +465,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoDouble(World world, String player, String node, double value) {
|
||||
setPlayerInfoDouble(world.getName(), player, node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a players informational node (Double) value
|
||||
* @param player Player Object
|
||||
@ -448,7 +475,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoDouble(Player player, String node, double value) {
|
||||
setPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a groups informational node (Double) value
|
||||
* @param world World name
|
||||
@ -458,6 +485,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue);
|
||||
|
||||
/**
|
||||
* Get a groups informational node (Double) value
|
||||
* @param world World Object
|
||||
@ -469,7 +497,7 @@ public abstract class Permission {
|
||||
public double getGroupInfoDouble(World world, String group, String node, double defaultValue) {
|
||||
return getGroupInfoDouble(world.getName(), group, node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a groups informational node (Double) value
|
||||
* @param world World name
|
||||
@ -478,6 +506,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setGroupInfoDouble(String world, String group, String node, double value);
|
||||
|
||||
/**
|
||||
* Set a groups informational node (Double) value
|
||||
* @param world World Object
|
||||
@ -488,7 +517,7 @@ public abstract class Permission {
|
||||
public void setGroupInfoDouble(World world, String group, String node, double value) {
|
||||
setGroupInfoDouble(world.getName(), group, node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a players informational node (Boolean) value
|
||||
* @param world World name
|
||||
@ -498,6 +527,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Get a players informational node (Boolean) value
|
||||
* @param world World Object
|
||||
@ -509,6 +539,7 @@ public abstract class Permission {
|
||||
public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) {
|
||||
return getPlayerInfoBoolean(world.getName(), player, node, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a players informational node (Boolean) value
|
||||
* @param player Player Object
|
||||
@ -519,7 +550,7 @@ public abstract class Permission {
|
||||
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) {
|
||||
return getPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a players informational node (Boolean) value
|
||||
* @param world World name
|
||||
@ -528,6 +559,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value);
|
||||
|
||||
/**
|
||||
* Set a players informational node (Boolean) value
|
||||
* @param world World Object
|
||||
@ -538,6 +570,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoBoolean(World world, String player, String node, boolean value) {
|
||||
setPlayerInfoBoolean(world.getName(), player, node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a players informational node (Boolean) value
|
||||
* @param player Player Object
|
||||
@ -547,7 +580,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoBoolean(Player player, String node, boolean value) {
|
||||
setPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a groups informational node (Boolean) value
|
||||
* @param world Name of World
|
||||
@ -557,6 +590,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Set a players informational node (Boolean) value
|
||||
* @param world World Object
|
||||
@ -568,7 +602,7 @@ public abstract class Permission {
|
||||
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) {
|
||||
return getGroupInfoBoolean(world.getName(), group, node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a groups informational node (Boolean) value
|
||||
* @param world World name
|
||||
@ -577,6 +611,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value);
|
||||
|
||||
/**
|
||||
* Set a players informational node (Boolean) value
|
||||
* @param world World Object
|
||||
@ -587,7 +622,7 @@ public abstract class Permission {
|
||||
public void setGroupInfoBoolean(World world, String group, String node, boolean value) {
|
||||
setGroupInfoBoolean(world.getName(), group, node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a players informational node (String) value
|
||||
* @param world World name
|
||||
@ -597,6 +632,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue);
|
||||
|
||||
/**
|
||||
* Get a players informational node (String) value
|
||||
* @param world World Object
|
||||
@ -608,6 +644,7 @@ public abstract class Permission {
|
||||
public String getPlayerInfoString(World world, String player, String node, String defaultValue) {
|
||||
return getPlayerInfoString(world.getName(), player, node, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a players informational node (String) value
|
||||
* @param player Player Object
|
||||
@ -618,7 +655,7 @@ public abstract class Permission {
|
||||
public String getPlayerInfoString(Player player, String node, String defaultValue) {
|
||||
return getPlayerInfoString(player.getWorld().getName(), player.getName(), node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a players informational node (String) value
|
||||
* @param world World name
|
||||
@ -627,6 +664,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setPlayerInfoString(String world, String player, String node, String value);
|
||||
|
||||
/**
|
||||
* Set a players informational node (String) value
|
||||
* @param world World name
|
||||
@ -637,6 +675,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoString(World world, String player, String node, String value) {
|
||||
setPlayerInfoString(world.getName(), player, node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a players informational node (String) value
|
||||
* @param player Player Object
|
||||
@ -646,7 +685,7 @@ public abstract class Permission {
|
||||
public void setPlayerInfoString(Player player, String node, String value) {
|
||||
setPlayerInfoString(player.getWorld().getName(), player.getName(), node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a groups informational node (String) value
|
||||
* @param world Name of World
|
||||
@ -656,6 +695,7 @@ public abstract class Permission {
|
||||
* @return Value
|
||||
*/
|
||||
abstract public String getGroupInfoString(String world, String group, String node, String defaultValue);
|
||||
|
||||
/**
|
||||
* Set a players informational node (String) value
|
||||
* @param world World Object
|
||||
@ -667,7 +707,7 @@ public abstract class Permission {
|
||||
public String getGroupInfoString(World world, String group, String node, String defaultValue) {
|
||||
return getGroupInfoString(world.getName(), group, node, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a groups informational node (String) value
|
||||
* @param world World name
|
||||
@ -676,6 +716,7 @@ public abstract class Permission {
|
||||
* @param value Value to set
|
||||
*/
|
||||
abstract public void setGroupInfoString(String world, String group, String node, String value);
|
||||
|
||||
/**
|
||||
* Set a groups informational node (String) value
|
||||
* @param world World name
|
||||
@ -686,14 +727,15 @@ public abstract class Permission {
|
||||
public void setGroupInfoString(World world, String group, String node, String value) {
|
||||
setGroupInfoString(world.getName(), group, node, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of groups that this player has
|
||||
* @param world World name
|
||||
* @param player Player name
|
||||
* @return Array of groups
|
||||
* @return Array of groups
|
||||
*/
|
||||
abstract public String[] getPlayerGroups(String world, String player);
|
||||
|
||||
/**
|
||||
* Gets the list of groups that this player has
|
||||
* @param world World Object
|
||||
@ -703,6 +745,7 @@ public abstract class Permission {
|
||||
public String[] getPlayerGroups(World world, String player) {
|
||||
return getPlayerGroups(world.getName(), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of groups that this player has
|
||||
* @param player Player Object
|
||||
@ -711,7 +754,7 @@ public abstract class Permission {
|
||||
public String[] getPlayerGroups(Player player) {
|
||||
return getPlayerGroups(player.getWorld().getName(), player.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets players primary group
|
||||
* @param world World name
|
||||
@ -719,6 +762,7 @@ public abstract class Permission {
|
||||
* @return Players primary group
|
||||
*/
|
||||
abstract public String getPrimaryGroup(String world, String player);
|
||||
|
||||
/**
|
||||
* Gets players primary group
|
||||
* @param world World Object
|
||||
@ -728,6 +772,7 @@ public abstract class Permission {
|
||||
public String getPrimaryGroup(World world, String player) {
|
||||
return getPrimaryGroup(world.getName(), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get players primary group
|
||||
* @param player Player Object
|
||||
@ -736,7 +781,7 @@ public abstract class Permission {
|
||||
public String getPrimaryGroup(Player player) {
|
||||
return getPrimaryGroup(player.getWorld().getName(), player.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get players prefix
|
||||
* @param world World name
|
||||
@ -744,6 +789,7 @@ public abstract class Permission {
|
||||
* @return Prefix
|
||||
*/
|
||||
abstract public String getPlayerPrefix(String world, String player);
|
||||
|
||||
/**
|
||||
* Get players prefix
|
||||
* @param world World Object
|
||||
@ -753,6 +799,7 @@ public abstract class Permission {
|
||||
public String getPlayerPrefix(World world, String player) {
|
||||
return getPlayerPrefix(world.getName(), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get players prefix
|
||||
* @param player Player Object
|
||||
@ -761,7 +808,7 @@ public abstract class Permission {
|
||||
public String getPlayerPrefix(Player player) {
|
||||
return getPlayerPrefix(player.getWorld().getName(), player.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set players prefix
|
||||
* @param world World name
|
||||
@ -769,6 +816,7 @@ public abstract class Permission {
|
||||
* @param prefix Prefix
|
||||
*/
|
||||
abstract public void setPlayerPrefix(String world, String player, String prefix);
|
||||
|
||||
/**
|
||||
* Set players prefix
|
||||
* @param world World Object
|
||||
@ -778,6 +826,7 @@ public abstract class Permission {
|
||||
public void setPlayerPrefix(World world, String player, String prefix) {
|
||||
setPlayerPrefix(world.getName(), player, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set players prefix
|
||||
* @param player Player Object
|
||||
@ -786,7 +835,7 @@ public abstract class Permission {
|
||||
public void setPlayerPrefix(Player player, String prefix) {
|
||||
setPlayerPrefix(player.getWorld().getName(), player.getName(), prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get players suffix
|
||||
* @param world World name
|
||||
@ -794,6 +843,7 @@ public abstract class Permission {
|
||||
* @return Suffix
|
||||
*/
|
||||
abstract public String getPlayerSuffix(String world, String player);
|
||||
|
||||
/**
|
||||
* Get players suffix
|
||||
* @param world World Object
|
||||
@ -803,6 +853,7 @@ public abstract class Permission {
|
||||
public String getPlayerSuffix(World world, String player) {
|
||||
return getPlayerSuffix(world.getName(), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get players suffix
|
||||
* @param player Player Object
|
||||
@ -811,7 +862,7 @@ public abstract class Permission {
|
||||
public String getPlayerSuffix(Player player) {
|
||||
return getPlayerSuffix(player.getWorld().getName(), player.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set players suffix
|
||||
* @param world World name
|
||||
@ -819,6 +870,7 @@ public abstract class Permission {
|
||||
* @param suffix Suffix
|
||||
*/
|
||||
abstract public void setPlayerSuffix(String world, String player, String suffix);
|
||||
|
||||
/**
|
||||
* Set players suffix
|
||||
* @param world World Object
|
||||
@ -828,6 +880,7 @@ public abstract class Permission {
|
||||
public void setPlayerSuffix(World world, String player, String suffix) {
|
||||
setPlayerSuffix(world.getName(), player, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set players suffix
|
||||
* @param player Player Object
|
||||
@ -836,7 +889,7 @@ public abstract class Permission {
|
||||
public void setPlayerSuffix(Player player, String suffix) {
|
||||
setPlayerSuffix(player.getWorld().getName(), player.getName(), suffix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get group prefix
|
||||
* @param world World name
|
||||
@ -844,6 +897,7 @@ public abstract class Permission {
|
||||
* @return Prefix
|
||||
*/
|
||||
abstract public String getGroupPrefix(String world, String group);
|
||||
|
||||
/**
|
||||
* Get group prefix
|
||||
* @param world World Object
|
||||
@ -853,7 +907,7 @@ public abstract class Permission {
|
||||
public String getGroupPrefix(World world, String group) {
|
||||
return getGroupPrefix(world.getName(), group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set group prefix
|
||||
* @param world World name
|
||||
@ -861,6 +915,7 @@ public abstract class Permission {
|
||||
* @param prefix Prefix
|
||||
*/
|
||||
abstract public void setGroupPrefix(String world, String group, String prefix);
|
||||
|
||||
/**
|
||||
* Set group prefix
|
||||
* @param world World Object
|
||||
@ -870,7 +925,7 @@ public abstract class Permission {
|
||||
public void setGroupPrefix(World world, String group, String prefix) {
|
||||
setGroupPrefix(world.getName(), group, prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get group suffix
|
||||
* @param world World name
|
||||
@ -878,6 +933,7 @@ public abstract class Permission {
|
||||
* @return Suffix
|
||||
*/
|
||||
abstract public String getGroupSuffix(String world, String group);
|
||||
|
||||
/**
|
||||
* Get group suffix
|
||||
* @param world World Object
|
||||
@ -887,7 +943,7 @@ public abstract class Permission {
|
||||
public String getGroupSuffix(World world, String group) {
|
||||
return getGroupSuffix(world.getName(), group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set group suffix
|
||||
* @param world World name
|
||||
@ -895,6 +951,7 @@ public abstract class Permission {
|
||||
* @param suffix Suffix
|
||||
*/
|
||||
abstract public void setGroupSuffix(String world, String group, String suffix);
|
||||
|
||||
/**
|
||||
* Set group suffix
|
||||
* @param world World Object
|
||||
|
@ -15,260 +15,261 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public class Permission_GroupManager extends Permission {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private String name = "GroupManager";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private GroupManager groupManager;
|
||||
private AnjoPermissionsHandler perms;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Permission_GroupManager(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
private String name = "GroupManager";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private GroupManager groupManager;
|
||||
private AnjoPermissionsHandler perms;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
@SuppressWarnings("deprecation")
|
||||
public Permission_GroupManager(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
|
||||
// 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;
|
||||
this.perms = groupManager.getPermissionHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_GroupManager permission = null;
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
|
||||
public PermissionServerListener(Permission_GroupManager permission) {
|
||||
this.permission = 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;
|
||||
this.perms = groupManager.getPermissionHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission.groupManager == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_GroupManager permission = null;
|
||||
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission.groupManager = (GroupManager) perms;
|
||||
permission.perms = groupManager.getPermissionHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.groupManager != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
||||
permission.groupManager = null;
|
||||
permission.perms = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(groupManager == null) {
|
||||
return false;
|
||||
} else {
|
||||
return groupManager.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
return perms.has(plugin.getServer().getPlayer(playerName), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
String[] groups = perms.getGroups(playerName);
|
||||
for (String group : groups)
|
||||
if (group.equalsIgnoreCase(groupName))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
return perms.getPermissionInteger(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
return perms.getGroupPermissionInteger(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
return perms.getPermissionDouble(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
return perms.getGroupPermissionDouble(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
return perms.getPermissionBoolean(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName,String node, boolean defaultValue) {
|
||||
return perms.getGroupPermissionBoolean(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName,String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName,String node, String defaultValue) {
|
||||
return perms.getPermissionString(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName,String node, String value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
return perms.getGroupPermissionString(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node,String value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return perms.getGroups(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return perms.getGroup(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String playerName) {
|
||||
return perms.getGroupPrefix(getPrimaryGroup(world, playerName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
return perms.getGroupSuffix(getPrimaryGroup(world, playerName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
public PermissionServerListener(Permission_GroupManager permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
return perms.getGroupPrefix(group);
|
||||
@SuppressWarnings("deprecation")
|
||||
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;
|
||||
permission.perms = groupManager.getPermissionHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.groupManager != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
|
||||
permission.groupManager = null;
|
||||
permission.perms = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
return perms.getGroupSuffix(group);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (groupManager == null) {
|
||||
return false;
|
||||
} else {
|
||||
return groupManager.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
return perms.has(plugin.getServer().getPlayer(playerName), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
String[] groups = perms.getGroups(playerName);
|
||||
for (String group : groups)
|
||||
if (group.equalsIgnoreCase(groupName))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
return perms.getPermissionInteger(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
return perms.getGroupPermissionInteger(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
return perms.getPermissionDouble(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
return perms.getGroupPermissionDouble(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
return perms.getPermissionBoolean(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
return perms.getGroupPermissionBoolean(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
return perms.getPermissionString(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
return perms.getGroupPermissionString(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return perms.getGroups(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return perms.getGroup(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String playerName) {
|
||||
return perms.getGroupPrefix(getPrimaryGroup(world, playerName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
return perms.getGroupSuffix(getPrimaryGroup(world, playerName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
return perms.getGroupPrefix(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
return perms.getGroupSuffix(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
}
|
||||
|
@ -18,267 +18,267 @@ import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Permission_Permissions2 extends Permission {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private String name = "Permissions 2 (Phoenix)";
|
||||
private PermissionHandler perms;
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private Permissions permission = null;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
private String name = "Permissions 2 (Phoenix)";
|
||||
private PermissionHandler perms;
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private Permissions permission = null;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
|
||||
public Permission_Permissions2(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
public Permission_Permissions2(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled() && perms.getDescription().getVersion().startsWith("2")) {
|
||||
permission = (Permissions) perms;
|
||||
this.perms = permission.getHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_Permissions2 permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_Permissions2 permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission.permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
|
||||
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission.permission = (Permissions) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.permission != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
|
||||
permission.permission = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(permission == null) {
|
||||
return false;
|
||||
} else {
|
||||
return permission.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
return this.perms.has(worldName, playerName, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
this.perms.addUserPermission(worldName, playerName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
this.perms.removeUserPermission(worldName, playerName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName,String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
return this.perms.inGroup(worldName, playerName, groupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
int i = this.perms.getPermissionInteger(world, playerName, node);
|
||||
return (i == -1) ? defaultValue : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
public void setGroupInfo(String world, String groupName, String node, Object value) {
|
||||
this.perms.addGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
int i = this.perms.getGroupPermissionInteger(world, groupName, node);
|
||||
return (i == -1) ? defaultValue : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
double d = this.perms.getPermissionDouble(world, playerName, node);
|
||||
return (d == -1) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
double d = this.perms.getGroupPermissionDouble(world, groupName, node);
|
||||
return (d == -1) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
//Warning does not support default value
|
||||
return this.perms.getPermissionBoolean(world, playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
return this.perms.getGroupPermissionBoolean(world, groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
String s = this.perms.getPermissionString(world, playerName, node);
|
||||
return (s == "" || s == null) ? defaultValue : s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
String s = this.perms.getGroupPermissionString(world, groupName, node);
|
||||
return (s == "" || s == null) ? defaultValue : s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return this.perms.getGroups(world, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return this.perms.getGroup(world, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String playerName) {
|
||||
return this.perms.getPermissionString(world, playerName, "prefix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
return this.perms.getPermissionString(world, playerName, "suffix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
// Load Plugin in case it was loaded before
|
||||
if (permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled() && perms.getDescription().getVersion().startsWith("2")) {
|
||||
permission = (Permissions) perms;
|
||||
this.perms = permission.getHandler();
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_Permissions2 permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_Permissions2 permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
return perms.getGroupPrefix(world, group);
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission.permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
|
||||
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission.permission = (Permissions) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.permission != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
|
||||
permission.permission = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
return perms.getGroupSuffix(world, group);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (permission == null) {
|
||||
return false;
|
||||
} else {
|
||||
return permission.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
return this.perms.has(worldName, playerName, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
this.perms.addUserPermission(worldName, playerName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
this.perms.removeUserPermission(worldName, playerName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
return this.perms.inGroup(worldName, playerName, groupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
int i = this.perms.getPermissionInteger(world, playerName, node);
|
||||
return (i == -1) ? defaultValue : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
public void setGroupInfo(String world, String groupName, String node, Object value) {
|
||||
this.perms.addGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
int i = this.perms.getGroupPermissionInteger(world, groupName, node);
|
||||
return (i == -1) ? defaultValue : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
double d = this.perms.getPermissionDouble(world, playerName, node);
|
||||
return (d == -1) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
double d = this.perms.getGroupPermissionDouble(world, groupName, node);
|
||||
return (d == -1) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
// Warning does not support default value
|
||||
return this.perms.getPermissionBoolean(world, playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
return this.perms.getGroupPermissionBoolean(world, groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
String s = this.perms.getPermissionString(world, playerName, node);
|
||||
return (s == "" || s == null) ? defaultValue : s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
String s = this.perms.getGroupPermissionString(world, groupName, node);
|
||||
return (s == "" || s == null) ? defaultValue : s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return this.perms.getGroups(world, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return this.perms.getGroup(world, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String playerName) {
|
||||
return this.perms.getPermissionString(world, playerName, "prefix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
return this.perms.getPermissionString(world, playerName, "suffix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
return perms.getGroupPrefix(world, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
return perms.getGroupSuffix(world, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class Permission_Permissions3 extends Permission {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
|
||||
private String name = "Permissions 3 (Yeti)";
|
||||
private PermissionHandler perms;
|
||||
private Plugin plugin = null;
|
||||
@ -70,13 +70,13 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(permission == null) {
|
||||
if (permission == null) {
|
||||
return false;
|
||||
} else {
|
||||
return permission.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
return this.permission.getHandler().inGroup(worldName, playerName, groupName);
|
||||
@ -119,20 +119,20 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
Integer i = this.perms.getInfoInteger(world, playerName, node, false);
|
||||
Integer i = this.perms.getInfoInteger(world, playerName, node, false);
|
||||
return (i == null) ? defaultValue : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
Double d = this.perms.getInfoDouble(world, playerName, node, false);
|
||||
return (d == null) ? defaultValue : d;
|
||||
Double d = this.perms.getInfoDouble(world, playerName, node, false);
|
||||
return (d == null) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
Boolean b = this.perms.getInfoBoolean(world, playerName, node, false);
|
||||
return (b == null) ? defaultValue : b;
|
||||
Boolean b = this.perms.getInfoBoolean(world, playerName, node, false);
|
||||
return (b == null) ? defaultValue : b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,63 +178,64 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
|
||||
public void setPlayerInfo(String world, String playerName, String node, Object value) {
|
||||
this.perms.addUserInfo(world, playerName, node, value);
|
||||
this.perms.addUserInfo(world, playerName, node, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
setPlayerInfo(world, playerName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
Integer i = this.perms.getInfoInteger(world, groupName, node, true);
|
||||
return (i == null) ? defaultValue : i;
|
||||
Integer i = this.perms.getInfoInteger(world, groupName, node, true);
|
||||
return (i == null) ? defaultValue : i;
|
||||
}
|
||||
|
||||
public void setGroupInfo(String world, String groupName, String node, Object value) {
|
||||
this.perms.addGroupInfo(world, groupName, node, value);
|
||||
this.perms.addGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
Double d = this.perms.getInfoDouble(world, groupName, node, true);
|
||||
return (d == null) ? defaultValue : d;
|
||||
Double d = this.perms.getInfoDouble(world, groupName, node, true);
|
||||
return (d == null) ? defaultValue : d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
Boolean b = this.perms.getInfoBoolean(world, groupName, node, true);
|
||||
return (b == null) ? defaultValue : b;
|
||||
Boolean b = this.perms.getInfoBoolean(world, groupName, node, true);
|
||||
return (b == null) ? defaultValue : b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -245,7 +246,7 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
setGroupInfo(world, groupName, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -259,14 +260,14 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return this.perms.getGroups(world, playerName);
|
||||
}
|
||||
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return this.perms.getPrimaryGroup(world, playerName);
|
||||
}
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return this.perms.getGroups(world, playerName);
|
||||
}
|
||||
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return this.perms.getPrimaryGroup(world, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
@ -282,12 +283,12 @@ public class Permission_Permissions3 extends Permission {
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
return this.perms.getUserSuffix(world, playerName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
this.perms.addUserInfo(world, player, "suffix", suffix);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
this.perms.addUserInfo(world, player, "prefix", prefix);
|
||||
|
@ -37,333 +37,335 @@ import ru.tehkode.permissions.PermissionUser;
|
||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
||||
public class Permission_PermissionsEx extends Permission {
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private String name = "PermissionsEx";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private PermissionsEx permission = null;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
private String name = "PermissionsEx";
|
||||
private Plugin plugin = null;
|
||||
private PluginManager pluginManager = null;
|
||||
private PermissionsEx permission = null;
|
||||
private PermissionServerListener permissionServerListener = null;
|
||||
|
||||
public Permission_PermissionsEx(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
public Permission_PermissionsEx(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginManager = this.plugin.getServer().getPluginManager();
|
||||
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
permissionServerListener = new PermissionServerListener(this);
|
||||
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission = (PermissionsEx) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load Plugin in case it was loaded before
|
||||
if (permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission = (PermissionsEx) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if(permission == null) {
|
||||
return false;
|
||||
} else {
|
||||
return permission.isEnabled();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
if (permission == null) {
|
||||
return false;
|
||||
} else {
|
||||
return permission.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(Player player, String permission) {
|
||||
return playerHas(player, permission);
|
||||
}
|
||||
@Override
|
||||
public boolean has(Player player, String permission) {
|
||||
return playerHas(player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(Player player, String permission) {
|
||||
return this.permission.has(player, permission);
|
||||
}
|
||||
@Override
|
||||
public boolean playerHas(Player player, String permission) {
|
||||
return this.permission.has(player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
//Try catch the check because we don't know if the objects will actually exist Good Job on the crap Permissions plugin, why do we support this again?
|
||||
try {
|
||||
PermissionUser[] userList = PermissionsEx.getPermissionManager().getGroup(groupName).getUsers();
|
||||
for (PermissionUser user : userList) {
|
||||
if (user.getName() == playerName)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean playerInGroup(String worldName, String playerName, String groupName) {
|
||||
// Try catch the check because we don't know if the objects will
|
||||
// actually exist Good Job on the crap Permissions plugin, why do we
|
||||
// support this again?
|
||||
try {
|
||||
PermissionUser[] userList = PermissionsEx.getPermissionManager().getGroup(groupName).getUsers();
|
||||
for (PermissionUser user : userList) {
|
||||
if (user.getName() == playerName)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_PermissionsEx permission = null;
|
||||
private class PermissionServerListener extends ServerListener {
|
||||
Permission_PermissionsEx permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_PermissionsEx permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
public PermissionServerListener(Permission_PermissionsEx permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission.permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission.permission == null) {
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
|
||||
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission.permission = (PermissionsEx) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
permission.permission = (PermissionsEx) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.permission != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("PermissionsEx")) {
|
||||
permission.permission = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (permission.permission != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("PermissionsEx")) {
|
||||
permission.permission = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionInteger(node, world, defaultValue);
|
||||
}
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionInteger(node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionDouble(node, world, defaultValue);
|
||||
}
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionDouble(node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionBoolean(node, world, defaultValue);
|
||||
}
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionBoolean(node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOption(node, world, defaultValue);
|
||||
}
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getOption(node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(group == null || user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (group == null || user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(group == null || user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.removeGroup(group);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (group == null || user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.removeGroup(group);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.addPermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean playerAdd(String worldName, String playerName, String permission) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.addPermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.removePermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean playerRemove(String worldName, String playerName, String permission) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user == null) {
|
||||
return false;
|
||||
} else {
|
||||
user.removePermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return false;
|
||||
} else {
|
||||
group.addPermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return false;
|
||||
} else {
|
||||
group.addPermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return false;
|
||||
} else {
|
||||
group.removePermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return false;
|
||||
} else {
|
||||
group.removePermission(permission, worldName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String playerName, String node, String value) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if (user != null) {
|
||||
user.setOption(node, String.valueOf(value), world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionInteger(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionInteger(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionDouble(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionDouble(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionBoolean(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOptionBoolean(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOption(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return group.getOption(node, world, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, value);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
group.setOption(node, world, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if(group == null) {
|
||||
return false;
|
||||
} else {
|
||||
return group.has(permission, worldName);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return false;
|
||||
} else {
|
||||
return group.has(permission, worldName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames();
|
||||
}
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String playerName) {
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
if (PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames().length > 0)
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames()[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
if (PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames().length > 0)
|
||||
return PermissionsEx.getPermissionManager().getUser(playerName).getGroupsNames()[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
if (user != null) {
|
||||
return user.has(permission, worldName);
|
||||
} else {
|
||||
return false;
|
||||
@ -373,7 +375,7 @@ public class Permission_PermissionsEx extends Permission {
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, String playerName) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
if (user != null) {
|
||||
return user.getPrefix();
|
||||
} else {
|
||||
return null;
|
||||
@ -383,33 +385,33 @@ public class Permission_PermissionsEx extends Permission {
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, String playerName) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
|
||||
if(user != null) {
|
||||
if (user != null) {
|
||||
return user.getSuffix();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
|
||||
if (user != null) {
|
||||
user.setSuffix(suffix);
|
||||
user.setSuffix(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) {
|
||||
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
|
||||
if (user != null) {
|
||||
user.setPrefix(prefix);
|
||||
user.setPrefix(prefix);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, String group) {
|
||||
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
|
||||
if(group != null) {
|
||||
if (group != null) {
|
||||
return pGroup.getPrefix();
|
||||
} else {
|
||||
return null;
|
||||
@ -419,16 +421,16 @@ public class Permission_PermissionsEx extends Permission {
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) {
|
||||
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
|
||||
if(group != null) {
|
||||
if (group != null) {
|
||||
pGroup.setPrefix(prefix);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, String group) {
|
||||
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
|
||||
if(group != null) {
|
||||
if (group != null) {
|
||||
return pGroup.getSuffix();
|
||||
} else {
|
||||
return null;
|
||||
@ -438,7 +440,7 @@ public class Permission_PermissionsEx extends Permission {
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) {
|
||||
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
|
||||
if(group != null) {
|
||||
if (group != null) {
|
||||
pGroup.setSuffix(suffix);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user