diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java index 7096427..3453765 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java @@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender; * @since 18-Jul-18 */ @Name("boss") -@Alias({"bosses", "b", "bs"}) +@Alias({"bosses", "b", "bs", "eb", "epicbosses"}) @Description("Used to handle all CustomBosses related commands.") public class BossCmd extends SubCommandService { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java index 609e724..bcad4f1 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java @@ -7,6 +7,7 @@ import lombok.Setter; import com.songoda.epicbosses.entity.elements.*; import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder; +import java.util.ArrayList; import java.util.List; /** @@ -50,6 +51,34 @@ public class BossEntity { } } + public List getIncompleteSectionsToEnable() { + List incompleteList = new ArrayList<>(); + + if(this.entityStats == null) incompleteList.add("EntityStats"); + else { + EntityStatsElement entityStatsElement = this.entityStats.get(0); + + if(entityStatsElement == null) incompleteList.add("EntityStatsElement"); + else { + MainStatsElement mainStatsElement = entityStatsElement.getMainStats(); + + if(mainStatsElement == null) incompleteList.add("MainStatsElement"); + else { + Integer position = mainStatsElement.getPosition(); + String entityType = mainStatsElement.getEntityType(); + Double health = mainStatsElement.getHealth(); + + if(position == null) incompleteList.add("Entity Position"); + if(health == null) incompleteList.add("Entity Health"); + if(entityType == null || entityType.isEmpty()) incompleteList.add("Entity Type"); + if(getSpawnItem() == null || getSpawnItem().isEmpty()) incompleteList.add("Spawn Item"); + } + } + } + + return incompleteList; + } + public boolean isCompleteEnoughToSpawn() { if(this.entityStats == null) return false; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java index 3a576a9..0742ed2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java @@ -9,6 +9,7 @@ import com.songoda.epicbosses.managers.files.BossesFileManager; import com.songoda.epicbosses.utils.Message; import com.songoda.epicbosses.utils.ObjectUtils; import com.songoda.epicbosses.utils.ServerUtils; +import com.songoda.epicbosses.utils.StringUtils; import com.songoda.epicbosses.utils.panel.Panel; import com.songoda.epicbosses.utils.panel.base.ClickAction; import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler; @@ -18,6 +19,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -95,7 +97,9 @@ public class MainBossEditPanel extends VariablePanelHandler { this.bossEntityManager.killAllHolders(bossEntity); } } else { - Message.Boss_Edit_NotCompleteEnough.msg(player); + List incompleteThings = bossEntity.getIncompleteSectionsToEnable(); + + Message.Boss_Edit_NotCompleteEnough.msg(player, StringUtils.get().appendList(incompleteThings)); } }; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java index 770e2ba..6b596ab 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java @@ -3,7 +3,6 @@ package com.songoda.epicbosses.panel.bosses; import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.api.BossAPI; import com.songoda.epicbosses.entity.BossEntity; -import com.songoda.epicbosses.entity.elements.EntityStatsElement; import com.songoda.epicbosses.managers.BossPanelManager; import com.songoda.epicbosses.managers.files.BossesFileManager; import com.songoda.epicbosses.managers.files.ItemsFileManager; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java index f04ab59..5285df7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java @@ -41,35 +41,33 @@ public class SpawnTextEditorPanel extends VariablePanelHandler { @Override public void openFor(Player player, BossEntity bossEntity) { + Map replaceMap = new HashMap<>(); + Integer radius = bossEntity.getMessages().getOnSpawn().getRadius(); + String message = bossEntity.getMessages().getOnDeath().getMessage(); + PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); + + if(radius == null) radius = 0; + if(message == null) message = "N/A"; + + replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); + replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); + replaceMap.put("{selected}", message); + panelBuilder.addReplaceData(replaceMap); + + Panel panel = panelBuilder.getPanel() + .setDestroyWhenDone(true) + .setCancelClick(true) + .setCancelLowerClick(true) + .setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity); + PanelBuilderCounter counter = panel.getPanelBuilderCounter(); + ServerUtils.get().runTaskAsync(() -> { - Map replaceMap = new HashMap<>(); - Integer radius = bossEntity.getMessages().getOnSpawn().getRadius(); - String message = bossEntity.getMessages().getOnDeath().getMessage(); - PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); + counter.getSlotsWith("Select").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnSpawnTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity))); + counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity))); - if(radius == null) radius = 0; - if(message == null) message = "N/A"; - - replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); - replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); - replaceMap.put("{selected}", message); - panelBuilder.addReplaceData(replaceMap); - - Panel panel = panelBuilder.getPanel() - .setDestroyWhenDone(true) - .setCancelClick(true) - .setCancelLowerClick(true) - .setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity); - PanelBuilderCounter counter = panel.getPanelBuilderCounter(); - - ServerUtils.get().runTaskAsync(() -> { - counter.getSlotsWith("Select").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnSpawnTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity))); - counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity))); - - }); - - panel.openFor(player); }); + + panel.openFor(player); } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java index b221fd6..56eab97 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java @@ -45,39 +45,37 @@ public class TauntTextEditorPanel extends VariablePanelHandler { @Override public void openFor(Player player, BossEntity bossEntity) { + Map replaceMap = new HashMap<>(); + TauntElement tauntElement = bossEntity.getMessages().getTaunts(); + Integer radius = tauntElement.getRadius(); + Integer delay = tauntElement.getDelay(); + List taunts = tauntElement.getTaunts(); + PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); + + if(radius == null) radius = 100; + if(delay == null) delay = 60; + if(taunts == null || taunts.isEmpty()) taunts = Arrays.asList("N/A"); + + replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); + replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); + replaceMap.put("{delay}", NumberUtils.get().formatDouble(delay)); + replaceMap.put("{taunts}", StringUtils.get().appendList(taunts)); + panelBuilder.addReplaceData(replaceMap); + + Panel panel = panelBuilder.getPanel() + .setDestroyWhenDone(true) + .setCancelClick(true) + .setCancelLowerClick(true) + .setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity); + PanelBuilderCounter counter = panel.getPanelBuilderCounter(); + ServerUtils.get().runTaskAsync(() -> { - Map replaceMap = new HashMap<>(); - TauntElement tauntElement = bossEntity.getMessages().getTaunts(); - Integer radius = tauntElement.getRadius(); - Integer delay = tauntElement.getDelay(); - List taunts = tauntElement.getTaunts(); - PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - - if(radius == null) radius = 100; - if(delay == null) delay = 60; - if(taunts == null || taunts.isEmpty()) taunts = Arrays.asList("N/A"); - - replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); - replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); - replaceMap.put("{delay}", NumberUtils.get().formatDouble(delay)); - replaceMap.put("{taunts}", StringUtils.get().appendList(taunts)); - panelBuilder.addReplaceData(replaceMap); - - Panel panel = panelBuilder.getPanel() - .setDestroyWhenDone(true) - .setCancelClick(true) - .setCancelLowerClick(true) - .setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity); - PanelBuilderCounter counter = panel.getPanelBuilderCounter(); - - ServerUtils.get().runTaskAsync(() -> { - counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity))); - counter.getSlotsWith("Delay").forEach(slot -> panel.setOnClick(slot, getDelayAction(bossEntity))); - counter.getSlotsWith("Taunts").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnTauntTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity))); - }); - - panel.openFor(player); + counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity))); + counter.getSlotsWith("Delay").forEach(slot -> panel.setOnClick(slot, getDelayAction(bossEntity))); + counter.getSlotsWith("Taunts").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnTauntTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity))); }); + + panel.openFor(player); } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java index 456f565..9180b60 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java @@ -63,7 +63,7 @@ public enum Message { Boss_Edit_ItemStackHolderNull("&c&l(!) &cThe itemstack name that is provided for the spawn item doesn't exist or wasn't found."), Boss_Edit_CannotSpawn("&c&l(!) &cYou cannot spawn this boss while editing is enabled. If you think this is a mistake please contact an administrator to disable the editing of the boss."), Boss_Edit_Toggled("&b&lEpicBosses &8» &7You have toggled the editing mode for &f{0}&7 to &f{1}&7."), - Boss_Edit_NotCompleteEnough("&c&l(!) &cThe boss is not set up enough to be enabled. Please make sure it has: &fA Spawn Item, Entity Type, Health and Position&c before you try and enable the boss."), + Boss_Edit_NotCompleteEnough("&c&l(!) &cThe boss is not set up enough to be enabled. Please make sure it has the following things: &f{0}&c Once these things are set try toggling again."), Boss_Edit_DoesntExist("&c&l(!) &cThe specified boss does not exist. Please try again with the proper name. If you cannot figure it out please check the bosses.json file to find the one you're looking for."), Boss_GiveEgg_NoPermission("&c&l(!) &cYou do not have access to this command."), @@ -82,7 +82,6 @@ public enum Message { "&b/boss info [name] &8» &7Shows information on the specified boss.\n" + "&b/boss nearby (radius) &8» &7Shows the nearby bosses.\n" + "&b/boss reload &8» &7Reloads the boss plugin.\n" + - "&b/boss killall (world) &8» &7Kills all bosses/minions.\n" + "&7\n" + "&7Use /boss help 2 to view the next page.\n" + "&8&m----*-----------------------------------*----"), @@ -91,16 +90,16 @@ public enum Message { "&b/boss spawn [name] (location) &8» &7Spawns a boss at your" + " location or the specified location.\n" + "&7&o(Separate location with commas, an example is: world,0,100,0)\n" + - "&b/boss time [section] &8» &7Shows the time left till next auto spawn.\n" + "&b/boss droptable &8» &7Shows all current drop tables.\n" + "&b/boss items &8» &7Shows all current custom items.\n" + - "&b/boss skills &8» &7Shows all current set skills.\n" + + "&b/boss skills &8» &7Shows all current set skills.\n" + + "&b/boss killall (world) &8» &7Kills all bosses/minions.\n" + "&7\n" + "&7Use /boss help 3 to view the next page.\n" + "&8&m----*-----------------------------------*----"), Boss_Help_Page3( "&8&m----*--------&3&l[ &b&lBoss Help &7(Page 3/4) &3&l]&8&m--------*----\n" + - "&b/boss debug &8» &7Used to toggle the debug aspect of the plugin.\n" + + "&b/boss time [section] &8» &7Shows the time left till next auto spawn.\n" + "&b/boss giveegg [name] [player] (amount) &8» &7Used to be given a " + "spawn item of the boss.\n" + "&b/boss list &8» &7Shows all the list of current boss entities.\n" + @@ -116,7 +115,7 @@ public enum Message { "&b/boss new message [name] [messages] &8» &7Used to create a new message section.\n" + "&7&o(To add a new line use &7||&7&o in-between the messages.)\n" + "&7/boss new autospawn [name] &8» &7Used to create a new auto spawn section.\n" + - "&7\n" + + "&b/boss debug &8» &7Used to toggle the debug aspect of the plugin.\n" + "&7\n" + "&7\n" + "&7Use /boss help [page] to view the next page.\n" + diff --git a/pom.xml b/pom.xml index 6421fa7..8de4a8c 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ - 1.0.0-U196 + 1.0.0-U197 EpicBosses com.songoda.epicbosses.CustomBosses AMinecraftDev