From f29c28e037389e01965aa71b8313b28081661372 Mon Sep 17 00:00:00 2001 From: 0ddlyoko <0ddlyokoOfficial@gmail.com> Date: Fri, 27 Mar 2020 13:14:59 +0100 Subject: [PATCH] Add message for preview and do not preview if user has an island --- .../command/commands/island/PreviewCommand.java | 10 +++++++--- src/main/resources/language.yml | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/command/commands/island/PreviewCommand.java b/src/main/java/com/songoda/skyblock/command/commands/island/PreviewCommand.java index b85b6782..4971c760 100644 --- a/src/main/java/com/songoda/skyblock/command/commands/island/PreviewCommand.java +++ b/src/main/java/com/songoda/skyblock/command/commands/island/PreviewCommand.java @@ -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 { + // Do not preview if user has an island + if (island != null) { + skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.Island.Message")); + return; + } Structure structure = skyblock.getStructureManager().getStructure(args[0]); if(structure == null) { - skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.File.Message")); + skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.File.Message")); return; } - skyblock.getIslandManager().previewIsland(player, skyblock.getStructureManager().getStructure(args[0])); + skyblock.getIslandManager().previewIsland(player, structure); } } diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index b368483c..fd7fc762 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -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: