mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-13 16:38:06 +02:00
Updating for register 1.3
This commit is contained in:
parent
41e11a738d
commit
efcab71969
@ -21,10 +21,9 @@ public class EssentialsPluginListener extends ServerListener implements IConf
|
|||||||
public void onPluginEnable(final PluginEnableEvent event)
|
public void onPluginEnable(final PluginEnableEvent event)
|
||||||
{
|
{
|
||||||
ess.getPermissionsHandler().checkPermissions();
|
ess.getPermissionsHandler().checkPermissions();
|
||||||
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(event.getPlugin()))
|
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
|
LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +34,7 @@ public class EssentialsPluginListener extends ServerListener implements IConf
|
|||||||
// Check to see if the plugin thats being disabled is the one we are using
|
// Check to see if the plugin thats being disabled is the one we are using
|
||||||
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
|
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
|
||||||
{
|
{
|
||||||
|
ess.getPaymentMethod().reset();
|
||||||
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
|
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -97,29 +96,31 @@ public class Commandptime extends EssentialsCommand
|
|||||||
*/
|
*/
|
||||||
private void getUsersTime(final CommandSender sender, final Collection<User> users)
|
private void getUsersTime(final CommandSender sender, final Collection<User> users)
|
||||||
{
|
{
|
||||||
if (users.size() > 1)
|
if (users.size() > 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimePlayers"));
|
sender.sendMessage(Util.format("pTimePlayers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (User user : users)
|
for (User user : users)
|
||||||
{
|
{
|
||||||
if(user.getPlayerTimeOffset() == 0)
|
if (user.getPlayerTimeOffset() == 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeNormal", user.getName()));
|
sender.sendMessage(Util.format("pTimeNormal", user.getName()));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
String time = DescParseTickFormat.format(user.getPlayerTime());
|
String time = DescParseTickFormat.format(user.getPlayerTime());
|
||||||
if(!user.isPlayerTimeRelative())
|
if (!user.isPlayerTimeRelative())
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time));
|
sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time));
|
sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,8 @@ public class Commandptime extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString()));
|
sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString()));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
sender.sendMessage(Util.format("pTimeSet", time, msg.toString()));
|
sender.sendMessage(Util.format("pTimeSet", time, msg.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
worldSelector = args[1];
|
worldSelector = args[1];
|
||||||
}
|
}
|
||||||
Set<World> worlds = getWorlds(server, sender, worldSelector);
|
final Set<World> worlds = getWorlds(server, sender, worldSelector);
|
||||||
|
|
||||||
// If no arguments we are reading the time
|
// If no arguments we are reading the time
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
@ -34,7 +34,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = ess.getUser(sender);
|
final User user = ess.getUser(sender);
|
||||||
if (user != null && !user.isAuthorized("essentials.time.set"))
|
if (user != null && !user.isAuthorized("essentials.time.set"))
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("timeSetPermission"));
|
user.sendMessage(Util.i18n("timeSetPermission"));
|
||||||
|
@ -21,11 +21,9 @@ public class Commandunban extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
String name;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
User u = getPlayer(server, args, 0, true);
|
final User u = getPlayer(server, args, 0, true);
|
||||||
name = u.getName();
|
|
||||||
u.setBanned(false);
|
u.setBanned(false);
|
||||||
sender.sendMessage(Util.i18n("unbannedPlayer"));
|
sender.sendMessage(Util.i18n("unbannedPlayer"));
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.plugin.Plugin;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method.java
|
* Interface to be implemented by a payment method.
|
||||||
*
|
*
|
||||||
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||||
* @copyright Copyright (C) 2011
|
* @copyright Copyright (C) 2011
|
||||||
@ -41,6 +41,14 @@ public interface Method
|
|||||||
*/
|
*/
|
||||||
public String getVersion();
|
public String getVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of decimal places that get stored
|
||||||
|
* NOTE: it will return -1 if there is no rounding
|
||||||
|
*
|
||||||
|
* @return <code>int</code> for each decimal place
|
||||||
|
*/
|
||||||
|
public int fractionalDigits();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats amounts into this payment methods style of currency display.
|
* Formats amounts into this payment methods style of currency display.
|
||||||
*
|
*
|
||||||
|
@ -5,9 +5,6 @@ import java.util.Set;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>Methods</code> initializes Methods that utilize the Method interface
|
* The <code>Methods</code> initializes Methods that utilize the Method interface
|
||||||
@ -15,15 +12,13 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* Allowing you to check whether a payment method exists or not.
|
* Allowing you to check whether a payment method exists or not.
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
|
||||||
* Methods methods = new Methods();
|
|
||||||
* </pre></blockquote>
|
|
||||||
*
|
|
||||||
* Methods also allows you to set a preferred method of payment before it captures
|
* Methods also allows you to set a preferred method of payment before it captures
|
||||||
* payment plugins in the initialization process.
|
* payment plugins in the initialization process.
|
||||||
*
|
*
|
||||||
|
* in <code>bukkit.yml</code>:
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* Methods methods = new Methods("iConomy");
|
* economy:
|
||||||
|
* preferred: "iConomy"
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
*
|
||||||
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||||
@ -32,51 +27,62 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class Methods
|
public class Methods
|
||||||
{
|
{
|
||||||
private boolean self = false;
|
private static String version = null;
|
||||||
private Method Method = null;
|
private static boolean self = false;
|
||||||
private String preferred = "";
|
private static Method Method = null;
|
||||||
private Set<Method> Methods = new HashSet<Method>();
|
private static String preferred = "";
|
||||||
private Set<String> Dependencies = new HashSet<String>();
|
private static Set<Method> Methods = new HashSet<Method>();
|
||||||
private Set<Method> Attachables = new HashSet<Method>();
|
private static Set<String> Dependencies = new HashSet<String>();
|
||||||
|
private static Set<Method> Attachables = new HashSet<Method>();
|
||||||
|
|
||||||
/**
|
static
|
||||||
* Initialize Method class
|
|
||||||
*/
|
|
||||||
public Methods()
|
|
||||||
{
|
{
|
||||||
this._init();
|
_init();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes <code>Methods</code> class utilizing a "preferred" payment method check before
|
|
||||||
* returning the first method that was initialized.
|
|
||||||
*
|
|
||||||
* @param preferred Payment method that is most preferred for this setup.
|
|
||||||
*/
|
|
||||||
public Methods(String preferred)
|
|
||||||
{
|
|
||||||
this._init();
|
|
||||||
|
|
||||||
if (this.Dependencies.contains(preferred))
|
|
||||||
{
|
|
||||||
this.preferred = preferred;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement all methods along with their respective name & class.
|
* Implement all methods along with their respective name & class.
|
||||||
*
|
|
||||||
* @see #Methods()
|
|
||||||
* @see #Methods(java.lang.String)
|
|
||||||
*/
|
*/
|
||||||
private void _init()
|
private static void _init()
|
||||||
{
|
{
|
||||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo6());
|
||||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
||||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo6());
|
addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
||||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
||||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
||||||
this.addMethod("MultiCurrency", new com.earth2me.essentials.register.payment.methods.MCUR());
|
addMethod("Currency", new com.earth2me.essentials.register.payment.methods.MCUR());
|
||||||
|
Dependencies.add("MultiCurrency");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by the plugin to setup version
|
||||||
|
*
|
||||||
|
* @param v version
|
||||||
|
*/
|
||||||
|
public static void setVersion(String v)
|
||||||
|
{
|
||||||
|
version = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to reset methods during disable
|
||||||
|
*/
|
||||||
|
public static void reset()
|
||||||
|
{
|
||||||
|
version = null;
|
||||||
|
self = false;
|
||||||
|
Method = null;
|
||||||
|
preferred = "";
|
||||||
|
Attachables.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to get version of Register plugin
|
||||||
|
* @return version
|
||||||
|
*/
|
||||||
|
public static String getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +92,7 @@ public class Methods
|
|||||||
* @return <code>Set<String></code> - Array of payment methods that are loaded.
|
* @return <code>Set<String></code> - Array of payment methods that are loaded.
|
||||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||||
*/
|
*/
|
||||||
public Set<String> getDependencies()
|
public static Set<String> getDependencies()
|
||||||
{
|
{
|
||||||
return Dependencies;
|
return Dependencies;
|
||||||
}
|
}
|
||||||
@ -98,7 +104,7 @@ public class Methods
|
|||||||
* @param plugin Plugin data from bukkit, Internal Class file.
|
* @param plugin Plugin data from bukkit, Internal Class file.
|
||||||
* @return Method <em>or</em> Null
|
* @return Method <em>or</em> Null
|
||||||
*/
|
*/
|
||||||
public Method createMethod(Plugin plugin)
|
public static Method createMethod(Plugin plugin)
|
||||||
{
|
{
|
||||||
for (Method method : Methods)
|
for (Method method : Methods)
|
||||||
{
|
{
|
||||||
@ -112,7 +118,7 @@ public class Methods
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMethod(String name, Method method)
|
private static void addMethod(String name, Method method)
|
||||||
{
|
{
|
||||||
Dependencies.add(name);
|
Dependencies.add(name);
|
||||||
Methods.add(method);
|
Methods.add(method);
|
||||||
@ -125,7 +131,7 @@ public class Methods
|
|||||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||||
* @see #checkDisabled(org.bukkit.plugin.Plugin)
|
* @see #checkDisabled(org.bukkit.plugin.Plugin)
|
||||||
*/
|
*/
|
||||||
public boolean hasMethod()
|
public static boolean hasMethod()
|
||||||
{
|
{
|
||||||
return (Method != null);
|
return (Method != null);
|
||||||
}
|
}
|
||||||
@ -134,15 +140,16 @@ public class Methods
|
|||||||
* Checks Plugin Class against a multitude of checks to verify it's usability
|
* Checks Plugin Class against a multitude of checks to verify it's usability
|
||||||
* as a payment method.
|
* as a payment method.
|
||||||
*
|
*
|
||||||
* @param method Plugin data from bukkit, Internal Class file.
|
* @param <code>PluginManager</code> the plugin manager for the server
|
||||||
* @return <code>boolean</code> True on success, False on failure.
|
* @return <code>boolean</code> True on success, False on failure.
|
||||||
*/
|
*/
|
||||||
public boolean setMethod(Plugin method)
|
public static boolean setMethod(PluginManager manager)
|
||||||
{
|
{
|
||||||
if (hasMethod())
|
if (hasMethod())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
self = false;
|
self = false;
|
||||||
@ -152,44 +159,37 @@ public class Methods
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
boolean match = false;
|
boolean match = false;
|
||||||
Plugin plugin = null;
|
Plugin plugin = null;
|
||||||
PluginManager manager = method.getServer().getPluginManager();
|
|
||||||
|
|
||||||
for (String name : this.getDependencies())
|
for (String name : getDependencies())
|
||||||
{
|
{
|
||||||
if (hasMethod())
|
if (hasMethod())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (method.getDescription().getName().equals(name))
|
|
||||||
{
|
plugin = manager.getPlugin(name);
|
||||||
plugin = method;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugin = manager.getPlugin(name);
|
|
||||||
}
|
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Method current = this.createMethod(plugin);
|
Method current = createMethod(plugin);
|
||||||
if (current == null)
|
if (current == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.preferred.isEmpty())
|
if (preferred.isEmpty())
|
||||||
{
|
{
|
||||||
this.Method = current;
|
Method = current;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Attachables.add(current);
|
Attachables.add(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.preferred.isEmpty())
|
if (!preferred.isEmpty())
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -199,7 +199,7 @@ public class Methods
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (Method attached : this.Attachables)
|
for (Method attached : Attachables)
|
||||||
{
|
{
|
||||||
if (attached == null)
|
if (attached == null)
|
||||||
{
|
{
|
||||||
@ -212,21 +212,21 @@ public class Methods
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.preferred.isEmpty())
|
if (preferred.isEmpty())
|
||||||
{
|
{
|
||||||
this.Method = attached;
|
Method = attached;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
if (this.preferred.equalsIgnoreCase(attached.getName()))
|
if (preferred.equalsIgnoreCase(attached.getName()))
|
||||||
{
|
{
|
||||||
this.Method = attached;
|
Method = attached;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Method = attached;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.Method = attached;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,12 +239,28 @@ public class Methods
|
|||||||
return hasMethod();
|
return hasMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the preferred economy
|
||||||
|
*
|
||||||
|
* @return <code>boolean</code>
|
||||||
|
*/
|
||||||
|
public static boolean setPreferred(String check)
|
||||||
|
{
|
||||||
|
if (getDependencies().contains(check))
|
||||||
|
{
|
||||||
|
preferred = check;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab the existing and initialized (hopefully) Method Class.
|
* Grab the existing and initialized (hopefully) Method Class.
|
||||||
*
|
*
|
||||||
* @return <code>Method</code> <em>or</em> <code>Null</code>
|
* @return <code>Method</code> <em>or</em> <code>Null</code>
|
||||||
*/
|
*/
|
||||||
public Method getMethod()
|
public static Method getMethod()
|
||||||
{
|
{
|
||||||
return Method;
|
return Method;
|
||||||
}
|
}
|
||||||
@ -256,16 +272,18 @@ public class Methods
|
|||||||
* @param method Plugin data from bukkit, Internal Class file.
|
* @param method Plugin data from bukkit, Internal Class file.
|
||||||
* @return <code>boolean</code>
|
* @return <code>boolean</code>
|
||||||
*/
|
*/
|
||||||
public boolean checkDisabled(Plugin method)
|
public static boolean checkDisabled(Plugin method)
|
||||||
{
|
{
|
||||||
if (!hasMethod())
|
if (!hasMethod())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Method.isCompatible(method))
|
if (Method.isCompatible(method))
|
||||||
{
|
{
|
||||||
Method = null;
|
Method = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Method == null);
|
return (Method == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.register.payment.methods;
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
import com.earth2me.essentials.register.payment.Method;
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
|
|
||||||
import cosine.boseconomy.BOSEconomy;
|
import cosine.boseconomy.BOSEconomy;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BOSEconomy 6 Implementation of Method
|
* BOSEconomy 6 Implementation of Method
|
||||||
*
|
*
|
||||||
@ -11,191 +13,256 @@ import org.bukkit.plugin.Plugin;
|
|||||||
* @copyright (c) 2011
|
* @copyright (c) 2011
|
||||||
* @license AOL license <http://aol.nexua.org>
|
* @license AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
public class BOSE6 implements Method {
|
@SuppressWarnings("deprecation")
|
||||||
private BOSEconomy BOSEconomy;
|
public class BOSE6 implements Method
|
||||||
|
{
|
||||||
|
private BOSEconomy BOSEconomy;
|
||||||
|
|
||||||
public BOSEconomy getPlugin() {
|
public BOSEconomy getPlugin()
|
||||||
return this.BOSEconomy;
|
{
|
||||||
}
|
return this.BOSEconomy;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
return "BOSEconomy";
|
{
|
||||||
}
|
return "BOSEconomy";
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion()
|
||||||
return "0.6.2";
|
{
|
||||||
}
|
return "0.6.2";
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public int fractionalDigits()
|
||||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
{
|
||||||
if(amount == 1) currency = this.BOSEconomy.getMoneyName();
|
return 0;
|
||||||
return amount + " " + currency;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public String format(double amount)
|
||||||
return true;
|
{
|
||||||
}
|
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
if (amount == 1)
|
||||||
return this.BOSEconomy.bankExists(bank);
|
{
|
||||||
}
|
currency = this.BOSEconomy.getMoneyName();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
return amount + " " + currency;
|
||||||
return this.BOSEconomy.playerRegistered(name, false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasBanks()
|
||||||
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public boolean hasBank(String bank)
|
||||||
if(!hasAccount(name)) return null;
|
{
|
||||||
return new BOSEAccount(name, this.BOSEconomy);
|
return this.BOSEconomy.bankExists(bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public boolean hasAccount(String name)
|
||||||
if(!hasBankAccount(bank, name)) return null;
|
{
|
||||||
return new BOSEBankAccount(bank, BOSEconomy);
|
return this.BOSEconomy.playerRegistered(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public boolean hasBankAccount(String bank, String name)
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy") && plugin instanceof BOSEconomy && plugin.getDescription().getVersion().equals("0.6.2");
|
{
|
||||||
}
|
return this.BOSEconomy.isBankOwner(bank, name)
|
||||||
|
|| this.BOSEconomy.isBankMember(bank, name);
|
||||||
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public MethodAccount getAccount(String name)
|
||||||
BOSEconomy = (BOSEconomy)plugin;
|
{
|
||||||
}
|
if (!hasAccount(name))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public class BOSEAccount implements MethodAccount {
|
return new BOSEAccount(name, this.BOSEconomy);
|
||||||
private String name;
|
}
|
||||||
private BOSEconomy BOSEconomy;
|
|
||||||
|
|
||||||
public BOSEAccount(String name, BOSEconomy bOSEconomy) {
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
this.name = name;
|
{
|
||||||
this.BOSEconomy = bOSEconomy;
|
if (!hasBankAccount(bank, name))
|
||||||
}
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public double balance() {
|
return new BOSEBankAccount(bank, BOSEconomy);
|
||||||
return (double) this.BOSEconomy.getPlayerMoney(this.name);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean isCompatible(Plugin plugin)
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy")
|
||||||
}
|
&& plugin instanceof BOSEconomy
|
||||||
|
&& plugin.getDescription().getVersion().equals("0.6.2");
|
||||||
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public void setPlugin(Plugin plugin)
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
BOSEconomy = (BOSEconomy)plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
|
||||||
int balance = (int)this.balance();
|
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public class BOSEAccount implements MethodAccount
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
int balance = (int)this.balance();
|
private final String name;
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
private final BOSEconomy BOSEconomy;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public BOSEAccount(String name, BOSEconomy bOSEconomy)
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
int balance = (int)this.balance();
|
this.name = name;
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
this.BOSEconomy = bOSEconomy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public double balance()
|
||||||
return (this.balance() >= amount);
|
{
|
||||||
}
|
return (double)this.BOSEconomy.getPlayerMoney(this.name);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean set(double amount)
|
||||||
return (this.balance() > amount);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, IntAmount, false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean add(double amount)
|
||||||
return (this.balance() < amount);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
return this.BOSEconomy.addPlayerMoney(this.name, IntAmount, false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean subtract(double amount)
|
||||||
return (this.balance() < 0);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance - IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean multiply(double amount)
|
||||||
return false;
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
}
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance * IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public class BOSEBankAccount implements MethodBankAccount {
|
public boolean divide(double amount)
|
||||||
private final String bank;
|
{
|
||||||
private final BOSEconomy BOSEconomy;
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance / IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) {
|
public boolean hasEnough(double amount)
|
||||||
this.bank = bank;
|
{
|
||||||
this.BOSEconomy = bOSEconomy;
|
return (this.balance() >= amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBankName() {
|
public boolean hasOver(double amount)
|
||||||
return this.bank;
|
{
|
||||||
}
|
return (this.balance() > amount);
|
||||||
|
}
|
||||||
|
|
||||||
public int getBankId() {
|
public boolean hasUnder(double amount)
|
||||||
return -1;
|
{
|
||||||
}
|
return (this.balance() < amount);
|
||||||
|
}
|
||||||
|
|
||||||
public double balance() {
|
public boolean isNegative()
|
||||||
return (double) this.BOSEconomy.getBankMoney(bank);
|
{
|
||||||
}
|
return (this.balance() < 0);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public boolean remove()
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
return this.BOSEconomy.setBankMoney(bank, IntAmount, true);
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
|
||||||
int balance = (int)this.balance();
|
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance + IntAmount), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public class BOSEBankAccount implements MethodBankAccount
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
int balance = (int)this.balance();
|
private final String bank;
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance - IntAmount), false);
|
private final BOSEconomy BOSEconomy;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy)
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
int balance = (int)this.balance();
|
this.bank = bank;
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance * IntAmount), false);
|
this.BOSEconomy = bOSEconomy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public String getBankName()
|
||||||
int IntAmount = (int)Math.ceil(amount);
|
{
|
||||||
int balance = (int)this.balance();
|
return this.bank;
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance / IntAmount), false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public int getBankId()
|
||||||
return (this.balance() >= amount);
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public double balance()
|
||||||
return (this.balance() > amount);
|
{
|
||||||
}
|
return (double)this.BOSEconomy.getBankMoney(bank);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean set(double amount)
|
||||||
return (this.balance() < amount);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, IntAmount, true);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean add(double amount)
|
||||||
return (this.balance() < 0);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance + IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean subtract(double amount)
|
||||||
return this.BOSEconomy.removeBank(bank);
|
{
|
||||||
}
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
}
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance - IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean multiply(double amount)
|
||||||
|
{
|
||||||
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance * IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean divide(double amount)
|
||||||
|
{
|
||||||
|
int IntAmount = (int)Math.ceil(amount);
|
||||||
|
int balance = (int)this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance / IntAmount), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() >= amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() > amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUnder(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() < amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return (this.balance() < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove()
|
||||||
|
{
|
||||||
|
return this.BOSEconomy.removeBank(bank);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.register.payment.methods;
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
import com.earth2me.essentials.register.payment.Method;
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
|
|
||||||
import cosine.boseconomy.BOSEconomy;
|
import cosine.boseconomy.BOSEconomy;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BOSEconomy 7 Implementation of Method
|
* BOSEconomy 7 Implementation of Method
|
||||||
*
|
*
|
||||||
@ -12,182 +14,244 @@ import org.bukkit.plugin.Plugin;
|
|||||||
* @copyright (c) 2011
|
* @copyright (c) 2011
|
||||||
* @license AOL license <http://aol.nexua.org>
|
* @license AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
|
public class BOSE7 implements Method
|
||||||
|
{
|
||||||
|
private BOSEconomy BOSEconomy;
|
||||||
|
|
||||||
public class BOSE7 implements Method {
|
public BOSEconomy getPlugin()
|
||||||
private BOSEconomy BOSEconomy;
|
{
|
||||||
|
return this.BOSEconomy;
|
||||||
|
}
|
||||||
|
|
||||||
public BOSEconomy getPlugin() {
|
public String getName()
|
||||||
return this.BOSEconomy;
|
{
|
||||||
}
|
return "BOSEconomy";
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getVersion()
|
||||||
return "BOSEconomy";
|
{
|
||||||
}
|
return "0.7.0";
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public int fractionalDigits()
|
||||||
return "0.7.0";
|
{
|
||||||
}
|
return this.BOSEconomy.getFractionalDigits();
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public String format(double amount)
|
||||||
String currency = this.BOSEconomy.getMoneyNamePlural();
|
{
|
||||||
if(amount == 1) currency = this.BOSEconomy.getMoneyName();
|
String currency = this.BOSEconomy.getMoneyNamePlural();
|
||||||
return amount + " " + currency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBanks() {
|
if (amount == 1)
|
||||||
return true;
|
{
|
||||||
}
|
currency = this.BOSEconomy.getMoneyName();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
return amount + " " + currency;
|
||||||
return this.BOSEconomy.bankExists(bank);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasBanks()
|
||||||
return this.BOSEconomy.playerRegistered(name, false);
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasBank(String bank)
|
||||||
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
{
|
||||||
}
|
return this.BOSEconomy.bankExists(bank);
|
||||||
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public boolean hasAccount(String name)
|
||||||
if(!hasAccount(name)) return null;
|
{
|
||||||
return new BOSEAccount(name, this.BOSEconomy);
|
return this.BOSEconomy.playerRegistered(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public boolean hasBankAccount(String bank, String name)
|
||||||
if(!hasBankAccount(bank, name)) return null;
|
{
|
||||||
return new BOSEBankAccount(bank, BOSEconomy);
|
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public MethodAccount getAccount(String name)
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy") && plugin instanceof BOSEconomy && !plugin.getDescription().getVersion().equals("0.6.2");
|
{
|
||||||
}
|
if (!hasAccount(name))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
return new BOSEAccount(name, this.BOSEconomy);
|
||||||
BOSEconomy = (BOSEconomy)plugin;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class BOSEAccount implements MethodAccount {
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
private String name;
|
{
|
||||||
private BOSEconomy BOSEconomy;
|
if (!hasBankAccount(bank, name))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public BOSEAccount(String name, BOSEconomy bOSEconomy) {
|
return new BOSEBankAccount(bank, BOSEconomy);
|
||||||
this.name = name;
|
}
|
||||||
this.BOSEconomy = bOSEconomy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double balance() {
|
public boolean isCompatible(Plugin plugin)
|
||||||
return this.BOSEconomy.getPlayerMoneyDouble(this.name);
|
{
|
||||||
}
|
return plugin.getDescription().getName().equalsIgnoreCase("boseconomy")
|
||||||
|
&& plugin instanceof BOSEconomy
|
||||||
|
&& !plugin.getDescription().getVersion().equals("0.6.2");
|
||||||
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public void setPlugin(Plugin plugin)
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, amount, false);
|
{
|
||||||
}
|
BOSEconomy = (BOSEconomy)plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
|
||||||
return this.BOSEconomy.addPlayerMoney(this.name, amount, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public class BOSEAccount implements MethodAccount
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance - amount), false);
|
private String name;
|
||||||
}
|
private BOSEconomy BOSEconomy;
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public BOSEAccount(String name, BOSEconomy bOSEconomy)
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance * amount), false);
|
this.name = name;
|
||||||
}
|
this.BOSEconomy = bOSEconomy;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public double balance()
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setPlayerMoney(this.name, (balance / amount), false);
|
return this.BOSEconomy.getPlayerMoneyDouble(this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public boolean set(double amount)
|
||||||
return (this.balance() >= amount);
|
{
|
||||||
}
|
return this.BOSEconomy.setPlayerMoney(this.name, amount, false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean add(double amount)
|
||||||
return (this.balance() > amount);
|
{
|
||||||
}
|
return this.BOSEconomy.addPlayerMoney(this.name, amount, false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean subtract(double amount)
|
||||||
return (this.balance() < amount);
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance - amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean multiply(double amount)
|
||||||
return (this.balance() < 0);
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance * amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean divide(double amount)
|
||||||
return false;
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
}
|
return this.BOSEconomy.setPlayerMoney(this.name, (balance / amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public class BOSEBankAccount implements MethodBankAccount {
|
public boolean hasEnough(double amount)
|
||||||
private String bank;
|
{
|
||||||
private BOSEconomy BOSEconomy;
|
return (this.balance() >= amount);
|
||||||
|
}
|
||||||
|
|
||||||
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) {
|
public boolean hasOver(double amount)
|
||||||
this.bank = bank;
|
{
|
||||||
this.BOSEconomy = bOSEconomy;
|
return (this.balance() > amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBankName() {
|
public boolean hasUnder(double amount)
|
||||||
return this.bank;
|
{
|
||||||
}
|
return (this.balance() < amount);
|
||||||
|
}
|
||||||
|
|
||||||
public int getBankId() {
|
public boolean isNegative()
|
||||||
return -1;
|
{
|
||||||
}
|
return (this.balance() < 0);
|
||||||
|
}
|
||||||
|
|
||||||
public double balance() {
|
public boolean remove()
|
||||||
return this.BOSEconomy.getBankMoneyDouble(bank);
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
|
||||||
return this.BOSEconomy.setBankMoney(bank, amount, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public class BOSEBankAccount implements MethodBankAccount
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance + amount), false);
|
private String bank;
|
||||||
}
|
private BOSEconomy BOSEconomy;
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public BOSEBankAccount(String bank, BOSEconomy bOSEconomy)
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance - amount), false);
|
this.bank = bank;
|
||||||
}
|
this.BOSEconomy = bOSEconomy;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public String getBankName()
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance * amount), false);
|
return this.bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public int getBankId()
|
||||||
double balance = this.balance();
|
{
|
||||||
return this.BOSEconomy.setBankMoney(bank, (balance / amount), false);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public double balance()
|
||||||
return (this.balance() >= amount);
|
{
|
||||||
}
|
return this.BOSEconomy.getBankMoneyDouble(bank);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean set(double amount)
|
||||||
return (this.balance() > amount);
|
{
|
||||||
}
|
return this.BOSEconomy.setBankMoney(bank, amount, true);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean add(double amount)
|
||||||
return (this.balance() < amount);
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance + amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean subtract(double amount)
|
||||||
return (this.balance() < 0);
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance - amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean multiply(double amount)
|
||||||
return this.BOSEconomy.removeBank(bank);
|
{
|
||||||
}
|
double balance = this.balance();
|
||||||
}
|
return this.BOSEconomy.setBankMoney(bank, (balance * amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean divide(double amount)
|
||||||
|
{
|
||||||
|
double balance = this.balance();
|
||||||
|
return this.BOSEconomy.setBankMoney(bank, (balance / amount), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() >= amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() > amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUnder(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() < amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return (this.balance() < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove()
|
||||||
|
{
|
||||||
|
return this.BOSEconomy.removeBank(bank);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import me.ashtheking.currency.CurrencyList;
|
|||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MultiCurrency Method implementation.
|
* MultiCurrency Method implementation.
|
||||||
*
|
*
|
||||||
@ -14,107 +15,141 @@ import org.bukkit.plugin.Plugin;
|
|||||||
* @copyright (c) 2011
|
* @copyright (c) 2011
|
||||||
* @license AOL license <http://aol.nexua.org>
|
* @license AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
public class MCUR implements Method {
|
public class MCUR implements Method
|
||||||
private Currency currencyList;
|
{
|
||||||
|
private Currency currencyList;
|
||||||
|
|
||||||
public Object getPlugin() {
|
public Object getPlugin()
|
||||||
return this.currencyList;
|
{
|
||||||
}
|
return this.currencyList;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
return "MultiCurrency";
|
{
|
||||||
}
|
return "MultiCurrency";
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion()
|
||||||
return "0.09";
|
{
|
||||||
}
|
return "0.09";
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public int fractionalDigits()
|
||||||
return amount + " Currency";
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public String format(double amount)
|
||||||
return false;
|
{
|
||||||
}
|
return amount + " Currency";
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
public boolean hasBanks()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasBank(String bank)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasAccount(String name)
|
||||||
return false;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public boolean hasBankAccount(String bank, String name)
|
||||||
return new MCurrencyAccount(name);
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodAccount getAccount(String name)
|
||||||
return null;
|
{
|
||||||
}
|
return new MCurrencyAccount(name);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase(getName()) && plugin instanceof Currency;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public boolean isCompatible(Plugin plugin)
|
||||||
currencyList = (Currency) plugin;
|
{
|
||||||
}
|
return (plugin.getDescription().getName().equalsIgnoreCase("Currency")
|
||||||
|
|| plugin.getDescription().getName().equalsIgnoreCase("MultiCurrency"))
|
||||||
|
&& plugin instanceof Currency;
|
||||||
|
}
|
||||||
|
|
||||||
public class MCurrencyAccount implements MethodAccount{
|
public void setPlugin(Plugin plugin)
|
||||||
private String name;
|
{
|
||||||
|
currencyList = (Currency)plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public MCurrencyAccount(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double balance() {
|
public class MCurrencyAccount implements MethodAccount
|
||||||
return CurrencyList.getValue((String) CurrencyList.maxCurrency(name)[0], name);
|
{
|
||||||
}
|
private String name;
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public MCurrencyAccount(String name)
|
||||||
CurrencyList.setValue((String) CurrencyList.maxCurrency(name)[0], name, amount);
|
{
|
||||||
return true;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public double balance()
|
||||||
return CurrencyList.add(name, amount);
|
{
|
||||||
}
|
return CurrencyList.getValue((String)CurrencyList.maxCurrency(name)[0], name);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean set(double amount)
|
||||||
return CurrencyList.subtract(name, amount);
|
{
|
||||||
}
|
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean add(double amount)
|
||||||
return CurrencyList.multiply(name, amount);
|
{
|
||||||
}
|
return CurrencyList.add(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean subtract(double amount)
|
||||||
return CurrencyList.divide(name, amount);
|
{
|
||||||
}
|
return CurrencyList.subtract(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public boolean multiply(double amount)
|
||||||
return CurrencyList.hasEnough(name, amount);
|
{
|
||||||
}
|
return CurrencyList.multiply(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean divide(double amount)
|
||||||
return CurrencyList.hasOver(name, amount);
|
{
|
||||||
}
|
return CurrencyList.divide(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean hasEnough(double amount)
|
||||||
return CurrencyList.hasUnder(name, amount);
|
{
|
||||||
}
|
return CurrencyList.hasEnough(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean hasOver(double amount)
|
||||||
return CurrencyList.isNegative(name);
|
{
|
||||||
}
|
return CurrencyList.hasOver(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean hasUnder(double amount)
|
||||||
return CurrencyList.remove(name);
|
{
|
||||||
}
|
return CurrencyList.hasUnder(name, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return CurrencyList.isNegative(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove()
|
||||||
|
{
|
||||||
|
return CurrencyList.remove(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package com.earth2me.essentials.register.payment.methods;
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
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.earth2me.essentials.register.payment.Method;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iConomy 4 Implementation of Method
|
* iConomy 4 Implementation of Method
|
||||||
*
|
*
|
||||||
@ -14,122 +15,175 @@ import org.bukkit.plugin.Plugin;
|
|||||||
* @copyright (c) 2011
|
* @copyright (c) 2011
|
||||||
* @license AOL license <http://aol.nexua.org>
|
* @license AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
public class iCo4 implements Method {
|
public class iCo4 implements Method
|
||||||
private iConomy iConomy;
|
{
|
||||||
|
private iConomy iConomy;
|
||||||
|
|
||||||
public iConomy getPlugin() {
|
public iConomy getPlugin()
|
||||||
return this.iConomy;
|
{
|
||||||
}
|
return this.iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
return "iConomy";
|
{
|
||||||
}
|
return "iConomy";
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion()
|
||||||
return "4";
|
{
|
||||||
}
|
return "4";
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public int fractionalDigits()
|
||||||
return this.iConomy.getBank().format(amount);
|
{
|
||||||
}
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public String format(double amount)
|
||||||
return false;
|
{
|
||||||
}
|
return com.nijiko.coelho.iConomy.iConomy.getBank().format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
public boolean hasBanks()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasBank(String bank)
|
||||||
return this.iConomy.getBank().hasAccount(name);
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasAccount(String name)
|
||||||
return false;
|
{
|
||||||
}
|
return com.nijiko.coelho.iConomy.iConomy.getBank().hasAccount(name);
|
||||||
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public boolean hasBankAccount(String bank, String name)
|
||||||
return new iCoAccount(this.iConomy.getBank().getAccount(name));
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodAccount getAccount(String name)
|
||||||
return null;
|
{
|
||||||
}
|
return new iCoAccount(com.nijiko.coelho.iConomy.iConomy.getBank().getAccount(name));
|
||||||
|
}
|
||||||
public boolean isCompatible(Plugin plugin) {
|
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy") && plugin instanceof iConomy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
iConomy = (iConomy)plugin;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
public class iCoAccount implements MethodAccount {
|
|
||||||
private Account account;
|
|
||||||
|
|
||||||
public iCoAccount(Account account) {
|
public boolean isCompatible(Plugin plugin)
|
||||||
this.account = account;
|
{
|
||||||
}
|
return plugin.getDescription().getName().equalsIgnoreCase("iconomy")
|
||||||
|
&& plugin.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")
|
||||||
|
&& plugin instanceof iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
public Account getiCoAccount() {
|
public void setPlugin(Plugin plugin)
|
||||||
return account;
|
{
|
||||||
}
|
iConomy = (iConomy)plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public double balance() {
|
|
||||||
return this.account.getBalance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public class iCoAccount implements MethodAccount
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.setBalance(amount);
|
private Account account;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public iCoAccount(Account account)
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.add(amount);
|
this.account = account;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public Account getiCoAccount()
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.subtract(amount);
|
return account;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public double balance()
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.multiply(amount);
|
return this.account.getBalance();
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean set(double amount)
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.divide(amount);
|
if (this.account == null)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
this.account.setBalance(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public boolean add(double amount)
|
||||||
return this.account.hasEnough(amount);
|
{
|
||||||
}
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.add(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean subtract(double amount)
|
||||||
return this.account.hasOver(amount);
|
{
|
||||||
}
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.subtract(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean multiply(double amount)
|
||||||
return (this.balance() < amount);
|
{
|
||||||
}
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.multiply(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean divide(double amount)
|
||||||
return this.account.isNegative();
|
{
|
||||||
}
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.divide(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean hasEnough(double amount)
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.remove();
|
return this.account.hasEnough(amount);
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
public boolean hasOver(double amount)
|
||||||
|
{
|
||||||
|
return this.account.hasOver(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUnder(double amount)
|
||||||
|
{
|
||||||
|
return (this.balance() < amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative()
|
||||||
|
{
|
||||||
|
return this.account.isNegative();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove()
|
||||||
|
{
|
||||||
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.earth2me.essentials.register.payment.methods;
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
import com.iConomy.iConomy;
|
import com.iConomy.iConomy;
|
||||||
import com.iConomy.system.Account;
|
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.earth2me.essentials.register.payment.Method;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -37,9 +37,14 @@ public class iCo5 implements Method
|
|||||||
return "5";
|
return "5";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int fractionalDigits()
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount)
|
public String format(double amount)
|
||||||
{
|
{
|
||||||
return this.iConomy.format(amount);
|
return com.iConomy.iConomy.format(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBanks()
|
public boolean hasBanks()
|
||||||
@ -49,32 +54,34 @@ public class iCo5 implements Method
|
|||||||
|
|
||||||
public boolean hasBank(String bank)
|
public boolean hasBank(String bank)
|
||||||
{
|
{
|
||||||
return (hasBanks()) && this.iConomy.Banks.exists(bank);
|
return (hasBanks()) && com.iConomy.iConomy.Banks.exists(bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name)
|
public boolean hasAccount(String name)
|
||||||
{
|
{
|
||||||
return this.iConomy.hasAccount(name);
|
return com.iConomy.iConomy.hasAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name)
|
public boolean hasBankAccount(String bank, String name)
|
||||||
{
|
{
|
||||||
return (hasBank(bank)) && this.iConomy.getBank(bank).hasAccount(name);
|
return (hasBank(bank)) && com.iConomy.iConomy.getBank(bank).hasAccount(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name)
|
public MethodAccount getAccount(String name)
|
||||||
{
|
{
|
||||||
return new iCoAccount(this.iConomy.getAccount(name));
|
return new iCoAccount(com.iConomy.iConomy.getAccount(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name)
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
{
|
{
|
||||||
return new iCoBankAccount(this.iConomy.getBank(bank).getAccount(name));
|
return new iCoBankAccount(com.iConomy.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)
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package com.earth2me.essentials.register.payment.methods;
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
import com.iCo6.iConomy;
|
import com.iCo6.iConomy;
|
||||||
import com.iCo6.system.Account;
|
import com.iCo6.system.Account;
|
||||||
import com.iCo6.system.Accounts;
|
import com.iCo6.system.Accounts;
|
||||||
import com.iCo6.system.Holdings;
|
import com.iCo6.system.Holdings;
|
||||||
|
|
||||||
import com.earth2me.essentials.register.payment.Method;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iConomy 6 Implementation of Method
|
* iConomy 6 Implementation of Method
|
||||||
*
|
*
|
||||||
@ -16,127 +17,177 @@ import org.bukkit.plugin.Plugin;
|
|||||||
* @copyright (c) 2011
|
* @copyright (c) 2011
|
||||||
* @license AOL license <http://aol.nexua.org>
|
* @license AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
public class iCo6 implements Method {
|
public class iCo6 implements Method
|
||||||
private iConomy iConomy;
|
{
|
||||||
|
private iConomy iConomy;
|
||||||
|
|
||||||
public iConomy getPlugin() {
|
public iConomy getPlugin()
|
||||||
return this.iConomy;
|
{
|
||||||
}
|
return this.iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
return "iConomy";
|
{
|
||||||
}
|
return "iConomy";
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion()
|
||||||
return "6";
|
{
|
||||||
}
|
return "6";
|
||||||
|
}
|
||||||
|
|
||||||
public String format(double amount) {
|
public int fractionalDigits()
|
||||||
return this.iConomy.format(amount);
|
{
|
||||||
}
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBanks() {
|
public String format(double amount)
|
||||||
return false;
|
{
|
||||||
}
|
return com.iCo6.iConomy.format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBank(String bank) {
|
public boolean hasBanks()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasAccount(String name) {
|
public boolean hasBank(String bank)
|
||||||
return (new Accounts()).exists(name);
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasBankAccount(String bank, String name) {
|
public boolean hasAccount(String name)
|
||||||
return false;
|
{
|
||||||
}
|
return (new Accounts()).exists(name);
|
||||||
|
}
|
||||||
|
|
||||||
public MethodAccount getAccount(String name) {
|
public boolean hasBankAccount(String bank, String name)
|
||||||
return new iCoAccount((new Accounts()).get(name));
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public MethodBankAccount getBankAccount(String bank, String name) {
|
public MethodAccount getAccount(String name)
|
||||||
return null;
|
{
|
||||||
}
|
return new iCoAccount((new Accounts()).get(name));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCompatible(Plugin plugin) {
|
public MethodBankAccount getBankAccount(String bank, String name)
|
||||||
try { Class.forName("com.iCo6.IO"); }
|
{
|
||||||
catch(Exception e) { return false; }
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iCo6.iConomy") && plugin instanceof iConomy;
|
public boolean isCompatible(Plugin plugin)
|
||||||
}
|
{
|
||||||
|
return plugin.getDescription().getName().equalsIgnoreCase("iconomy")
|
||||||
|
&& plugin.getClass().getName().equals("com.iCo6.iConomy")
|
||||||
|
&& plugin instanceof iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPlugin(Plugin plugin) {
|
public void setPlugin(Plugin plugin)
|
||||||
iConomy = (iConomy)plugin;
|
{
|
||||||
}
|
iConomy = (iConomy)plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public class iCoAccount implements MethodAccount {
|
|
||||||
private Account account;
|
|
||||||
private Holdings holdings;
|
|
||||||
|
|
||||||
public iCoAccount(Account account) {
|
public class iCoAccount implements MethodAccount
|
||||||
this.account = account;
|
{
|
||||||
this.holdings = account.getHoldings();
|
private Account account;
|
||||||
}
|
private Holdings holdings;
|
||||||
|
|
||||||
public Account getiCoAccount() {
|
public iCoAccount(Account account)
|
||||||
return account;
|
{
|
||||||
}
|
this.account = account;
|
||||||
|
this.holdings = account.getHoldings();
|
||||||
|
}
|
||||||
|
|
||||||
public double balance() {
|
public Account getiCoAccount()
|
||||||
return this.holdings.getBalance();
|
{
|
||||||
}
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean set(double amount) {
|
public double balance()
|
||||||
if(this.holdings == null) return false;
|
{
|
||||||
this.holdings.setBalance(amount);
|
return this.holdings.getBalance();
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean add(double amount) {
|
public boolean set(double amount)
|
||||||
if(this.holdings == null) return false;
|
{
|
||||||
this.holdings.add(amount);
|
if (this.holdings == null)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
this.holdings.setBalance(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean subtract(double amount) {
|
public boolean add(double amount)
|
||||||
if(this.holdings == null) return false;
|
{
|
||||||
this.holdings.subtract(amount);
|
if (this.holdings == null)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
this.holdings.add(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean multiply(double amount) {
|
public boolean subtract(double amount)
|
||||||
if(this.holdings == null) return false;
|
{
|
||||||
this.holdings.multiply(amount);
|
if (this.holdings == null)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
this.holdings.subtract(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean divide(double amount) {
|
public boolean multiply(double amount)
|
||||||
if(this.holdings == null) return false;
|
{
|
||||||
this.holdings.divide(amount);
|
if (this.holdings == null)
|
||||||
return true;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
this.holdings.multiply(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasEnough(double amount) {
|
public boolean divide(double amount)
|
||||||
return this.holdings.hasEnough(amount);
|
{
|
||||||
}
|
if (this.holdings == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.holdings.divide(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOver(double amount) {
|
public boolean hasEnough(double amount)
|
||||||
return this.holdings.hasOver(amount);
|
{
|
||||||
}
|
return this.holdings.hasEnough(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasUnder(double amount) {
|
public boolean hasOver(double amount)
|
||||||
return this.holdings.hasUnder(amount);
|
{
|
||||||
}
|
return this.holdings.hasOver(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNegative() {
|
public boolean hasUnder(double amount)
|
||||||
return this.holdings.isNegative();
|
{
|
||||||
}
|
return this.holdings.hasUnder(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean isNegative()
|
||||||
if(this.account == null) return false;
|
{
|
||||||
this.account.remove();
|
return this.holdings.isNegative();
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
public boolean remove()
|
||||||
|
{
|
||||||
|
if (this.account == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.account.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user