1.0.0-SNAPSHOT-U135

+ Completed the implementation of the CustomSkill editing panels and configuration
This commit is contained in:
Charles 2018-12-23 00:22:39 +08:00
parent 50b7c82433
commit d67b798491
5 changed files with 53 additions and 19 deletions

1
TODO
View File

@ -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)

View File

@ -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<Skill, CustomSkillElement> {
private ItemStackConverter itemStackConverter;
private MinionsFileManager minionsFileManager;
private BossSkillManager bossSkillManager;
private CustomBosses plugin;
@ -42,9 +35,7 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler<Skill, C
super(bossPanelManager, panelBuilder);
this.plugin = plugin;
this.itemStackConverter = new ItemStackConverter();
this.bossSkillManager = plugin.getBossSkillManager();
this.minionsFileManager = plugin.getMinionsFileManager();
}
@Override
@ -68,10 +59,19 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler<Skill, C
}
List<ICustomSkillAction> 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<Skill, C
}
private void loadPage(Panel panel, int page, Skill skill, CustomSkillElement customSkillElement, CustomSkillHandler customSkillHandler, List<ICustomSkillAction> clickActions) {
private void loadPage(Panel panel, int page, List<ICustomSkillAction> 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<Skill, C
ICustomSkillAction customSkillAction = clickActions.get(slot);
ClickAction clickAction = customSkillAction.getAction();
String name = customSkillAction.getSettingName();
ItemStack displayStack = customSkillAction.getDisplayItemStack();
ItemStack displayStack = customSkillAction.getDisplayItemStack().clone();
String currently = customSkillAction.getCurrent();
Map<String, String> 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);
});
}
}));
}

View File

@ -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

View File

@ -57,7 +57,7 @@ public class Minions extends CustomSkillHandler {
List<ICustomSkillAction> 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);
}

View File

@ -20,7 +20,7 @@
<properties>
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
<plugin.version>1.0.0-U134</plugin.version>
<plugin.version>1.0.0-U135</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>