mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 15:44:30 +00:00
Fix Some Quest Cooldown Behavior
This commit is contained in:
1 parent
38df157c40
commit
eaec10e529
7 files changed
+116
-40
No files matched your search
@@ -2,6 +2,7 @@ package kamkeel.npcs.controllers.data.profile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IProfile;
|
||||
@@ -15,6 +16,7 @@ public class Profile implements IProfile {
|
||||
public EntityPlayer player;
|
||||
public int currentSlotId;
|
||||
private final Map<Integer, ISlot> slots = new HashMap<>();
|
||||
public Map<Integer, Long> sharedQuestTimestamps = new HashMap<>();
|
||||
private boolean locked = false;
|
||||
|
||||
public Profile(EntityPlayer player, NBTTagCompound compound) {
|
||||
@@ -39,6 +41,14 @@ public class Profile implements IProfile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (compound.hasKey("SharedQuestTimestamps")) {
|
||||
NBTTagList list = compound.getTagList("SharedQuestTimestamps", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound entry = list.getCompoundTagAt(i);
|
||||
sharedQuestTimestamps.put(entry.getInteger("Quest"), entry.getLong("Date"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Profile(EntityPlayer player) {
|
||||
@@ -88,6 +98,16 @@ public class Profile implements IProfile {
|
||||
slotsCompound.setTag(String.valueOf(entry.getKey()), entry.getValue().toNBT());
|
||||
}
|
||||
compound.setTag("Slots", slotsCompound);
|
||||
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for (Map.Entry<Integer, Long> entry : 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