mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 19:54:26 +00:00
35 lines
1.2 KiB
Java
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;
|
|
}
|
|
}
|