diff --git a/plugin-modules/Core/resources-json/items.json b/plugin-modules/Core/resources-json/items.json index dfe404d..af4b780 100644 --- a/plugin-modules/Core/resources-json/items.json +++ b/plugin-modules/Core/resources-json/items.json @@ -1,4 +1,8 @@ { + "DefaultMinionMenuSpawnItem": { + "type": "ZOMBIE_SPAWN_EGG", + "name": "&c&lDefault Minion Menu Spawn Item" + }, "DefaultTextMenuItem": { "type": "BOOK", "name": "&c&lDefault Text Menu Item" diff --git a/plugin-modules/Core/resources-yml/config.yml b/plugin-modules/Core/resources-yml/config.yml index 4c2a256..036b1fc 100644 --- a/plugin-modules/Core/resources-yml/config.yml +++ b/plugin-modules/Core/resources-yml/config.yml @@ -170,4 +170,15 @@ Display: Material: menuName: '&b&lSelect Material' selectedName: '&bMaterial: &f{type} &a** Selected **' - name: '&bMaterial: &f{type}' \ No newline at end of file + name: '&bMaterial: &f{type}' + MinionList: + menuName: '&b&lSelect Minion For Skill' + selectedName: '&bMinion: &f{name} &a** Selected **' + name: '&bMinion: &f{name}' + lore: + - '&3Editing: &7{editing}' + - '&3Targeting: &7{targeting}' + CustomSetting: + name: '&bSetting: &f{setting}' + lore: + - '&3Currently: &7{currently}' \ No newline at end of file diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java index 00e4b46..372bdea 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java @@ -28,6 +28,7 @@ import com.songoda.epicbosses.panel.skills.custom.commands.CommandListSkillEdito import com.songoda.epicbosses.panel.skills.custom.commands.ModifyCommandEditorPanel; import com.songoda.epicbosses.panel.skills.custom.custom.CustomSkillTypeEditorPanel; import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel; +import com.songoda.epicbosses.panel.skills.custom.custom.MinionSelectEditorPanel; import com.songoda.epicbosses.panel.skills.custom.custom.SpecialSettingsEditorPanel; import com.songoda.epicbosses.panel.skills.custom.potions.CreatePotionEffectEditorPanel; import com.songoda.epicbosses.panel.skills.custom.potions.PotionEffectTypeEditorPanel; @@ -78,7 +79,7 @@ public class BossPanelManager implements ILoadable, IReloadable { @Getter private IVariablePanelHandler mainSkillEditMenu, customMessageEditMenu, skillTypeEditMenu, potionSkillEditorPanel, commandSkillEditorPanel, groupSkillEditorPanel, customSkillEditorPanel; @Getter private ISubVariablePanelHandler createPotionEffectMenu, potionEffectTypeEditMenu; @Getter private ISubVariablePanelHandler modifyCommandEditMenu, commandListSkillEditMenu; - @Getter private ISubVariablePanelHandler customSkillTypeEditorMenu, specialSettingsEditorMenu; + @Getter private ISubVariablePanelHandler customSkillTypeEditorMenu, specialSettingsEditorMenu, minionSelectEditorMenu; private final CustomBosses customBosses; @@ -197,7 +198,7 @@ public class BossPanelManager implements ILoadable, IReloadable { PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("ModifyCommandEditorPanel")); PanelBuilder panelBuilder6 = new PanelBuilder(editor.getConfigurationSection("CustomSkillEditorPanel")); PanelBuilder panelBuilder7 = new PanelBuilder(editor.getConfigurationSection("CustomSkillTypeEditorPanel")); - PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("CustomSkillTypeEditorPanel")); + PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("SpecialSettingsEditorPanel")); this.mainSkillEditMenu = new MainSkillEditorPanel(this, panelBuilder, this.customBosses); this.customMessageEditMenu = new SingleMessageListEditor(this, getListMenu("Skills.MainEdit"), this.customBosses) { @@ -234,6 +235,7 @@ public class BossPanelManager implements ILoadable, IReloadable { this.customSkillEditorPanel = new CustomSkillEditorPanel(this, panelBuilder6, this.customBosses); this.customSkillTypeEditorMenu = new CustomSkillTypeEditorPanel(this, panelBuilder7, this.customBosses); this.specialSettingsEditorMenu = new SpecialSettingsEditorPanel(this, panelBuilder8, this.customBosses); + this.minionSelectEditorMenu = new MinionSelectEditorPanel(this, getListMenu("Skills.MinionList"), this.customBosses); } private void reloadSkillEditMenus() { @@ -246,7 +248,7 @@ public class BossPanelManager implements ILoadable, IReloadable { PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("ModifyCommandEditorPanel")); PanelBuilder panelBuilder6 = new PanelBuilder(editor.getConfigurationSection("CustomSkillEditorPanel")); PanelBuilder panelBuilder7 = new PanelBuilder(editor.getConfigurationSection("CustomSkillTypeEditorPanel")); - PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("CustomSkillTypeEditorPanel")); + PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("SpecialSettingsEditorPanel")); this.mainSkillEditMenu.initializePanel(panelBuilder); this.customMessageEditMenu.initializePanel(getListMenu("Skills.MainEdit")); @@ -261,6 +263,7 @@ public class BossPanelManager implements ILoadable, IReloadable { this.customSkillEditorPanel.initializePanel(panelBuilder6); this.customSkillTypeEditorMenu.initializePanel(panelBuilder7); this.specialSettingsEditorMenu.initializePanel(panelBuilder8); + this.minionSelectEditorMenu.initializePanel(getListMenu("Skills.MinionList")); } //--------------------------------------------- diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossSkillManager.java b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossSkillManager.java index df56010..8b8407a 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossSkillManager.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossSkillManager.java @@ -197,35 +197,41 @@ public class BossSkillManager implements ILoadable { return null; } - public static ICustomSkillAction createCustomSkillAction(String name, ItemStack displayStack, ClickAction clickAction) { - return new CustomSkillActionCreator(name, displayStack, clickAction); + public static ICustomSkillAction createCustomSkillAction(String name, String current, ItemStack displayStack, ClickAction clickAction) { + return new CustomSkillActionCreator(name, current, displayStack, clickAction); } private static class CustomSkillActionCreator implements ICustomSkillAction { private final ClickAction clickAction; - private final String name; + private final String name, current; private final ItemStack itemStack; - public CustomSkillActionCreator(String name, ItemStack itemStack, ClickAction clickAction) { + public CustomSkillActionCreator(String name, String current, ItemStack itemStack, ClickAction clickAction) { this.name = name; + this.current = current; this.itemStack = itemStack; this.clickAction = clickAction; } @Override public ClickAction getAction() { - return null; + return this.clickAction; } @Override public String getSettingName() { - return null; + return this.name; } @Override public ItemStack getDisplayItemStack() { - return null; + return this.itemStack; + } + + @Override + public String getCurrent() { + return this.current; } } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java index e326fb3..4e9c253 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java @@ -7,7 +7,6 @@ import com.songoda.epicbosses.skills.types.CustomSkillElement; import com.songoda.epicbosses.utils.StringUtils; import com.songoda.epicbosses.utils.itemstack.ItemStackUtils; import com.songoda.epicbosses.utils.panel.Panel; -import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler; import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler; import com.songoda.epicbosses.utils.panel.base.handlers.SubVariablePanelHandler; import com.songoda.epicbosses.utils.panel.builder.PanelBuilder; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java new file mode 100644 index 0000000..7b355b6 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java @@ -0,0 +1,123 @@ +package com.songoda.epicbosses.panel.skills.custom.custom; + +import com.google.gson.JsonObject; +import com.songoda.epicbosses.CustomBosses; +import com.songoda.epicbosses.api.BossAPI; +import com.songoda.epicbosses.entity.MinionEntity; +import com.songoda.epicbosses.managers.BossPanelManager; +import com.songoda.epicbosses.managers.files.ItemsFileManager; +import com.songoda.epicbosses.managers.files.MinionsFileManager; +import com.songoda.epicbosses.skills.Skill; +import com.songoda.epicbosses.skills.elements.CustomMinionSkillElement; +import com.songoda.epicbosses.skills.types.CustomSkillElement; +import com.songoda.epicbosses.utils.StringUtils; +import com.songoda.epicbosses.utils.itemstack.ItemStackConverter; +import com.songoda.epicbosses.utils.itemstack.ItemStackUtils; +import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder; +import com.songoda.epicbosses.utils.panel.Panel; +import com.songoda.epicbosses.utils.panel.base.handlers.SubVariablePanelHandler; +import com.songoda.epicbosses.utils.panel.builder.PanelBuilder; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Charles Cullen + * @version 1.0.0 + * @since 22-Dec-18 + */ +public class MinionSelectEditorPanel extends SubVariablePanelHandler { + + private MinionsFileManager minionsFileManager; + private ItemStackConverter itemStackConverter; + private ItemsFileManager itemsFileManager; + private CustomBosses plugin; + + public MinionSelectEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) { + super(bossPanelManager, panelBuilder); + + this.plugin = plugin; + this.itemStackConverter = new ItemStackConverter(); + this.itemsFileManager = plugin.getItemStackManager(); + this.minionsFileManager = plugin.getMinionsFileManager(); + } + + @Override + public void fillPanel(Panel panel, Skill skill, CustomSkillElement customSkillElement) { + Map currentEntities = this.minionsFileManager.getMinionEntities(); + List entryList = new ArrayList<>(currentEntities.keySet()); + int maxPage = panel.getMaxPage(entryList); + + panel.setOnPageChange(((player, currentPage, requestedPage) -> { + if(requestedPage < 0 || requestedPage > maxPage) return false; + + loadPage(panel, requestedPage, currentEntities, entryList, skill, customSkillElement); + return true; + })); + + loadPage(panel, 0, currentEntities, entryList, skill, customSkillElement); + } + + @Override + public void openFor(Player player, Skill skill, CustomSkillElement customSkillElement) { + Panel panel = getPanelBuilder().getPanel() + .setParentPanelHandler(this.bossPanelManager.getSpecialSettingsEditorMenu(), skill, customSkillElement); + + fillPanel(panel, skill, customSkillElement); + panel.openFor(player); + } + + @Override + public void initializePanel(PanelBuilder panelBuilder) { + + } + + private void loadPage(Panel panel, int page, Map currentEntities, List entryList, Skill skill, CustomSkillElement customSkillElement) { + CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData(); + String current = customMinionSkillElement.getMinionToSpawn(); + + panel.loadPage(page, ((slot, realisticSlot) -> { + if(slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + } else { + String name = entryList.get(slot); + MinionEntity minionEntity = currentEntities.get(name); + ItemStackHolder itemStackHolder = this.itemsFileManager.getItemStackHolder("DefaultMinionMenuSpawnItem"); + ItemStack itemStack = this.itemStackConverter.from(itemStackHolder); + Map replaceMap = new HashMap<>(); + + replaceMap.put("{name}", StringUtils.get().formatString(name)); + replaceMap.put("{editing}", ""+minionEntity.isEditing()); + replaceMap.put("{targeting}", minionEntity.getTargeting()); + + if(current.equalsIgnoreCase(name)) { + ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.MinionList.selectedName"), replaceMap); + } else { + ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.MinionList.name"), replaceMap); + } + + ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.Skills.MinionList.lore"), replaceMap); + + panel.setItem(realisticSlot, itemStack, event -> { + customMinionSkillElement.setMinionToSpawn(name); + + JsonObject minionElement = BossAPI.convertObjectToJsonObject(customMinionSkillElement); + + customSkillElement.getCustom().setOtherSkillData(minionElement); + + JsonObject customElement = BossAPI.convertObjectToJsonObject(customSkillElement); + + skill.setCustomData(customElement); + this.plugin.getSkillsFileManager().save(); + + loadPage(panel, page, currentEntities, entryList, skill, customSkillElement); + }); + } + })); + } +} diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java index 05e66ca..72cbded 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java @@ -3,8 +3,10 @@ package com.songoda.epicbosses.panel.skills.custom.custom; import com.google.gson.JsonObject; import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.api.BossAPI; +import com.songoda.epicbosses.entity.MinionEntity; import com.songoda.epicbosses.managers.BossPanelManager; import com.songoda.epicbosses.managers.BossSkillManager; +import com.songoda.epicbosses.managers.files.MinionsFileManager; import com.songoda.epicbosses.skills.CustomSkillHandler; import com.songoda.epicbosses.skills.interfaces.ICustomSkillAction; import com.songoda.epicbosses.skills.Skill; @@ -32,6 +34,7 @@ import java.util.Map; public class SpecialSettingsEditorPanel extends SubVariablePanelHandler { private ItemStackConverter itemStackConverter; + private MinionsFileManager minionsFileManager; private BossSkillManager bossSkillManager; private CustomBosses plugin; @@ -41,6 +44,7 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler replaceMap = new HashMap<>(); -// replaceMap.put("{name}", name); -// replaceMap.put("{multiplier}", ""+customSkillHandler.doesUseMultiplier()); -// replaceMap.put("{customData}", hasCustomData); + } })); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java index 71876d6..fb50e39 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java @@ -16,6 +16,7 @@ import com.songoda.epicbosses.skills.types.CustomSkillElement; import com.songoda.epicbosses.utils.Debug; import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.itemstack.converters.MaterialConverter; +import com.songoda.epicbosses.utils.panel.base.ClickAction; import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler; import lombok.Getter; import org.bukkit.Location; @@ -58,12 +59,12 @@ public class Cage extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { - Map> map = new HashMap<>(); + public Map getOtherSkillData() { + Map map = new HashMap<>(); - map.put("flatType", String.class); - map.put("wallType", String.class); - map.put("insideType", String.class); + map.put("flatType", "IRON_BLOCK"); + map.put("wallType", "IRON_BARS"); + map.put("insideType", "AIR"); return map; } @@ -71,10 +72,14 @@ public class Cage extends CustomSkillHandler { @Override public List getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) { List clickActions = new ArrayList<>(); + ItemStack clickStack = new ItemStack(Material.STONE_PRESSURE_PLATE); + ClickAction flatAction = (event -> this.flatTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement)); + ClickAction wallAction = (event -> this.wallTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement)); + ClickAction insideAction = (event -> this.insideTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement)); -// clickActions.add(BossSkillManager.createCustomSkillAction("Flat Type Editor", new ItemStack(Material.STONE_PRESSURE_PLATE), event -> this.flatTypeEditor.openFor((Player) event.getWhoClicked()), skill, customSkillElement)); -// clickActions.add(event -> this.wallTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement)); -// clickActions.add(event -> this.insideTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement)); + clickActions.add(BossSkillManager.createCustomSkillAction("Flat Type Editor", clickStack.clone(), flatAction)); + clickActions.add(BossSkillManager.createCustomSkillAction("Wall Type Editor", clickStack.clone(), wallAction)); + clickActions.add(BossSkillManager.createCustomSkillAction("Inside Type Editor", clickStack.clone(), insideAction)); return clickActions; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java index 1330774..c605a98 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java @@ -31,7 +31,7 @@ public class Disarm extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java index efdd4e4..e42683f 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java @@ -25,7 +25,7 @@ public class Fireball extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java index ede3871..4c22197 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java @@ -26,7 +26,7 @@ public class Grapple extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java index 43fa482..51da16f 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java @@ -26,7 +26,7 @@ public class Knockback extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Launch.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Launch.java index 5890364..5b35643 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Launch.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Launch.java @@ -25,7 +25,7 @@ public class Launch extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Lightning.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Lightning.java index a003a20..8ad7cd7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Lightning.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Lightning.java @@ -24,7 +24,7 @@ public class Lightning extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Minions.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Minions.java index 691dd24..3205cb2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Minions.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Minions.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.api.BossAPI; import com.songoda.epicbosses.holder.ActiveBossHolder; +import com.songoda.epicbosses.managers.BossSkillManager; import com.songoda.epicbosses.skills.CustomSkillHandler; import com.songoda.epicbosses.skills.Skill; import com.songoda.epicbosses.skills.elements.CustomMinionSkillElement; @@ -12,9 +13,11 @@ import com.songoda.epicbosses.skills.types.CustomSkillElement; import com.songoda.epicbosses.utils.Message; import com.songoda.epicbosses.utils.NumberUtils; import com.songoda.epicbosses.utils.panel.base.ClickAction; +import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.HashMap; @@ -40,11 +43,11 @@ public class Minions extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { - Map> map = new HashMap<>(); + public Map getOtherSkillData() { + Map map = new HashMap<>(); - map.put("amount", Integer.class); - map.put("minionToSpawn", String.class); + map.put("amount", 1); + map.put("minionToSpawn", ""); return map; } @@ -53,7 +56,8 @@ public class Minions extends CustomSkillHandler { public List getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) { List clickActions = new ArrayList<>(); -// clickActions.add(getAmountAction(skill, customSkillElement)); + clickActions.add(BossSkillManager.createCustomSkillAction("Amount Editor", getAmountCurrent(customSkillElement), new ItemStack(Material.REDSTONE), getAmountAction(skill, customSkillElement))); + clickActions.add(BossSkillManager.createCustomSkillAction("Minion to Spawn Editor", new ItemStack(Material.CREEPER_SPAWN_EGG), getMinionToSpawnAction(skill, customSkillElement))); return clickActions; } @@ -63,6 +67,16 @@ public class Minions extends CustomSkillHandler { BossAPI.spawnNewMinion(activeBossHolder, skill); } + private ClickAction getMinionToSpawnAction(Skill skill, CustomSkillElement customSkillElement) { + return event -> this.plugin.getBossPanelManager().getMinionSelectEditorMenu().openFor((Player) event.getWhoClicked(), skill, customSkillElement); + } + + private String getAmountCurrent(CustomSkillElement customSkillElement) { + CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData(); + + return ""+customMinionSkillElement.getAmount(); + } + private ClickAction getAmountAction(Skill skill, CustomSkillElement customSkillElement) { return event -> { CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Warp.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Warp.java index e34ec92..170ecbc 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Warp.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Warp.java @@ -24,7 +24,7 @@ public class Warp extends CustomSkillHandler { } @Override - public Map> getOtherSkillData() { + public Map getOtherSkillData() { return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillAction.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillAction.java index dfa253d..6710ee2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillAction.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillAction.java @@ -16,4 +16,5 @@ public interface ICustomSkillAction { ItemStack getDisplayItemStack(); + String getCurrent(); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillHandler.java index 7e370ee..2d8d945 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/interfaces/ICustomSkillHandler.java @@ -15,7 +15,7 @@ public interface ICustomSkillHandler extends ISkillHandler { boolean doesUseMultiplier(); - Map> getOtherSkillData(); + Map getOtherSkillData(); List getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement); diff --git a/pom.xml b/pom.xml index 5663c42..84e85a1 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ - 1.0.0-U133 + 1.0.0-U134 EpicBosses com.songoda.epicbosses.CustomBosses AMinecraftDev