mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 03:25:02 +00:00
Player Abilities
This commit is contained in:
1 parent
601b0d721e
commit
1b8ad4dd90
92 files changed
+2610
-1025
No files matched your search
@@ -15,6 +15,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.ability.IPlayerAbilityData;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.handler.IPlayerBankData;
|
||||
import noppes.npcs.api.handler.IPlayerTradeData;
|
||||
@@ -65,6 +66,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
// Trade data (currency + auction claims) - shared across all profile slots
|
||||
public PlayerTradeData tradeData = new PlayerTradeData(this);
|
||||
|
||||
public PlayerAbilityData abilityData = new PlayerAbilityData(this);
|
||||
public ActionManager actionManager = new ActionManager();
|
||||
public PlayerDataScript scriptData;
|
||||
|
||||
@@ -108,6 +110,9 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
if (!controller.playerEffects.containsKey(playerID)) {
|
||||
controller.playerEffects.put(playerID, effectData.getEffects());
|
||||
}
|
||||
|
||||
// Sync player ability data to client
|
||||
abilityData.syncToClient();
|
||||
}
|
||||
|
||||
public void onLogout() {
|
||||
@@ -137,6 +142,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
effectData.readFromNBT(data);
|
||||
magicData.readToNBT(data);
|
||||
tradeData.readFromNBT(data);
|
||||
abilityData.readFromNBT(data);
|
||||
|
||||
if (player != null) {
|
||||
playername = player.getCommandSenderName();
|
||||
@@ -180,6 +186,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
effectData.writeToNBT(compound);
|
||||
magicData.writeToNBT(compound);
|
||||
tradeData.writeToNBT(compound);
|
||||
abilityData.writeToNBT(compound);
|
||||
|
||||
compound.setString("PlayerName", playername);
|
||||
compound.setString("UUID", uuid);
|
||||
@@ -411,6 +418,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
return tradeData;
|
||||
}
|
||||
|
||||
public IPlayerAbilityData getAbilityData() {
|
||||
return abilityData;
|
||||
}
|
||||
|
||||
public synchronized void save() {
|
||||
// Don't Save this is a Modification of a Profile's PlayerData
|
||||
Profile profile = ProfileController.Instance.getProfile(UUID.fromString(uuid));
|
||||
|
||||
Reference in new issue
Block a user