mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-26 18:47:57 +01:00
Harden save() method by making a defensive copy
This commit is contained in:
parent
12ed2ac07b
commit
3236ee5ec9
@ -13,6 +13,7 @@ import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
public class PlayerProfile {
|
public class PlayerProfile {
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
@ -63,7 +64,7 @@ public class PlayerProfile {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = !mcMMO.getDatabaseManager().saveUser(this);
|
changed = !mcMMO.getDatabaseManager().saveUser(new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), mobHealthbarType));
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
||||||
|
Loading…
Reference in New Issue
Block a user