Files
CustomNPC-Plus/src/main/java/noppes/npcs/controllers/ProfileConfigSync.java
T
2026-03-11 21:42:27 -04:00

35 lines
1.2 KiB
Java

package noppes.npcs.controllers;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.profile.Profile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.config.ConfigMain;
import java.util.Map;
public class ProfileConfigSync {
public static NBTTagCompound writeToNBT(EntityPlayer player) {
NBTTagCompound compound = new NBTTagCompound();
if (!ConfigMain.ProfilesEnabled || ProfileController.Instance == null) {
return compound;
}
Profile profile = ProfileController.Instance.getProfile(player);
if (profile == null) {
return compound;
}
NBTTagList questList = new NBTTagList();
for (Map.Entry<Integer, Long> entry : profile.sharedQuestTimestamps.entrySet()) {
NBTTagCompound questEntry = new NBTTagCompound();
questEntry.setInteger("Quest", entry.getKey());
questEntry.setLong("Date", entry.getValue());
questList.appendTag(questEntry);
}
compound.setTag("SharedQuestTimestamps", questList);
return compound;
}
}