From 79c8765c51d4f06f53c52599c7282f0971de1a72 Mon Sep 17 00:00:00 2001 From: Kam Date: Mon, 10 Mar 2025 18:07:22 -0400 Subject: [PATCH] Better Profile Rollback --- .../npcs/controllers/ProfileController.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/kamkeel/npcs/controllers/ProfileController.java b/src/main/java/kamkeel/npcs/controllers/ProfileController.java index 602dfef40..1476b924d 100644 --- a/src/main/java/kamkeel/npcs/controllers/ProfileController.java +++ b/src/main/java/kamkeel/npcs/controllers/ProfileController.java @@ -233,15 +233,12 @@ public class ProfileController implements IProfileHandler { newProfile = new Profile(player, compound); activeProfiles.put(uuid, newProfile); loadSlotData(player); - } else { - newProfile = new Profile(null, compound); - activeProfiles.put(uuid, newProfile); + return true; } - return true; } catch (Exception e) { LogWriter.except(e); - return false; } + return false; } public synchronized void logout(EntityPlayer player) { @@ -450,9 +447,6 @@ public class ProfileController implements IProfileHandler { saveSlotData(profile.player); profile.currentSlotId = newSlotId; loadSlotData(profile.player); - PlayerData pdata = PlayerData.get(profile.player); - pdata.profileSlot = newSlotId; - pdata.save(); if(ConfigMain.AttributesEnabled) AttributeController.getTracker(profile.player).recalcAttributes(profile.player); @@ -596,6 +590,10 @@ public class ProfileController implements IProfileHandler { for (IProfileData profileData : profileTypes.values()) { profileData.save(player); } + + PlayerData pdata = PlayerData.get(player); + pdata.profileSlot = profile.getCurrentSlotId(); + pdata.save(); } public List getProfileInfo(EntityPlayer player, int slotId) {