From d67b7984917ae4147ca96b2c16b9e09ae35b0a40 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 23 Dec 2018 00:22:39 +0800 Subject: [PATCH] 1.0.0-SNAPSHOT-U135 + Completed the implementation of the CustomSkill editing panels and configuration --- TODO | 1 - .../custom/SpecialSettingsEditorPanel.java | 37 ++++++++++++------- .../epicbosses/skills/custom/Cage.java | 24 ++++++++++-- .../epicbosses/skills/custom/Minions.java | 8 +++- pom.xml | 2 +- 5 files changed, 53 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index e6fa331..7e34f4a 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -02:00 -> Add the Custom Skill Editing GUIs 00:30 -> Add the new Skill aspect (via command) (30mins) 03:00 -> Add the DropTable Main Editing GUI (Will have buttons for DropType and Rewards) (3hrs) 01:00 -> Add the DropTable Rewards Editing GUI (1hr) 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 72cbded..4093d4c 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 @@ -1,18 +1,13 @@ 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; import com.songoda.epicbosses.skills.types.CustomSkillElement; import com.songoda.epicbosses.utils.Debug; -import com.songoda.epicbosses.utils.itemstack.ItemStackConverter; import com.songoda.epicbosses.utils.itemstack.ItemStackUtils; import com.songoda.epicbosses.utils.panel.Panel; import com.songoda.epicbosses.utils.panel.base.ClickAction; @@ -33,8 +28,6 @@ import java.util.Map; */ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler { - private ItemStackConverter itemStackConverter; - private MinionsFileManager minionsFileManager; private BossSkillManager bossSkillManager; private CustomBosses plugin; @@ -42,9 +35,7 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler customButtons = customSkillHandler.getOtherSkillDataActions(skill, customSkillElement); + int maxPage = panel.getMaxPage(customButtons); if(customButtons == null || customButtons.isEmpty()) return; - loadPage(panel, 0, skill, customSkillElement, customSkillHandler, customButtons); + panel.setOnPageChange(((player, currentPage, requestedPage) -> { + if(requestedPage < 0 || requestedPage > maxPage) return false; + + loadPage(panel, requestedPage, customButtons); + return true; + })); + + + loadPage(panel, 0, customButtons); } @Override @@ -79,7 +79,7 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler clickActions) { + private void loadPage(Panel panel, int page, List clickActions) { panel.loadPage(page, ((slot, realisticSlot) -> { if(slot >= clickActions.size()) { panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); @@ -87,10 +87,21 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler replaceMap = new HashMap<>(); + replaceMap.put("{setting}", name); + replaceMap.put("{currently}", currently); + + ItemStackUtils.applyDisplayName(displayStack, this.plugin.getConfig().getString("Display.Skills.CustomSettings.name"), replaceMap); + ItemStackUtils.applyDisplayLore(displayStack, this.plugin.getConfig().getStringList("Display.Skills.CustomSettings.lore"), replaceMap); + + panel.setItem(realisticSlot, displayStack, event -> { + clickAction.onClick(event); + loadPage(panel, page, clickActions); + }); } })); } 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 fb50e39..e5b5d8e 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 @@ -77,9 +77,9 @@ public class Cage extends CustomSkillHandler { 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", clickStack.clone(), flatAction)); - clickActions.add(BossSkillManager.createCustomSkillAction("Wall Type Editor", clickStack.clone(), wallAction)); - clickActions.add(BossSkillManager.createCustomSkillAction("Inside Type Editor", clickStack.clone(), insideAction)); + clickActions.add(BossSkillManager.createCustomSkillAction("Flat Type Editor", getFlatTypeCurrent(customSkillElement), clickStack.clone(), flatAction)); + clickActions.add(BossSkillManager.createCustomSkillAction("Wall Type Editor", getWallTypeCurrent(customSkillElement), clickStack.clone(), wallAction)); + clickActions.add(BossSkillManager.createCustomSkillAction("Inside Type Editor", getInsideTypeCurrent(customSkillElement), clickStack.clone(), insideAction)); return clickActions; } @@ -176,6 +176,12 @@ public class Cage extends CustomSkillHandler { return currentLocation.clone().add(0.5, 0, 0.5); } + private String getFlatTypeCurrent(CustomSkillElement customSkillElement) { + CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData(); + + return customCageSkillElement.getFlatType(); + } + private MaterialTypeEditorPanel getFlatTypeEditor() { return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) { @Override @@ -200,6 +206,12 @@ public class Cage extends CustomSkillHandler { }; } + private String getWallTypeCurrent(CustomSkillElement customSkillElement) { + CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData(); + + return customCageSkillElement.getWallType(); + } + private MaterialTypeEditorPanel getWallTypeEditor() { return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) { @Override @@ -224,6 +236,12 @@ public class Cage extends CustomSkillHandler { }; } + private String getInsideTypeCurrent(CustomSkillElement customSkillElement) { + CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData(); + + return customCageSkillElement.getInsideType(); + } + private MaterialTypeEditorPanel getInsideTypeEditor() { return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) { @Override 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 3205cb2..39a90d6 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 @@ -57,7 +57,7 @@ public class Minions extends CustomSkillHandler { List clickActions = new ArrayList<>(); 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))); + clickActions.add(BossSkillManager.createCustomSkillAction("Minion to Spawn Editor", getMinionToSpawnCurrent(customSkillElement), new ItemStack(Material.CREEPER_SPAWN_EGG), getMinionToSpawnAction(skill, customSkillElement))); return clickActions; } @@ -67,6 +67,12 @@ public class Minions extends CustomSkillHandler { BossAPI.spawnNewMinion(activeBossHolder, skill); } + private String getMinionToSpawnCurrent(CustomSkillElement customSkillElement) { + CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData(); + + return customMinionSkillElement.getMinionToSpawn(); + } + private ClickAction getMinionToSpawnAction(Skill skill, CustomSkillElement customSkillElement) { return event -> this.plugin.getBossPanelManager().getMinionSelectEditorMenu().openFor((Player) event.getWhoClicked(), skill, customSkillElement); } diff --git a/pom.xml b/pom.xml index 84e85a1..57338de 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ - 1.0.0-U134 + 1.0.0-U135 EpicBosses com.songoda.epicbosses.CustomBosses AMinecraftDev