Profile Sync Quest Data Crash Fix

This commit is contained in:
Kam committed 2026-03-11 21:57:56 -04:00
1 parent 15749c8ad7
commit b231f65bfb
3 files changed
+36 -38

No files matched your search

@@ -1,8 +1,6 @@
package noppes.npcs.controllers;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.profile.Profile;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.ProfileClientConfig;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
@@ -133,22 +131,12 @@ public class PlayerQuestController {
boolean finishedLocally = data.finishedQuests.containsKey(quest.id);
boolean completedShared = false;
boolean hasCooldownShared = false;
if (quest.profileOptions.enableOptions) {
boolean hasSharedTimestamp = false;
if (ProfileController.Instance != null) {
if (ConfigMain.ProfilesEnabled) {
Profile profile = ProfileController.Instance.getProfile(player);
hasSharedTimestamp = profile != null && profile.sharedQuestTimestamps.containsKey(quest.id);
}
} else if (ClientCacheHandler.allowProfiles) {
hasSharedTimestamp = ProfileClientConfig.hasSharedQuest(quest.id);
}
if (hasSharedTimestamp) {
if (quest.profileOptions.completeControl == EnumProfileSync.Shared)
completedShared = true;
if (quest.profileOptions.cooldownControl == EnumProfileSync.Shared)
hasCooldownShared = true;
}
if (ProfileClientConfig.isProfilesEnabled() && quest.profileOptions.enableOptions
&& ProfileClientConfig.hasSharedQuest(player, quest.id)) {
if (quest.profileOptions.completeControl == EnumProfileSync.Shared)
completedShared = true;
if (quest.profileOptions.cooldownControl == EnumProfileSync.Shared)
hasCooldownShared = true;
}
boolean isFinished = finishedLocally || completedShared;
@@ -1,8 +1,5 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.profile.Profile;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.ProfileClientConfig;
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,7 +21,6 @@ import noppes.npcs.api.handler.data.IQuestCategory;
import noppes.npcs.api.handler.data.IQuestInterface;
import noppes.npcs.api.handler.data.IQuestObjective;
import noppes.npcs.api.handler.data.ISlot;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.constants.EnumProfileSync;
import noppes.npcs.constants.EnumQuestCompletion;
import noppes.npcs.constants.EnumQuestRepeat;
@@ -178,18 +174,9 @@ public class Quest implements ICompatibilty, IQuest {
}
public long getTimeUntilRepeat(EntityPlayer player) {
if (profileOptions.enableOptions && profileOptions.cooldownControl == EnumProfileSync.Shared) {
Long questTime = null;
if (ProfileController.Instance != null) {
if (ConfigMain.ProfilesEnabled) {
Profile profile = ProfileController.Instance.getProfile(player);
if (profile != null) {
questTime = profile.sharedQuestTimestamps.get(this.id);
}
}
} else if (ClientCacheHandler.allowProfiles) {
questTime = ProfileClientConfig.getSharedQuestTimestamp(this.id);
}
if (ProfileClientConfig.isProfilesEnabled() && profileOptions.enableOptions
&& profileOptions.cooldownControl == EnumProfileSync.Shared) {
Long questTime = ProfileClientConfig.getSharedQuestTimestamp(player, this.id);
if (questTime != null) {
return calculateRemainingCooldown(player, questTime);
}