0.8.4: Try to fix the eco take bug
This commit is contained in:
parent
175f9626a1
commit
41339dc3b0
|
@ -6,10 +6,10 @@
|
|||
<parent>
|
||||
<groupId>org.appledash</groupId>
|
||||
<artifactId>SaneEconomy</artifactId>
|
||||
<version>0.8.3-SNAPSHOT</version>
|
||||
<version>0.8.4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>SaneEconomyCore</artifactId>
|
||||
<version>0.8.3-SNAPSHOT</version>
|
||||
<version>0.8.4-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -95,7 +95,7 @@ public class EconomyAdminCommand extends SaneEconomyCommand {
|
|||
}
|
||||
|
||||
if (subCommand.equalsIgnoreCase("take")) {
|
||||
Transaction transaction = new Transaction(Economable.wrap(targetPlayer), Economable.wrap(sender), amount, TransactionReason.ADMIN);
|
||||
Transaction transaction = new Transaction(Economable.wrap(targetPlayer), Economable.wrap(sender), amount, TransactionReason.ADMIN_TAKE);
|
||||
TransactionResult result = ecoMan.transact(transaction);
|
||||
|
||||
double newAmount = result.getFromBalance();
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.appledash.saneeconomy.economy.economable.Economable;
|
|||
import org.appledash.saneeconomy.economy.transaction.Transaction;
|
||||
import org.appledash.saneeconomy.economy.transaction.TransactionReason;
|
||||
import org.appledash.saneeconomy.economy.transaction.TransactionResult;
|
||||
import org.appledash.saneeconomy.economy.transaction.TransactionResult.Status;
|
||||
import org.appledash.saneeconomy.utils.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -169,14 +168,16 @@ public class EconomyManager {
|
|||
if (!transaction.isFree()) { // If the transaction is occurring because of another plugin or because of an admin.
|
||||
// If the sender doesn't have the balance AND we're not testing, throw an error.
|
||||
// I don't really know why we check if they're testing, but it breaks if we don't. FIXME.
|
||||
if (!hasBalance(sender, amount) && transaction.getReason() != TransactionReason.TEST) {
|
||||
if (!hasBalance(sender, amount) && transaction.getReason() != TransactionReason.TEST && transaction.getReason() != TransactionReason.ADMIN_TAKE) {
|
||||
return new TransactionResult(transaction, TransactionResult.Status.ERR_NOT_ENOUGH_FUNDS);
|
||||
}
|
||||
|
||||
subtractBalance(sender, amount);
|
||||
}
|
||||
|
||||
addBalance(receiver, amount);
|
||||
if (transaction.getReason() != TransactionReason.ADMIN_TAKE) {
|
||||
addBalance(receiver, amount);
|
||||
}
|
||||
|
||||
if (saneEconomy.shouldLogTransactions()) {
|
||||
saneEconomy.getTransactionLogger().logTransaction(transaction);
|
||||
|
|
|
@ -13,6 +13,7 @@ public enum TransactionReason {
|
|||
* An admin giving a player money.
|
||||
*/
|
||||
ADMIN,
|
||||
ADMIN_TAKE,
|
||||
/**
|
||||
* Another plugin using the API.
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: SaneEconomy
|
||||
author: AppleDash
|
||||
main: org.appledash.saneeconomy.SaneEconomy
|
||||
version: 0.8.3
|
||||
version: 0.8.4
|
||||
loadbefore: [Vault]
|
||||
commands:
|
||||
balance:
|
||||
|
|
Loading…
Reference in New Issue