Restore vault compat

This commit is contained in:
KHobbits 2013-07-26 00:07:56 +01:00
parent 0ef4dfd453
commit ddc8c07cd7
2 changed files with 30 additions and 30 deletions

View file

@ -95,17 +95,17 @@ public class Economy
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
@Deprecated @Deprecated
public static double getMoney(String name) throws net.ess3.api.UserDoesNotExistException public static double getMoney(String name) throws UserDoesNotExistException
{ {
return getMoneyExact(name).doubleValue(); return getMoneyExact(name).doubleValue();
} }
public static BigDecimal getMoneyExact(String name) throws net.ess3.api.UserDoesNotExistException public static BigDecimal getMoneyExact(String name) throws UserDoesNotExistException
{ {
User user = getUserByName(name); User user = getUserByName(name);
if (user == null) if (user == null)
{ {
throw new net.ess3.api.UserDoesNotExistException(name); throw new UserDoesNotExistException(name);
} }
return user.getMoney(); return user.getMoney();
} }
@ -119,7 +119,7 @@ public class Economy
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
@Deprecated @Deprecated
public static void setMoney(String name, double balance) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
{ {
try try
{ {
@ -131,20 +131,20 @@ public class Economy
} }
} }
public static void setMoney(String name, BigDecimal balance) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void setMoney(String name, BigDecimal balance) throws UserDoesNotExistException, NoLoanPermittedException
{ {
User user = getUserByName(name); User user = getUserByName(name);
if (user == null) if (user == null)
{ {
throw new net.ess3.api.UserDoesNotExistException(name); throw new UserDoesNotExistException(name);
} }
if (balance.compareTo(ess.getSettings().getMinMoney()) < 0) if (balance.compareTo(ess.getSettings().getMinMoney()) < 0)
{ {
throw new net.ess3.api.NoLoanPermittedException(); throw new NoLoanPermittedException();
} }
if (balance.signum() < 0 && !user.isAuthorized("essentials.eco.loan")) if (balance.signum() < 0 && !user.isAuthorized("essentials.eco.loan"))
{ {
throw new net.ess3.api.NoLoanPermittedException(); throw new NoLoanPermittedException();
} }
user.setMoney(balance); user.setMoney(balance);
} }
@ -158,7 +158,7 @@ public class Economy
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
@Deprecated @Deprecated
public static void add(String name, double amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{ {
try try
{ {
@ -170,7 +170,7 @@ public class Economy
} }
} }
public static void add(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException, ArithmeticException public static void add(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException
{ {
BigDecimal result = getMoneyExact(name).add(amount, MATH_CONTEXT); BigDecimal result = getMoneyExact(name).add(amount, MATH_CONTEXT);
setMoney(name, result); setMoney(name, result);
@ -185,7 +185,7 @@ public class Economy
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
@Deprecated @Deprecated
public static void subtract(String name, double amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{ {
try try
{ {
@ -197,7 +197,7 @@ public class Economy
} }
} }
public static void substract(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException, ArithmeticException public static void substract(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException
{ {
BigDecimal result = getMoneyExact(name).subtract(amount, MATH_CONTEXT); BigDecimal result = getMoneyExact(name).subtract(amount, MATH_CONTEXT);
setMoney(name, result); setMoney(name, result);
@ -212,7 +212,7 @@ public class Economy
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
@Deprecated @Deprecated
public static void divide(String name, double amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void divide(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{ {
try try
{ {
@ -224,7 +224,7 @@ public class Economy
} }
} }
public static void divide(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException, ArithmeticException public static void divide(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException
{ {
BigDecimal result = getMoneyExact(name).divide(amount, MATH_CONTEXT); BigDecimal result = getMoneyExact(name).divide(amount, MATH_CONTEXT);
setMoney(name, result); setMoney(name, result);
@ -239,7 +239,7 @@ public class Economy
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
@Deprecated @Deprecated
public static void multiply(String name, double amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void multiply(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{ {
try try
{ {
@ -251,7 +251,7 @@ public class Economy
} }
} }
public static void multiply(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException, ArithmeticException public static void multiply(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException
{ {
BigDecimal result = getMoneyExact(name).multiply(amount, MATH_CONTEXT); BigDecimal result = getMoneyExact(name).multiply(amount, MATH_CONTEXT);
setMoney(name, result); setMoney(name, result);
@ -264,7 +264,7 @@ public class Economy
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
* @throws NoLoanPermittedException If the user is not allowed to have a negative balance * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/ */
public static void resetBalance(String name) throws net.ess3.api.UserDoesNotExistException, net.ess3.api.NoLoanPermittedException public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{ {
if (ess == null) if (ess == null)
{ {
@ -280,7 +280,7 @@ public class Economy
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
*/ */
@Deprecated @Deprecated
public static boolean hasEnough(String name, double amount) throws net.ess3.api.UserDoesNotExistException public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException
{ {
try try
{ {
@ -293,7 +293,7 @@ public class Economy
} }
} }
public static boolean hasEnough(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, ArithmeticException public static boolean hasEnough(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException
{ {
return amount.compareTo(getMoneyExact(name)) <= 0; return amount.compareTo(getMoneyExact(name)) <= 0;
} }
@ -305,7 +305,7 @@ public class Economy
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
*/ */
@Deprecated @Deprecated
public static boolean hasMore(String name, double amount) throws net.ess3.api.UserDoesNotExistException public static boolean hasMore(String name, double amount) throws UserDoesNotExistException
{ {
try try
{ {
@ -318,7 +318,7 @@ public class Economy
} }
} }
public static boolean hasMore(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, ArithmeticException public static boolean hasMore(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException
{ {
return amount.compareTo(getMoneyExact(name)) < 0; return amount.compareTo(getMoneyExact(name)) < 0;
} }
@ -330,7 +330,7 @@ public class Economy
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
*/ */
@Deprecated @Deprecated
public static boolean hasLess(String name, double amount) throws net.ess3.api.UserDoesNotExistException public static boolean hasLess(String name, double amount) throws UserDoesNotExistException
{ {
try try
{ {
@ -343,7 +343,7 @@ public class Economy
} }
} }
public static boolean hasLess(String name, BigDecimal amount) throws net.ess3.api.UserDoesNotExistException, ArithmeticException public static boolean hasLess(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException
{ {
return amount.compareTo(getMoneyExact(name)) > 0; return amount.compareTo(getMoneyExact(name)) > 0;
} }
@ -355,7 +355,7 @@ public class Economy
* @return true, if the user has a negative balance * @return true, if the user has a negative balance
* @throws UserDoesNotExistException If a user by that name does not exists * @throws UserDoesNotExistException If a user by that name does not exists
*/ */
public static boolean isNegative(String name) throws net.ess3.api.UserDoesNotExistException public static boolean isNegative(String name) throws UserDoesNotExistException
{ {
return getMoneyExact(name).signum() < 0; return getMoneyExact(name).signum() < 0;
} }
@ -407,12 +407,12 @@ public class Economy
* @return true, if it's a npc * @return true, if it's a npc
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
public static boolean isNPC(String name) throws net.ess3.api.UserDoesNotExistException public static boolean isNPC(String name) throws UserDoesNotExistException
{ {
User user = getUserByName(name); User user = getUserByName(name);
if (user == null) if (user == null)
{ {
throw new net.ess3.api.UserDoesNotExistException(name); throw new UserDoesNotExistException(name);
} }
return user.isNPC(); return user.isNPC();
} }
@ -440,12 +440,12 @@ public class Economy
* @param name Name of the player * @param name Name of the player
* @throws UserDoesNotExistException * @throws UserDoesNotExistException
*/ */
public static void removeNPC(String name) throws net.ess3.api.UserDoesNotExistException public static void removeNPC(String name) throws UserDoesNotExistException
{ {
User user = getUserByName(name); User user = getUserByName(name);
if (user == null) if (user == null)
{ {
throw new net.ess3.api.UserDoesNotExistException(name); throw new UserDoesNotExistException(name);
} }
deleteNPC(name); deleteNPC(name);
} }

View file

@ -1,8 +1,8 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import com.earth2me.essentials.api.NoLoanPermittedException;
import com.earth2me.essentials.api.UserDoesNotExistException;
import net.ess3.api.Economy; import net.ess3.api.Economy;
import net.ess3.api.NoLoanPermittedException;
import net.ess3.api.UserDoesNotExistException;
import java.io.IOException; import java.io.IOException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;