2022-05-24 01:07:50 -05:00
|
|
|
package noppes.npcs.controllers.data;
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2024-04-15 14:33:40 -04:00
|
|
|
import kamkeel.addon.DBCAddon;
|
2018-09-13 12:03:28 -04:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2024-01-22 00:57:59 -06:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2023-06-02 02:09:38 -04:00
|
|
|
import net.minecraft.nbt.CompressedStreamTools;
|
2018-09-13 12:03:28 -04:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
import net.minecraftforge.common.IExtendedEntityProperties;
|
2024-03-07 22:22:39 -05:00
|
|
|
import noppes.npcs.CustomNpcs;
|
2021-10-20 23:04:52 -05:00
|
|
|
import noppes.npcs.LogWriter;
|
2024-01-22 10:53:20 -06:00
|
|
|
import noppes.npcs.PacketHandlerServer;
|
2024-01-22 00:57:59 -06:00
|
|
|
import noppes.npcs.Server;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.api.entity.ICustomNpc;
|
|
|
|
|
import noppes.npcs.api.handler.*;
|
2023-06-02 02:09:38 -04:00
|
|
|
import noppes.npcs.config.ConfigMain;
|
2024-01-22 00:57:59 -06:00
|
|
|
import noppes.npcs.constants.EnumPacketClient;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.constants.EnumRoleType;
|
2024-01-22 10:53:20 -06:00
|
|
|
import noppes.npcs.controllers.PartyController;
|
2022-05-24 01:07:50 -05:00
|
|
|
import noppes.npcs.controllers.PlayerDataController;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.entity.EntityCustomNpc;
|
|
|
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
2022-05-23 20:41:32 -05:00
|
|
|
import noppes.npcs.entity.data.DataSkinOverlays;
|
2021-10-11 06:49:30 -05:00
|
|
|
import noppes.npcs.entity.data.DataTimers;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.roles.RoleCompanion;
|
2022-06-12 01:26:23 -05:00
|
|
|
import noppes.npcs.scripted.NpcAPI;
|
2024-01-05 16:31:57 +03:00
|
|
|
import noppes.npcs.scripted.ScreenSize;
|
2023-05-16 17:43:54 -04:00
|
|
|
import noppes.npcs.util.CustomNPCsThreader;
|
2021-10-20 23:04:52 -05:00
|
|
|
import noppes.npcs.util.NBTJsonUtil;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
2023-06-02 02:09:38 -04:00
|
|
|
import java.io.FileOutputStream;
|
2024-01-22 00:57:59 -06:00
|
|
|
import java.util.HashSet;
|
2023-10-31 23:36:34 -04:00
|
|
|
import java.util.UUID;
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2022-06-12 01:26:23 -05:00
|
|
|
public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
|
|
|
|
public PlayerDialogData dialogData = new PlayerDialogData(this);
|
|
|
|
|
public PlayerBankData bankData = new PlayerBankData(this);
|
|
|
|
|
public PlayerQuestData questData = new PlayerQuestData(this);
|
|
|
|
|
public PlayerTransportData transportData = new PlayerTransportData(this);
|
|
|
|
|
public PlayerFactionData factionData = new PlayerFactionData(this);
|
|
|
|
|
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(this);
|
|
|
|
|
public PlayerMailData mailData = new PlayerMailData(this);
|
2023-01-16 13:53:15 -06:00
|
|
|
public AnimationData animationData = new AnimationData(this);
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public DataTimers timers = new DataTimers(this);
|
2022-05-23 20:41:32 -05:00
|
|
|
public DataSkinOverlays skinOverlays = new DataSkinOverlays(this);
|
2021-09-30 21:44:30 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public EntityNPCInterface editingNpc;
|
|
|
|
|
public NBTTagCompound cloned;
|
2024-01-22 00:57:59 -06:00
|
|
|
|
2023-10-31 23:36:34 -04:00
|
|
|
public UUID partyUUID = null;
|
2024-01-22 00:57:59 -06:00
|
|
|
private final HashSet<UUID> partyInvites = new HashSet<>();
|
2024-02-13 18:02:50 -06:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public EntityPlayer player;
|
|
|
|
|
|
|
|
|
|
public String playername = "";
|
|
|
|
|
public String uuid = "";
|
2021-11-16 10:41:04 -06:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
private EntityNPCInterface activeCompanion = null;
|
|
|
|
|
public int companionID = 0;
|
|
|
|
|
|
2021-11-16 10:41:04 -06:00
|
|
|
public boolean isGUIOpen = false;
|
2024-02-28 20:58:00 -05:00
|
|
|
public boolean hadInteract = true;
|
2021-11-16 10:41:04 -06:00
|
|
|
|
2024-03-07 22:22:39 -05:00
|
|
|
public boolean updateClient = false;
|
|
|
|
|
|
2024-02-28 20:58:00 -05:00
|
|
|
public ScreenSize screenSize = new ScreenSize(-1,-1);
|
2024-01-05 16:31:57 +03:00
|
|
|
|
2024-01-22 00:57:59 -06:00
|
|
|
public void onLogin() {
|
2024-03-13 13:47:33 -04:00
|
|
|
this.animationData.clearCache();
|
2024-01-22 00:57:59 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onLogout() {
|
|
|
|
|
this.partyInvites.clear();
|
2024-03-13 10:25:00 -05:00
|
|
|
this.animationData.clearCache();
|
2024-01-22 00:57:59 -06:00
|
|
|
}
|
|
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
@Override
|
2022-11-11 15:15:42 -03:00
|
|
|
public void saveNBTData(NBTTagCompound nbtTagCompound) {
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
@Override
|
|
|
|
|
public void loadNBTData(NBTTagCompound compound) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setNBT(NBTTagCompound data){
|
|
|
|
|
dialogData.loadNBTData(data);
|
|
|
|
|
bankData.loadNBTData(data);
|
|
|
|
|
questData.loadNBTData(data);
|
|
|
|
|
transportData.loadNBTData(data);
|
|
|
|
|
factionData.loadNBTData(data);
|
|
|
|
|
itemgiverData.loadNBTData(data);
|
2021-10-11 06:49:30 -05:00
|
|
|
mailData.loadNBTData(data);
|
|
|
|
|
timers.readFromNBT(data);
|
2022-05-23 20:41:32 -05:00
|
|
|
skinOverlays.readFromNBT(data);
|
2023-01-16 13:53:15 -06:00
|
|
|
animationData.readFromNBT(data);
|
2018-09-13 12:03:28 -04:00
|
|
|
|
|
|
|
|
if(player != null){
|
|
|
|
|
playername = player.getCommandSenderName();
|
|
|
|
|
uuid = player.getPersistentID().toString();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
playername = data.getString("PlayerName");
|
|
|
|
|
uuid = data.getString("UUID");
|
|
|
|
|
}
|
|
|
|
|
companionID = data.getInteger("PlayerCompanionId");
|
|
|
|
|
if(data.hasKey("PlayerCompanion") && !hasCompanion()){
|
|
|
|
|
EntityCustomNpc npc = new EntityCustomNpc(player.worldObj);
|
|
|
|
|
npc.readEntityFromNBT(data.getCompoundTag("PlayerCompanion"));
|
|
|
|
|
npc.setPosition(player.posX, player.posY, player.posZ);
|
|
|
|
|
if(npc.advanced.role == EnumRoleType.Companion){
|
|
|
|
|
setCompanion(npc);
|
|
|
|
|
((RoleCompanion)npc.roleInterface).setSitting(false);
|
|
|
|
|
player.worldObj.spawnEntityInWorld(npc);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-16 10:41:04 -06:00
|
|
|
isGUIOpen = data.getBoolean("isGUIOpen");
|
2024-04-15 14:40:26 -04:00
|
|
|
DBCAddon.instance.readFromNBT(this, data);
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
2024-03-29 02:15:26 -04:00
|
|
|
public NBTTagCompound getNBT() {
|
|
|
|
|
if(player != null){
|
|
|
|
|
playername = player.getCommandSenderName();
|
|
|
|
|
uuid = player.getPersistentID().toString();
|
|
|
|
|
}
|
|
|
|
|
NBTTagCompound compound = new NBTTagCompound();
|
|
|
|
|
dialogData.saveNBTData(compound);
|
|
|
|
|
bankData.saveNBTData(compound);
|
|
|
|
|
questData.saveNBTData(compound);
|
|
|
|
|
transportData.saveNBTData(compound);
|
|
|
|
|
factionData.saveNBTData(compound);
|
|
|
|
|
itemgiverData.saveNBTData(compound);
|
|
|
|
|
mailData.saveNBTData(compound);
|
|
|
|
|
timers.writeToNBT(compound);
|
|
|
|
|
skinOverlays.writeToNBT(compound);
|
|
|
|
|
animationData.writeToNBT(compound);
|
|
|
|
|
|
|
|
|
|
compound.setString("PlayerName", playername);
|
|
|
|
|
compound.setString("UUID", uuid);
|
|
|
|
|
compound.setInteger("PlayerCompanionId", companionID);
|
|
|
|
|
compound.setBoolean("isGUIOpen",isGUIOpen);
|
|
|
|
|
|
|
|
|
|
if(hasCompanion()){
|
|
|
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
|
|
|
if(activeCompanion.writeToNBTOptional(nbt))
|
|
|
|
|
compound.setTag("PlayerCompanion", nbt);
|
|
|
|
|
}
|
2024-04-15 14:40:26 -04:00
|
|
|
DBCAddon.instance.writeToNBT(this, compound);
|
2024-03-29 02:15:26 -04:00
|
|
|
return compound;
|
|
|
|
|
}
|
2018-09-13 12:03:28 -04:00
|
|
|
|
2024-03-07 22:22:39 -05:00
|
|
|
public NBTTagCompound getSyncNBT(){
|
|
|
|
|
NBTTagCompound compound = new NBTTagCompound();
|
|
|
|
|
dialogData.saveNBTData(compound);
|
|
|
|
|
questData.saveNBTData(compound);
|
|
|
|
|
factionData.saveNBTData(compound);
|
|
|
|
|
return compound;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 18:16:17 -04:00
|
|
|
public void setSyncNBT(NBTTagCompound data){
|
|
|
|
|
dialogData.loadNBTData(data);
|
|
|
|
|
questData.loadNBTData(data);
|
|
|
|
|
factionData.loadNBTData(data);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-29 02:15:26 -04:00
|
|
|
public NBTTagCompound getSyncNBTFull() {
|
|
|
|
|
if(player != null){
|
|
|
|
|
playername = player.getCommandSenderName();
|
|
|
|
|
uuid = player.getPersistentID().toString();
|
|
|
|
|
}
|
|
|
|
|
NBTTagCompound compound = new NBTTagCompound();
|
|
|
|
|
dialogData.saveNBTData(compound);
|
|
|
|
|
bankData.saveNBTData(compound);
|
|
|
|
|
questData.saveNBTData(compound);
|
|
|
|
|
transportData.saveNBTData(compound);
|
|
|
|
|
factionData.saveNBTData(compound);
|
|
|
|
|
mailData.saveNBTData(compound);
|
|
|
|
|
compound.setString("PlayerName", playername);
|
|
|
|
|
compound.setString("UUID", uuid);
|
2024-04-15 14:40:26 -04:00
|
|
|
DBCAddon.instance.writeToNBT(this, compound);
|
2024-03-29 02:15:26 -04:00
|
|
|
return compound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setSyncNBTFull(NBTTagCompound data){
|
|
|
|
|
dialogData.loadNBTData(data);
|
|
|
|
|
bankData.loadNBTData(data);
|
|
|
|
|
questData.loadNBTData(data);
|
|
|
|
|
transportData.loadNBTData(data);
|
|
|
|
|
factionData.loadNBTData(data);
|
|
|
|
|
mailData.loadNBTData(data);
|
|
|
|
|
if(player != null){
|
|
|
|
|
playername = player.getCommandSenderName();
|
|
|
|
|
uuid = player.getPersistentID().toString();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
playername = data.getString("PlayerName");
|
|
|
|
|
uuid = data.getString("UUID");
|
|
|
|
|
}
|
2024-04-15 14:40:26 -04:00
|
|
|
DBCAddon.instance.readFromNBT(this, data);
|
2024-03-29 02:15:26 -04:00
|
|
|
}
|
|
|
|
|
|
2024-04-15 19:20:24 -04:00
|
|
|
public void getDBCSync(NBTTagCompound compound){
|
|
|
|
|
DBCAddon.instance.writeToNBT(this, compound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDBCSync(NBTTagCompound data){
|
|
|
|
|
DBCAddon.instance.readFromNBT(this, data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
@Override
|
|
|
|
|
public void init(Entity entity, World world) {
|
2024-01-22 00:57:59 -06:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
2021-11-16 10:41:04 -06:00
|
|
|
|
|
|
|
|
public void setGUIOpen(boolean bool) {
|
2023-05-21 02:48:30 -05:00
|
|
|
this.isGUIOpen = bool;
|
2021-11-16 10:41:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean getGUIOpen() {
|
2023-05-21 02:48:30 -05:00
|
|
|
return this.isGUIOpen;
|
2021-11-16 10:41:04 -06:00
|
|
|
}
|
|
|
|
|
|
2024-01-05 16:31:57 +03:00
|
|
|
public ScreenSize getScreenSize(){
|
|
|
|
|
return screenSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setScreenSize(ScreenSize size){
|
|
|
|
|
screenSize = size;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public boolean hasCompanion(){
|
|
|
|
|
return activeCompanion != null && !activeCompanion.isDead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCompanion(EntityNPCInterface npc) {
|
|
|
|
|
if(npc != null && npc.advanced.role != EnumRoleType.Companion)//shouldnt happen
|
|
|
|
|
return;
|
|
|
|
|
companionID++;
|
|
|
|
|
activeCompanion = npc;
|
|
|
|
|
if(npc != null)
|
|
|
|
|
((RoleCompanion)npc.roleInterface).companionID = companionID;
|
2023-05-15 23:06:21 -04:00
|
|
|
save();
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateCompanion(World world) {
|
|
|
|
|
if(!hasCompanion() || world == activeCompanion.worldObj)
|
|
|
|
|
return;
|
|
|
|
|
RoleCompanion role = (RoleCompanion) activeCompanion.roleInterface;
|
|
|
|
|
role.owner = player;
|
|
|
|
|
if(!role.isFollowing())
|
|
|
|
|
return;
|
|
|
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
|
|
|
activeCompanion.writeToNBTOptional(nbt);
|
|
|
|
|
activeCompanion.isDead = true;
|
|
|
|
|
|
|
|
|
|
EntityCustomNpc npc = new EntityCustomNpc(world);
|
|
|
|
|
npc.readEntityFromNBT(nbt);
|
|
|
|
|
npc.setPosition(player.posX, player.posY, player.posZ);
|
|
|
|
|
setCompanion(npc);
|
|
|
|
|
((RoleCompanion)npc.roleInterface).setSitting(false);
|
|
|
|
|
world.spawnEntityInWorld(npc);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-22 00:57:59 -06:00
|
|
|
public void inviteToParty(Party party) {
|
|
|
|
|
if (party != null && this.partyUUID == null && !this.partyInvites.contains(party.getPartyUUID())) {
|
|
|
|
|
this.partyInvites.add(party.getPartyUUID());
|
|
|
|
|
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.PARTY_MESSAGE, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
|
2024-03-02 22:05:47 -05:00
|
|
|
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.CHAT, "\u00A7a", "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
|
2024-01-22 00:57:59 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-22 10:53:20 -06:00
|
|
|
public void ignoreInvite(UUID uuid) {
|
|
|
|
|
if (uuid != null) {
|
|
|
|
|
this.partyInvites.remove(uuid);
|
|
|
|
|
PacketHandlerServer.sendInviteData((EntityPlayerMP) player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void acceptInvite(UUID uuid) {
|
|
|
|
|
if (uuid != null) {
|
|
|
|
|
this.partyInvites.remove(uuid);
|
|
|
|
|
Party party = PartyController.Instance().getParty(uuid);
|
2024-03-01 20:51:25 -05:00
|
|
|
if(party != null){
|
|
|
|
|
if (!party.getIsLocked()) {
|
|
|
|
|
party.addPlayer(player);
|
|
|
|
|
PartyController.Instance().pingPartyUpdate(party);
|
|
|
|
|
}
|
2024-02-13 18:02:50 -06:00
|
|
|
}
|
2024-01-22 10:53:20 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-03 20:19:08 -05:00
|
|
|
public Party getPlayerParty() {
|
|
|
|
|
if (partyUUID != null) {
|
|
|
|
|
return PartyController.Instance().getParty(partyUUID);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-22 10:53:20 -06:00
|
|
|
public HashSet<UUID> getPartyInvites() {
|
|
|
|
|
return (HashSet<UUID>) this.partyInvites.clone();
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-12 01:26:23 -05:00
|
|
|
public void setCompanion(ICustomNpc npc) {
|
|
|
|
|
this.setCompanion((EntityNPCInterface) npc.getMCEntity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ICustomNpc getCompanion() {
|
|
|
|
|
return (ICustomNpc) NpcAPI.Instance().getIEntity(activeCompanion);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getCompanionID() {
|
|
|
|
|
return companionID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerDialogData getDialogData() {
|
|
|
|
|
return dialogData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerBankData getBankData() {
|
|
|
|
|
return bankData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerQuestData getQuestData() {
|
|
|
|
|
return questData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerTransportData getTransportData() {
|
|
|
|
|
return transportData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerFactionData getFactionData() {
|
|
|
|
|
return factionData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerItemGiverData getItemGiverData() {
|
|
|
|
|
return itemgiverData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayerMailData getMailData() {
|
|
|
|
|
return mailData;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-15 23:06:21 -04:00
|
|
|
public synchronized void save() {
|
|
|
|
|
final NBTTagCompound compound = getNBT();
|
2023-06-02 02:09:38 -04:00
|
|
|
final String filename;
|
|
|
|
|
if(ConfigMain.DatFormat){
|
|
|
|
|
filename = uuid + ".dat";
|
2023-06-02 03:24:32 -04:00
|
|
|
} else {
|
|
|
|
|
filename = uuid + ".json";
|
2023-06-02 02:09:38 -04:00
|
|
|
}
|
2023-06-05 19:35:06 -04:00
|
|
|
PlayerDataController.Instance.putPlayerMap(playername, uuid);
|
|
|
|
|
PlayerDataController.Instance.putPlayerDataCache(uuid, this);
|
2024-02-20 20:29:49 -05:00
|
|
|
CustomNPCsThreader.customNPCThread.execute(() -> {
|
2023-05-15 23:06:21 -04:00
|
|
|
try {
|
2023-06-05 19:35:06 -04:00
|
|
|
File saveDir = PlayerDataController.Instance.getSaveDir();
|
2023-05-15 23:06:21 -04:00
|
|
|
File file = new File(saveDir, filename + "_new");
|
|
|
|
|
File file1 = new File(saveDir, filename);
|
2023-06-02 02:09:38 -04:00
|
|
|
if(ConfigMain.DatFormat){
|
|
|
|
|
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(file));
|
|
|
|
|
} else {
|
|
|
|
|
NBTJsonUtil.SaveFile(file, compound);
|
|
|
|
|
}
|
2023-05-15 23:06:21 -04:00
|
|
|
if(file1.exists()){
|
|
|
|
|
file1.delete();
|
|
|
|
|
}
|
|
|
|
|
file.renameTo(file1);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LogWriter.except(e);
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-06-12 01:26:23 -05:00
|
|
|
}
|
2023-05-21 02:48:30 -05:00
|
|
|
|
|
|
|
|
public void load() {
|
2023-06-05 19:35:06 -04:00
|
|
|
NBTTagCompound data = PlayerDataController.Instance.loadPlayerData(player.getPersistentID().toString());
|
2023-05-21 02:48:30 -05:00
|
|
|
if(data.hasNoTags()){
|
2023-06-05 19:35:06 -04:00
|
|
|
data = PlayerDataController.Instance.loadPlayerDataOld(player.getCommandSenderName());
|
2023-05-21 02:48:30 -05:00
|
|
|
}
|
2024-04-20 17:26:45 -04:00
|
|
|
if(data.hasNoTags()){
|
|
|
|
|
data = getNBT();
|
|
|
|
|
}
|
2023-05-21 02:48:30 -05:00
|
|
|
setNBT(data);
|
|
|
|
|
}
|
2024-03-07 22:22:39 -05:00
|
|
|
|
|
|
|
|
public static PlayerData get(EntityPlayer player) {
|
|
|
|
|
if(player.worldObj.isRemote)
|
|
|
|
|
return CustomNpcs.proxy.getPlayerData(player);
|
|
|
|
|
|
|
|
|
|
return PlayerDataController.Instance.getPlayerData(player);
|
|
|
|
|
}
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|