Adds a null check to deserialization
This commit is contained in:
parent
31dc02b425
commit
05b7d0e38f
1 changed files with 4 additions and 2 deletions
|
@ -3,8 +3,8 @@ package dev.zontreck.ase.profile;
|
|||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class PlayerProfile {
|
||||
public PlayerPronouns pronouns;
|
||||
public String nickname;
|
||||
public PlayerPronouns pronouns = PlayerPronouns.TheyThem;
|
||||
public String nickname = "";
|
||||
|
||||
public ConfigurationSection serialize(ConfigurationSection parent) {
|
||||
ConfigurationSection profile = parent.createSection("profile");
|
||||
|
@ -15,6 +15,8 @@ public class PlayerProfile {
|
|||
}
|
||||
|
||||
public static PlayerProfile deserialize(ConfigurationSection section) {
|
||||
if (section == null)
|
||||
return new PlayerProfile();
|
||||
String nick = "";
|
||||
PlayerPronouns pronouns = PlayerPronouns.TheyThem;
|
||||
if (section.contains("nickname")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue