Fix '/is bans' showing invalid players

This commit is contained in:
Esophose 2019-08-17 14:55:00 -06:00
parent 15667c8635
commit c89be5cc73
3 changed files with 19 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -45,7 +46,12 @@ public class Ban {
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"), .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
islandOwnerUUID.toString() + ".yml")) islandOwnerUUID.toString() + ".yml"))
.getFileConfiguration().getStringList("Bans")) { .getFileConfiguration().getStringList("Bans")) {
islandBans.add(UUID.fromString(islandBanList));
UUID uuid = UUID.fromString(islandBanList);
if (!Bukkit.getOfflinePlayer(uuid).hasPlayedBefore())
continue;
islandBans.add(uuid);
} }
return islandBans; return islandBans;

View File

@ -216,7 +216,12 @@ public class Bans {
targetPlayerTexture = offlinePlayer.getTexture(); targetPlayerTexture = offlinePlayer.getTexture();
} else { } else {
targetPlayerName = targetPlayer.getName(); targetPlayerName = targetPlayer.getName();
if (playerDataManager.hasPlayerData(targetPlayer)) {
targetPlayerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture(); targetPlayerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture();
} else {
targetPlayerTexture = new String[] { null, null };
}
} }
nInv.addItem( nInv.addItem(

View File

@ -220,7 +220,12 @@ public class Coop {
targetPlayerTexture = offlinePlayer.getTexture(); targetPlayerTexture = offlinePlayer.getTexture();
} else { } else {
targetPlayerName = targetPlayer.getName(); targetPlayerName = targetPlayer.getName();
if (playerDataManager.hasPlayerData(targetPlayer)) {
targetPlayerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture(); targetPlayerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture();
} else {
targetPlayerTexture = new String[] { null, null };
}
} }
nInv.addItem( nInv.addItem(