Minor tweaks to the Money static.
This commit is contained in:
parent
35599952e8
commit
2db041fea4
@ -94,7 +94,7 @@ public class Money
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// GET AND SET
|
// CHECK
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static double get(Object universe, Object accountId)
|
public static double get(Object universe, Object accountId)
|
||||||
@ -108,6 +108,21 @@ public class Money
|
|||||||
return get(account, account);
|
return get(account, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean has(Object universe, Object accountId, double amount)
|
||||||
|
{
|
||||||
|
if (disabled(universe)) return false;
|
||||||
|
return mixin.has(universe(universe), accountId(accountId), amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean has(Object account, double amount)
|
||||||
|
{
|
||||||
|
return has(account, account, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// MODIFY
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static boolean set(Object universe, Object accountId, double amount)
|
public static boolean set(Object universe, Object accountId, double amount)
|
||||||
{
|
{
|
||||||
if (disabled(universe)) return false;
|
if (disabled(universe)) return false;
|
||||||
@ -119,10 +134,6 @@ public class Money
|
|||||||
return set(account, account, amount);
|
return set(account, account, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
|
||||||
// MODIFY
|
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public static boolean add(Object universe, Object accountId, double amount)
|
public static boolean add(Object universe, Object accountId, double amount)
|
||||||
{
|
{
|
||||||
if (disabled(universe)) return false;
|
if (disabled(universe)) return false;
|
||||||
|
@ -24,16 +24,18 @@ public interface MoneyMixin
|
|||||||
public boolean create(String universe, String accountId);
|
public boolean create(String universe, String accountId);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// GET AND SET
|
// CHECK
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public double get(String universe, String accountId);
|
public double get(String universe, String accountId);
|
||||||
public boolean set(String universe, String accountId, double amount);
|
public boolean has(String universe, String accountId, double amount);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MODIFY
|
// MODIFY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public boolean set(String universe, String accountId, double amount);
|
||||||
public boolean add(String universe, String accountId, double amount);
|
public boolean add(String universe, String accountId, double amount);
|
||||||
public boolean subtract(String universe, String accountId, double amount);
|
public boolean subtract(String universe, String accountId, double amount);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class MoneyMixinVault extends MoneyMixinAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// GET AND SET
|
// CHECK
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -97,16 +97,22 @@ public class MoneyMixinVault extends MoneyMixinAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean set(String universe, String accountId, double amount)
|
public boolean has(String universe, String accountId, double amount)
|
||||||
{
|
{
|
||||||
double current = get(universe, accountId);
|
return this.economy.has(accountId, universe, amount);
|
||||||
return add(universe, accountId, amount - current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// MODIFY
|
// MODIFY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean set(String universe, String accountId, double amount)
|
||||||
|
{
|
||||||
|
double current = get(universe, accountId);
|
||||||
|
return add(universe, accountId, amount - current);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(String universe, String accountId, double amount)
|
public boolean add(String universe, String accountId, double amount)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user