Add message for preview and do not preview if user has an island

This commit is contained in:
0ddlyoko 2020-03-27 13:14:59 +01:00 committed by Brianna
parent f32d96ef31
commit f29c28e037
2 changed files with 12 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import com.songoda.skyblock.structure.Structure;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -62,12 +61,17 @@ public class PreviewCommand extends SubCommand {
}
}
} else {
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
if(structure == null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.File.Message"));
// Do not preview if user has an island
if (island != null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.Island.Message"));
return;
}
skyblock.getIslandManager().previewIsland(player, skyblock.getStructureManager().getStructure(args[0]));
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
if(structure == null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.File.Message"));
return;
}
skyblock.getIslandManager().previewIsland(player, structure);
}
}

View File

@ -3531,7 +3531,11 @@ Island:
Message: '&bSkyBlock &8| &cError&8: &eYou do not have the right to do that on this Island.'
Preview:
Timeout:
Message: '&bSkyBlock &8| &aInfo&8: &eYour time to preview island has expired'
Message: '&bSkyBlock &8| &aInfo&8: &eYour time to preview island has expired.'
File:
Message: '&bSkyBlock &8| &cError&8: &eThis preview doesn''t exist.'
Island:
Message: '&bSkyBlock &8| &aError&8: &eYou can not preview an island if you already own an island'
Hologram:
Leaderboard:
Votes: