Fix for proxy command not working with offline players

This commit is contained in:
Fabrizio La Rosa 2020-06-19 16:17:55 +02:00
parent a97d951b7f
commit 00e5ff18ec
2 changed files with 7 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -39,9 +40,10 @@ public class ProxyCommand extends SubCommand {
if (args.length == 1) {
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
UUID islandOwnerUUID = targetPlayerOffline.getOwner();
if (islandManager.containsIsland(islandOwnerUUID)) {
if (islandManager.getIsland(Bukkit.getOfflinePlayer(islandOwnerUUID)) != null) {
if (islandManager.isPlayerProxyingAnotherPlayer(((Player)sender).getUniqueId())) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Proxy.IsOffPlayer.Message")

View File

@ -1191,8 +1191,8 @@ public class IslandManager {
return islandStorage.get(uuid);
}
if (offlinePlayer.isOnline()) {
Player player = offlinePlayer.getPlayer();
Player player = offlinePlayer.getPlayer();
if (offlinePlayer.isOnline() && player != null) {
if (playerDataManager.hasPlayerData(player)) {
PlayerData playerData = playerDataManager.getPlayerData(player);
@ -1207,6 +1207,8 @@ public class IslandManager {
if (offlinePlayerData.getOwner() != null && islandStorage.containsKey(offlinePlayer.getUniqueId())) {
return islandStorage.get(offlinePlayerData.getOwner());
}
return loadIsland(offlinePlayer); // TODO That could be done first, needs testing - Fabrimat
}
return null;