Fixed nullPointerException on logout

This commit is contained in:
Fabrizio La Rosa 2020-06-14 19:53:53 +02:00
parent 32b79e48a7
commit a3cea93d97

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import com.songoda.skyblock.island.Island;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
@ -94,7 +95,10 @@ public class PlayerManager {
public void unloadPlayer(UUID uuid) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
uuid = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid)).getOwnerUUID();
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
islands.remove(uuid);
skyblock.getFileManager().unloadConfig(new File(playersDirectory,