Fixed an issue with player loading when guild data file is missing

This commit is contained in:
Jules 2024-08-26 12:56:00 -07:00
parent ed9a9353aa
commit 22e5947112
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ public class MMOCoreDataSynchronizer extends SQLDataSynchronizer<PlayerData> {
getData().setUnlockedItems(unlockedItems);
if (!isEmpty(result.getString("guild"))) {
final Guild guild = MMOCore.plugin.nativeGuildManager.getGuild(result.getString("guild"));
if (guild != null) getData().setGuild(guild.hasMember(getData().getUniqueId()) ? guild : null);
if (guild != null && guild.hasMember(getData().getUniqueId())) getData().setGuild(guild);
}
if (!isEmpty(result.getString("attributes"))) getData().getAttributes().load(result.getString("attributes"));
if (getData().isOnline())

View File

@ -58,8 +58,8 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler<PlayerDat
if (config.contains("class")) data.setClass(MMOCore.plugin.classManager.get(config.getString("class")));
if (config.contains("guild")) {
Guild guild = MMOCore.plugin.nativeGuildManager.getGuild(config.getString("guild"));
data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null);
final Guild guild = MMOCore.plugin.nativeGuildManager.getGuild(config.getString("guild"));
if (guild != null && guild.hasMember(data.getUniqueId())) data.setGuild(guild);
}
if (config.contains("attribute"))
data.getAttributes().load(config.getConfigurationSection("attribute"));