mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 19:54:26 +00:00
Profile Sync Quest Data Crash Fix
This commit is contained in:
1 parent
5cf9b26a2e
commit
15749c8ad7
10 files changed
+179
-8
No files matched your search
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user