mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 06:55:03 +00:00
Trader System + Stocks Implemented
- Removed Auction System Temporarily for Full Rebase
This commit is contained in:
1 parent
692b985237
commit
d0dc8a4578
61 files changed
+2595
-6897
No files matched your search
@@ -17,6 +17,7 @@ import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.handler.IPlayerBankData;
|
||||
import noppes.npcs.api.handler.IPlayerCurrencyData;
|
||||
import noppes.npcs.api.handler.IPlayerData;
|
||||
import noppes.npcs.api.handler.IPlayerDialogData;
|
||||
import noppes.npcs.api.handler.IPlayerFactionData;
|
||||
@@ -60,7 +61,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public MagicData magicData = new MagicData();
|
||||
|
||||
// Currency data - NOT slot-bound, shared across all profile slots
|
||||
public PlayerCurrencyData currencyData = new PlayerCurrencyData();
|
||||
public PlayerCurrencyData currencyData = new PlayerCurrencyData(this);
|
||||
|
||||
public ActionManager actionManager = new ActionManager();
|
||||
public PlayerDataScript scriptData;
|
||||
@@ -400,6 +401,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
return mailData;
|
||||
}
|
||||
|
||||
public IPlayerCurrencyData getCurrencyData() {
|
||||
return currencyData;
|
||||
}
|
||||
|
||||
public synchronized void save() {
|
||||
// Don't Save this is a Modification of a Profile's PlayerData
|
||||
Profile profile = ProfileController.Instance.getProfile(UUID.fromString(uuid));
|
||||
@@ -409,7 +414,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
}
|
||||
|
||||
final NBTTagCompound compound = getNBT();
|
||||
// Add currency data to main save (NOT slot-bound, preserved across profile changes)
|
||||
// Currency data is saved at player level, NOT per profile slot
|
||||
currencyData.writeToNBT(compound);
|
||||
|
||||
final String filename;
|
||||
@@ -449,11 +454,8 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
data = getNBT();
|
||||
}
|
||||
|
||||
// Load currency BEFORE setNBT so we can preserve it
|
||||
// Currency is stored in main file but NOT in slot data
|
||||
if (data.hasKey("CurrencyBalance")) {
|
||||
currencyData.readFromNBT(data);
|
||||
}
|
||||
// Load currency BEFORE setNBT - currency is player-level, NOT per profile slot
|
||||
currencyData.readFromNBT(data);
|
||||
|
||||
setNBT(data);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user