From fec32fd8eaa6d2f46a1af4024ffe5ce083037815 Mon Sep 17 00:00:00 2001 From: Heknon Date: Mon, 23 Mar 2020 14:03:19 -0400 Subject: [PATCH] Added ability to create island without GUI. --- .../command/commands/island/CreateCommand.java | 13 +++++++++++-- src/main/resources/language.yml | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/command/commands/island/CreateCommand.java b/src/main/java/com/songoda/skyblock/command/commands/island/CreateCommand.java index aa0ad421..55b3ecd2 100644 --- a/src/main/java/com/songoda/skyblock/command/commands/island/CreateCommand.java +++ b/src/main/java/com/songoda/skyblock/command/commands/island/CreateCommand.java @@ -33,11 +33,20 @@ public class CreateCommand extends SubCommand { Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); FileConfiguration configLoad = config.getFileConfiguration(); - if (islandManager.getIsland(player) == null) { Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")); - if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) { + if (args.length == 1) { + Structure structure = skyblock.getStructureManager().getStructure(args[0]); + + if (structure != null && islandManager.createIsland(player, structure)) { + messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message")); + soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F); + } else if (structure == null) { + messageManager.sendMessage(player, configLoad.getString("Command.Island.Create.StructureNotFound.Message")); + soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); + } + } else if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) { Creator.getInstance().open(player); soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F); } else { diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index 0be3df80..43d64ffe 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -890,8 +890,10 @@ Command: Create: Owner: Message: '&bSkyBlock &8| &cError&8: &eYou are already an Island Owner.' + StructureNotFound: + Message: '&bSkyBlock &8| &cError&8: &eNo Island structure with such a name.' Info: - Message: '&f&oOpens the Island Creator menu.' + Message: '&f&oOpens the Island Creator menu. You can also enter a Structure name to instantly create an Island.' Members: Info: Message: '&f&oOpen the Island Members menu.'