feat: 现在通过指令修改的货币也会触发事件了

This commit is contained in:
2024-04-24 13:38:56 +08:00
parent 487da47e42
commit 13b8a3ee73
3 changed files with 13 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ plugins {
} }
group 'cn.hamster3' group 'cn.hamster3'
version '2.2.2' version '2.2.3'
repositories { repositories {
maven { maven {

View File

@@ -1,7 +1,7 @@
package cn.hamster3.currency.command.currency; package cn.hamster3.currency.command.currency;
import cn.hamster3.currency.api.CurrencyAPI;
import cn.hamster3.currency.core.IDataManager; import cn.hamster3.currency.core.IDataManager;
import cn.hamster3.currency.data.CurrencyLog;
import cn.hamster3.currency.data.CurrencyType; import cn.hamster3.currency.data.CurrencyType;
import cn.hamster3.currency.data.PlayerData; import cn.hamster3.currency.data.PlayerData;
@@ -17,8 +17,7 @@ public class CurrencySetCommand extends CurrencyAdminSetCommand {
@Override @Override
protected void doSet(PlayerData data, CurrencyType type, double amount) { protected void doSet(PlayerData data, CurrencyType type, double amount) {
data.setPlayerCurrency(type.getId(), amount); CurrencyAPI.setPlayerCurrency(data.getUuid(), type.getId(), amount);
dataManager.insertLog(new CurrencyLog(data.getUuid(), data.getPlayerName(), type.getId(), "set", amount, amount));
} }
} }

View File

@@ -50,4 +50,14 @@ public class CurrencyChangeEvent extends Event {
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlerList; return handlerList;
} }
@Override
public String toString() {
return "CurrencyChangeEvent{" +
"playerUUID=" + playerUUID +
", currencyID='" + currencyID + '\'' +
", oldAmount=" + oldAmount +
", newAmount=" + newAmount +
'}';
}
} }