mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-05-31 19:47:34 +00:00
Catch the case, if the user does not have a account with Register
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1439 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
0f72b94724
commit
fe8edacf08
1 changed files with 14 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
|
import com.nijikokun.register.payment.Method;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -277,7 +278,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ess.getPaymentMethod().getMethod().getAccount(this.getName()).balance();
|
Method method = ess.getPaymentMethod().getMethod();
|
||||||
|
if (!method.hasAccount(this.getName())) {
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
|
||||||
|
return account.balance();
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
|
@ -293,8 +299,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
double amount = value - ess.getPaymentMethod().getMethod().getAccount(this.getName()).balance();
|
Method method = ess.getPaymentMethod().getMethod();
|
||||||
ess.getPaymentMethod().getMethod().getAccount(this.getName()).add(amount);
|
if (!method.hasAccount(this.getName())) {
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
|
||||||
|
double amount = value - account.balance();
|
||||||
|
account.add(amount);
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue