forked from Upstream/mmocore
Fixed guild loading NPE
This commit is contained in:
parent
99f83a722a
commit
0bcd11cf68
@ -11,6 +11,8 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class GuildDataManager {
|
||||
protected final Map<String, Guild> guilds = new HashMap<>();
|
||||
|
||||
@ -39,6 +41,7 @@ public abstract class GuildDataManager {
|
||||
delete(guild);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Guild getGuild(String guild) {
|
||||
return guilds.get(guild);
|
||||
}
|
||||
|
@ -78,8 +78,9 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer {
|
||||
}
|
||||
data.setUnlockedItems(unlockedItems);
|
||||
if (!isEmpty(result.getString("guild"))) {
|
||||
Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild"));
|
||||
data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null);
|
||||
final Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild"));
|
||||
if (guild != null)
|
||||
data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null);
|
||||
}
|
||||
if (!isEmpty(result.getString("attributes")))
|
||||
data.getAttributes().load(result.getString("attributes"));
|
||||
|
Loading…
Reference in New Issue
Block a user