- Fixed Permissions for shop creation
- Added Moderator Permission (ChestShop.mod) - Updated Register
This commit is contained in:
parent
36f25841af
commit
e522b33d9d
|
@ -56,9 +56,9 @@ public class ChestShop extends JavaPlugin {
|
||||||
pm.registerEvent(Event.Type.PLUGIN_ENABLE, pluginEnable, Event.Priority.Monitor, this);
|
pm.registerEvent(Event.Type.PLUGIN_ENABLE, pluginEnable, Event.Priority.Monitor, this);
|
||||||
pm.registerEvent(Event.Type.PLUGIN_DISABLE, pluginDisable, Event.Priority.Monitor, this);
|
pm.registerEvent(Event.Type.PLUGIN_DISABLE, pluginDisable, Event.Priority.Monitor, this);
|
||||||
|
|
||||||
desc = this.getDescription();
|
desc = this.getDescription(); //Description of the plugin
|
||||||
server = getServer();
|
server = getServer(); //Setting out server variable
|
||||||
mainWorldName = server.getWorlds().get(0).getName();
|
mainWorldName = server.getWorlds().get(0).getName(); //Set up our main world's name - currently not used
|
||||||
|
|
||||||
//Yep, set up our folder!
|
//Yep, set up our folder!
|
||||||
folder = getDataFolder();
|
folder = getDataFolder();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class playerInteract extends PlayerListener {
|
||||||
|
|
||||||
if (Config.getBoolean(Property.USE_BUILT_IN_PROTECTION) && block.getType() == Material.CHEST) {
|
if (Config.getBoolean(Property.USE_BUILT_IN_PROTECTION) && block.getType() == Material.CHEST) {
|
||||||
Default defProtection = new Default();
|
Default defProtection = new Default();
|
||||||
if (!Permission.has(player, Permission.ADMIN) && (defProtection.isProtected(block) && !defProtection.canAccess(player, block))) {
|
if (!Permission.has(player, Permission.ADMIN) && !Permission.has(player, Permission.MOD) && (defProtection.isProtected(block) && !defProtection.canAccess(player, block))) {
|
||||||
player.sendMessage(Config.getLocal(Language.ACCESS_DENIED));
|
player.sendMessage(Config.getLocal(Language.ACCESS_DENIED));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.Acrobot.ChestShop.Permission;
|
||||||
import com.Acrobot.ChestShop.Protection.Default;
|
import com.Acrobot.ChestShop.Protection.Default;
|
||||||
import com.Acrobot.ChestShop.Protection.Security;
|
import com.Acrobot.ChestShop.Protection.Security;
|
||||||
import com.Acrobot.ChestShop.Restrictions.RestrictedSign;
|
import com.Acrobot.ChestShop.Restrictions.RestrictedSign;
|
||||||
import com.Acrobot.ChestShop.Utils.Numerical;
|
|
||||||
import com.Acrobot.ChestShop.Utils.BlockSearch;
|
import com.Acrobot.ChestShop.Utils.BlockSearch;
|
||||||
|
import com.Acrobot.ChestShop.Utils.Numerical;
|
||||||
import com.Acrobot.ChestShop.Utils.SignUtil;
|
import com.Acrobot.ChestShop.Utils.SignUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -53,9 +53,11 @@ public class signChange extends BlockListener {
|
||||||
dropSign(event);
|
dropSign(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!playerIsAdmin && !(Permission.has(player, Permission.SHOP_CREATION)
|
if (!(playerIsAdmin ||
|
||||||
|| ((Permission.has(player, Permission.SHOP_CREATION + "." + mat.getId())
|
Permission.has(player, Permission.SHOP_CREATION) ||
|
||||||
|| !Permission.has(player, Permission.EXCLUDE_ITEM + "." + mat.getId()))))) {
|
(Permission.has(player, Permission.SHOP_CREATION + "." + mat.getId()) &&
|
||||||
|
!Permission.has(player, Permission.EXCLUDE_ITEM + "." + mat.getId()))))
|
||||||
|
{
|
||||||
|
|
||||||
player.sendMessage(Config.getLocal(Language.YOU_CANNOT_CREATE_SHOP));
|
player.sendMessage(Config.getLocal(Language.YOU_CANNOT_CREATE_SHOP));
|
||||||
dropSign(event);
|
dropSign(event);
|
||||||
|
|
|
@ -11,7 +11,8 @@ public enum Permission {
|
||||||
EXCLUDE_ITEM("ChestShop.shop.exclude"),
|
EXCLUDE_ITEM("ChestShop.shop.exclude"),
|
||||||
BUY("ChestShop.shop.buy"),
|
BUY("ChestShop.shop.buy"),
|
||||||
SELL("ChestShop.shop.sell"),
|
SELL("ChestShop.shop.sell"),
|
||||||
ADMIN("ChestShop.admin");
|
ADMIN("ChestShop.admin"),
|
||||||
|
MOD("ChestShop.mod");
|
||||||
|
|
||||||
private final String permission;
|
private final String permission;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public enum Permission {
|
||||||
if (permissions != null) {
|
if (permissions != null) {
|
||||||
return permissions.has(player, node);
|
return permissions.has(player, node);
|
||||||
} else {
|
} else {
|
||||||
return !node.contains("exclude") && (!node.contains("admin") || player.isOp());
|
return !node.contains("exclude") && ((!node.contains("admin") && !node.contains("mod")) || player.isOp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,50 +12,29 @@ import org.bukkit.plugin.Plugin;
|
||||||
*/
|
*/
|
||||||
public interface Method {
|
public interface Method {
|
||||||
public Object getPlugin();
|
public Object getPlugin();
|
||||||
|
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
public String getVersion();
|
public String getVersion();
|
||||||
|
|
||||||
public String format(double amount);
|
public String format(double amount);
|
||||||
|
|
||||||
public boolean hasBanks();
|
public boolean hasBanks();
|
||||||
|
|
||||||
public boolean hasBank(String bank);
|
public boolean hasBank(String bank);
|
||||||
|
|
||||||
public boolean hasAccount(String name);
|
public boolean hasAccount(String name);
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name);
|
public boolean hasBankAccount(String bank, String name);
|
||||||
|
|
||||||
public MethodAccount getAccount(String name);
|
public MethodAccount getAccount(String name);
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name);
|
public MethodBankAccount getBankAccount(String bank, String name);
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin);
|
public boolean isCompatible(Plugin plugin);
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin);
|
public void setPlugin(Plugin plugin);
|
||||||
|
|
||||||
public interface MethodAccount {
|
public interface MethodAccount {
|
||||||
public double balance();
|
public double balance();
|
||||||
|
|
||||||
public boolean set(double amount);
|
public boolean set(double amount);
|
||||||
|
|
||||||
public boolean add(double amount);
|
public boolean add(double amount);
|
||||||
|
|
||||||
public boolean subtract(double amount);
|
public boolean subtract(double amount);
|
||||||
|
|
||||||
public boolean multiply(double amount);
|
public boolean multiply(double amount);
|
||||||
|
|
||||||
public boolean divide(double amount);
|
public boolean divide(double amount);
|
||||||
|
|
||||||
public boolean hasEnough(double amount);
|
public boolean hasEnough(double amount);
|
||||||
|
|
||||||
public boolean hasOver(double amount);
|
public boolean hasOver(double amount);
|
||||||
|
|
||||||
public boolean hasUnder(double amount);
|
public boolean hasUnder(double amount);
|
||||||
|
|
||||||
public boolean isNegative();
|
public boolean isNegative();
|
||||||
|
|
||||||
public boolean remove();
|
public boolean remove();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,29 +43,17 @@ public interface Method {
|
||||||
|
|
||||||
public interface MethodBankAccount {
|
public interface MethodBankAccount {
|
||||||
public double balance();
|
public double balance();
|
||||||
|
|
||||||
public String getBankName();
|
public String getBankName();
|
||||||
|
|
||||||
public int getBankId();
|
public int getBankId();
|
||||||
|
|
||||||
public boolean set(double amount);
|
public boolean set(double amount);
|
||||||
|
|
||||||
public boolean add(double amount);
|
public boolean add(double amount);
|
||||||
|
|
||||||
public boolean subtract(double amount);
|
public boolean subtract(double amount);
|
||||||
|
|
||||||
public boolean multiply(double amount);
|
public boolean multiply(double amount);
|
||||||
|
|
||||||
public boolean divide(double amount);
|
public boolean divide(double amount);
|
||||||
|
|
||||||
public boolean hasEnough(double amount);
|
public boolean hasEnough(double amount);
|
||||||
|
|
||||||
public boolean hasOver(double amount);
|
public boolean hasOver(double amount);
|
||||||
|
|
||||||
public boolean hasUnder(double amount);
|
public boolean hasUnder(double amount);
|
||||||
|
|
||||||
public boolean isNegative();
|
public boolean isNegative();
|
||||||
|
|
||||||
public boolean remove();
|
public boolean remove();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.nijikokun.register.payment.forChestShop;
|
package com.nijikokun.register.payment.forChestShop;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods.java
|
* Methods.java
|
||||||
* Controls the getting / setting of methods & the method of payment used.
|
* Controls the getting / setting of methods & the method of payment used.
|
||||||
|
@ -28,13 +28,13 @@ public class Methods {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to set which economy plugin is most preferred.
|
* Allows you to set which economy plugin is most preferred.
|
||||||
*
|
*
|
||||||
* @param preferred
|
* @param preferred
|
||||||
*/
|
*/
|
||||||
public Methods(String preferred) {
|
public Methods(String preferred) {
|
||||||
this._init();
|
this._init();
|
||||||
|
|
||||||
if (this.Dependencies.contains(preferred)) {
|
if(this.Dependencies.contains(preferred)) {
|
||||||
this.preferred = preferred;
|
this.preferred = preferred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class Methods {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method createMethod(Plugin plugin) {
|
public Method createMethod(Plugin plugin) {
|
||||||
for (Method method : Methods) {
|
for (Method method: Methods) {
|
||||||
if (method.isCompatible(plugin)) {
|
if (method.isCompatible(plugin)) {
|
||||||
method.setPlugin(plugin);
|
method.setPlugin(plugin);
|
||||||
return method;
|
return method;
|
||||||
|
@ -71,55 +71,46 @@ public class Methods {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setMethod(Plugin method) {
|
public boolean setMethod(Plugin method) {
|
||||||
if (hasMethod()) return true;
|
if(hasMethod()) return true;
|
||||||
if (self) {
|
if(self) { self = false; return false; }
|
||||||
self = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
boolean match = false;
|
boolean match = false;
|
||||||
Plugin plugin;
|
Plugin plugin = null;
|
||||||
PluginManager manager = method.getServer().getPluginManager();
|
PluginManager manager = method.getServer().getPluginManager();
|
||||||
|
|
||||||
for (String name : this.Dependencies) {
|
for(String name: this.getDependencies()) {
|
||||||
if (hasMethod()) break;
|
if(hasMethod()) break;
|
||||||
if (method.getDescription().getName().equals(name)) plugin = method;
|
if(method.getDescription().getName().equals(name)) plugin = method; else plugin = manager.getPlugin(name);
|
||||||
else plugin = manager.getPlugin(name);
|
if(plugin == null) continue;
|
||||||
if (plugin == null) continue;
|
|
||||||
|
|
||||||
if (!plugin.isEnabled()) {
|
|
||||||
this.self = true;
|
|
||||||
manager.enablePlugin(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
Method current = this.createMethod(plugin);
|
Method current = this.createMethod(plugin);
|
||||||
if (current == null) continue;
|
if(current == null) continue;
|
||||||
|
|
||||||
if (this.preferred.isEmpty())
|
if(this.preferred.isEmpty())
|
||||||
this.Method = current;
|
this.Method = current;
|
||||||
else {
|
else {
|
||||||
this.Attachables.add(current);
|
this.Attachables.add(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.preferred.isEmpty()) {
|
if(!this.preferred.isEmpty()) {
|
||||||
do {
|
do {
|
||||||
if (hasMethod()) {
|
if(hasMethod()) {
|
||||||
match = true;
|
match = true;
|
||||||
} else {
|
} else {
|
||||||
for (Method attached : this.Attachables) {
|
for(Method attached: this.Attachables) {
|
||||||
if (attached == null) continue;
|
if(attached == null) continue;
|
||||||
|
|
||||||
if (hasMethod()) {
|
if(hasMethod()) {
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.preferred.isEmpty()) this.Method = attached;
|
if(this.preferred.isEmpty()) this.Method = attached;
|
||||||
|
|
||||||
if (count == 0) {
|
if(count == 0) {
|
||||||
if (this.preferred.equalsIgnoreCase(attached.getName()))
|
if(this.preferred.equalsIgnoreCase(attached.getName()))
|
||||||
this.Method = attached;
|
this.Method = attached;
|
||||||
} else {
|
} else {
|
||||||
this.Method = attached;
|
this.Method = attached;
|
||||||
|
@ -128,7 +119,7 @@ public class Methods {
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
} while (!match);
|
} while(!match);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasMethod();
|
return hasMethod();
|
||||||
|
@ -139,7 +130,7 @@ public class Methods {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkDisabled(Plugin method) {
|
public boolean checkDisabled(Plugin method) {
|
||||||
if (!hasMethod()) return true;
|
if(!hasMethod()) return true;
|
||||||
if (Method.isCompatible(method)) Method = null;
|
if (Method.isCompatible(method)) Method = null;
|
||||||
return (Method == null);
|
return (Method == null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class BOSE implements Method {
|
||||||
|
|
||||||
public String format(double amount) {
|
public String format(double amount) {
|
||||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||||
if (amount == 1) currency = this.BOSEconomy.getMoneyName();
|
if(amount == 1) currency = this.BOSEconomy.getMoneyName();
|
||||||
return amount + " " + currency;
|
return amount + " " + currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class BOSE implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public MethodAccount getAccount(String name) {
|
||||||
if (!hasAccount(name)) return null;
|
if(!hasAccount(name)) return null;
|
||||||
return new BOSEAccount(name, this.BOSEconomy);
|
return new BOSEAccount(name, this.BOSEconomy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,10 +55,10 @@ public class BOSE implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public void setPlugin(Plugin plugin) {
|
||||||
BOSEconomy = (BOSEconomy) plugin;
|
BOSEconomy = (BOSEconomy)plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BOSEAccount implements MethodAccount {
|
public class BOSEAccount implements MethodAccount {
|
||||||
private String name;
|
private String name;
|
||||||
private BOSEconomy BOSEconomy;
|
private BOSEconomy BOSEconomy;
|
||||||
|
|
||||||
|
@ -68,34 +68,34 @@ public class BOSE implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double balance() {
|
public double balance() {
|
||||||
return (double) this.BOSEconomy.getPlayerMoney(this.name);
|
return Double.valueOf(this.BOSEconomy.getPlayerMoney(this.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean set(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean add(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean subtract(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean multiply(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean divide(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class BOSE implements Method {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BOSEBankAccount implements MethodBankAccount {
|
public class BOSEBankAccount implements MethodBankAccount {
|
||||||
private String bank;
|
private String bank;
|
||||||
private String name;
|
private String name;
|
||||||
private BOSEconomy BOSEconomy;
|
private BOSEconomy BOSEconomy;
|
||||||
|
@ -140,35 +140,35 @@ public class BOSE implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double balance() {
|
public double balance() {
|
||||||
return (double) this.BOSEconomy.getBankMoney(name);
|
return Double.valueOf(this.BOSEconomy.getBankMoney(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean set(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
return this.BOSEconomy.setBankMoney(name, IntAmount, true);
|
return this.BOSEconomy.setBankMoney(name, IntAmount, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean add(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setBankMoney(this.name, (balance + IntAmount), false);
|
return this.BOSEconomy.setBankMoney(this.name, (balance + IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean subtract(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setBankMoney(this.name, (balance - IntAmount), false);
|
return this.BOSEconomy.setBankMoney(this.name, (balance - IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean multiply(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setBankMoney(this.name, (balance * IntAmount), false);
|
return this.BOSEconomy.setBankMoney(this.name, (balance * IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean divide(double amount) {
|
||||||
int IntAmount = (int) Math.ceil(amount);
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
int balance = (int) this.balance();
|
int balance = (int)this.balance();
|
||||||
return this.BOSEconomy.setBankMoney(this.name, (balance / IntAmount), false);
|
return this.BOSEconomy.setBankMoney(this.name, (balance / IntAmount), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@ import com.earth2me.essentials.Essentials;
|
||||||
import com.earth2me.essentials.api.Economy;
|
import com.earth2me.essentials.api.Economy;
|
||||||
import com.earth2me.essentials.api.NoLoanPermittedException;
|
import com.earth2me.essentials.api.NoLoanPermittedException;
|
||||||
import com.earth2me.essentials.api.UserDoesNotExistException;
|
import com.earth2me.essentials.api.UserDoesNotExistException;
|
||||||
|
|
||||||
import com.nijikokun.register.payment.forChestShop.Method;
|
import com.nijikokun.register.payment.forChestShop.Method;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class EE17 implements Method {
|
public class EE17 implements Method {
|
||||||
|
@ -43,29 +45,26 @@ public class EE17 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public MethodAccount getAccount(String name) {
|
||||||
if (!hasAccount(name)) return null;
|
if(!hasAccount(name)) return null;
|
||||||
return new EEcoAccount(name);
|
return new EEcoAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public boolean isCompatible(Plugin plugin) {
|
||||||
try {
|
try { Class.forName("com.earth2me.essentials.api.Economy"); }
|
||||||
Class.forName("com.earth2me.essentials.api.Economy");
|
catch(Exception e) { return false; }
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("essentials") && plugin instanceof Essentials;
|
return plugin.getDescription().getName().equalsIgnoreCase("essentials") && plugin instanceof Essentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public void setPlugin(Plugin plugin) {
|
||||||
Essentials = (Essentials) plugin;
|
Essentials = (Essentials)plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EEcoAccount implements MethodAccount {
|
public class EEcoAccount implements MethodAccount {
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public EEcoAccount(String name) {
|
public EEcoAccount(String name) {
|
||||||
|
|
|
@ -2,7 +2,9 @@ package com.nijikokun.register.payment.forChestShop.methods;
|
||||||
|
|
||||||
import com.nijiko.coelho.iConomy.iConomy;
|
import com.nijiko.coelho.iConomy.iConomy;
|
||||||
import com.nijiko.coelho.iConomy.system.Account;
|
import com.nijiko.coelho.iConomy.system.Account;
|
||||||
|
|
||||||
import com.nijikokun.register.payment.forChestShop.Method;
|
import com.nijikokun.register.payment.forChestShop.Method;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class iCo4 implements Method {
|
public class iCo4 implements Method {
|
||||||
|
@ -21,7 +23,7 @@ public class iCo4 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public String format(double amount) {
|
||||||
return iConomy.getBank().format(amount);
|
return this.iConomy.getBank().format(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public boolean hasBanks() {
|
||||||
|
@ -33,7 +35,7 @@ public class iCo4 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasAccount(String name) {
|
||||||
return iConomy.getBank().hasAccount(name);
|
return this.iConomy.getBank().hasAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasBankAccount(String bank, String name) {
|
||||||
|
@ -41,22 +43,22 @@ public class iCo4 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public MethodAccount getAccount(String name) {
|
||||||
return new iCoAccount(iConomy.getBank().getAccount(name));
|
return new iCoAccount(this.iConomy.getBank().getAccount(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public boolean isCompatible(Plugin plugin) {
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && !plugin.getClass().getName().equals("com.iConomy.iConomy") && plugin instanceof iConomy;
|
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && !plugin.getClass().getName().equals("com.iConomy.iConomy") && plugin instanceof iConomy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public void setPlugin(Plugin plugin) {
|
||||||
iConomy = (iConomy) plugin;
|
iConomy = (iConomy)plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class iCoAccount implements MethodAccount {
|
public class iCoAccount implements MethodAccount {
|
||||||
private Account account;
|
private Account account;
|
||||||
|
|
||||||
public iCoAccount(Account account) {
|
public iCoAccount(Account account) {
|
||||||
|
@ -72,31 +74,31 @@ public class iCo4 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean set(double amount) {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.setBalance(amount);
|
this.account.setBalance(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean add(double amount) {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.add(amount);
|
this.account.add(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean subtract(double amount) {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.subtract(amount);
|
this.account.subtract(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean multiply(double amount) {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.multiply(amount);
|
this.account.multiply(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean divide(double amount) {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.divide(amount);
|
this.account.divide(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +120,7 @@ public class iCo4 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean remove() {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.remove();
|
this.account.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@ import com.iConomy.system.Account;
|
||||||
import com.iConomy.system.BankAccount;
|
import com.iConomy.system.BankAccount;
|
||||||
import com.iConomy.system.Holdings;
|
import com.iConomy.system.Holdings;
|
||||||
import com.iConomy.util.Constants;
|
import com.iConomy.util.Constants;
|
||||||
|
|
||||||
import com.nijikokun.register.payment.forChestShop.Method;
|
import com.nijikokun.register.payment.forChestShop.Method;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class iCo5 implements Method {
|
public class iCo5 implements Method {
|
||||||
|
@ -24,7 +26,7 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public String format(double amount) {
|
||||||
return iConomy.format(amount);
|
return this.iConomy.format(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public boolean hasBanks() {
|
||||||
|
@ -32,34 +34,34 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
public boolean hasBank(String bank) {
|
||||||
return (hasBanks()) && iConomy.Banks.exists(bank);
|
return (!hasBanks()) ? false : this.iConomy.Banks.exists(bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasAccount(String name) {
|
||||||
return iConomy.hasAccount(name);
|
return this.iConomy.hasAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasBankAccount(String bank, String name) {
|
||||||
return (hasBank(bank)) && iConomy.getBank(bank).hasAccount(name);
|
return (!hasBank(bank)) ? false : this.iConomy.getBank(bank).hasAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public MethodAccount getAccount(String name) {
|
||||||
return new iCoAccount(iConomy.getAccount(name));
|
return new iCoAccount(this.iConomy.getAccount(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||||
return new iCoBankAccount(iConomy.getBank(bank).getAccount(name));
|
return new iCoBankAccount(this.iConomy.getBank(bank).getAccount(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public boolean isCompatible(Plugin plugin) {
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iConomy.iConomy") && plugin instanceof iConomy;
|
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iConomy.iConomy") && plugin instanceof iConomy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public void setPlugin(Plugin plugin) {
|
||||||
iConomy = (iConomy) plugin;
|
iConomy = (iConomy)plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class iCoAccount implements MethodAccount {
|
public class iCoAccount implements MethodAccount {
|
||||||
private Account account;
|
private Account account;
|
||||||
private Holdings holdings;
|
private Holdings holdings;
|
||||||
|
|
||||||
|
@ -77,31 +79,31 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean set(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.set(amount);
|
this.holdings.set(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean add(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.add(amount);
|
this.holdings.add(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean subtract(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.subtract(amount);
|
this.holdings.subtract(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean multiply(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.multiply(amount);
|
this.holdings.multiply(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean divide(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.divide(amount);
|
this.holdings.divide(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -123,13 +125,13 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean remove() {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.remove();
|
this.account.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class iCoBankAccount implements MethodBankAccount {
|
public class iCoBankAccount implements MethodBankAccount {
|
||||||
private BankAccount account;
|
private BankAccount account;
|
||||||
private Holdings holdings;
|
private Holdings holdings;
|
||||||
|
|
||||||
|
@ -155,31 +157,31 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean set(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.set(amount);
|
this.holdings.set(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean add(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.add(amount);
|
this.holdings.add(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean subtract(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.subtract(amount);
|
this.holdings.subtract(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean multiply(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.multiply(amount);
|
this.holdings.multiply(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean divide(double amount) {
|
||||||
if (this.holdings == null) return false;
|
if(this.holdings == null) return false;
|
||||||
this.holdings.divide(amount);
|
this.holdings.divide(amount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +203,7 @@ public class iCo5 implements Method {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean remove() {
|
||||||
if (this.account == null) return false;
|
if(this.account == null) return false;
|
||||||
this.account.remove();
|
this.account.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ name: ChestShop
|
||||||
main: com.Acrobot.ChestShop.ChestShop
|
main: com.Acrobot.ChestShop.ChestShop
|
||||||
|
|
||||||
database: true
|
database: true
|
||||||
version: 3.00 BETA 5
|
version: 3.00 BETA 6
|
||||||
|
|
||||||
|
|
||||||
author: Acrobot
|
author: Acrobot
|
||||||
|
|
Loading…
Reference in New Issue