1.0.0-SNAPSHOT-U136

+ Fixed issues with packages not lining up
+ Fixed issues with errors on menu usage
+ Fully loaded and tested everything up to this point
This commit is contained in:
Charles 2018-12-23 01:22:00 +08:00
parent d67b798491
commit 44668e297f
7 changed files with 37 additions and 23 deletions

View File

@ -7,6 +7,7 @@ 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;
@ -35,7 +36,7 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler<Sk
public abstract String getCurrentSetting(CustomSkillElement customSkillElement);
public abstract IVariablePanelHandler<Skill> getParentHolder(Skill skill);
public abstract ISubVariablePanelHandler<Skill, CustomSkillElement> getParentHolder();
@Override
public void fillPanel(Panel panel, Skill skill, CustomSkillElement customSkillElement) {
@ -46,17 +47,17 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler<Sk
panel.setOnPageChange((player, currentPage, requestedPage) -> {
if(requestedPage < 0 || requestedPage > maxPage) return false;
loadPage(panel, requestedPage, materials, skill, customSkillElement);
loadPage(panel, requestedPage, filteredList, skill, customSkillElement);
return true;
});
loadPage(panel, 0, materials, skill, customSkillElement);
loadPage(panel, 0, filteredList, skill, customSkillElement);
}
@Override
public void openFor(Player player, Skill skill, CustomSkillElement customSkillElement) {
Panel panel = getPanelBuilder().getPanel()
.setParentPanelHandler(getParentHolder(skill), skill);
.setParentPanelHandler(getParentHolder(), skill, customSkillElement);
fillPanel(panel, skill, customSkillElement);
panel.openFor(player);
@ -77,6 +78,9 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler<Sk
Material material = filteredList.get(slot);
ItemStack itemStack = new ItemStack(material);
Map<String, String> replaceMap = new HashMap<>();
if(itemStack.getType() == Material.AIR) return;
String name = material.name();
replaceMap.put("{type}", StringUtils.get().formatString(name));
@ -99,7 +103,7 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler<Sk
List<Material> materials = new ArrayList<>();
masterList.forEach(material -> {
if(material.isItem()) {
if(material.isBlock() && material.isSolid() && material.isOccluding()) {
materials.add(material);
}
});

View File

@ -1,6 +1,7 @@
package com.songoda.epicbosses.panel.skills.custom.custom;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.managers.BossSkillManager;
import com.songoda.epicbosses.skills.CustomSkillHandler;
@ -40,7 +41,14 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler<Skill, C
@Override
public void openFor(Player player, Skill skill, CustomSkillElement customSkillElement) {
Panel panel = getPanelBuilder().getPanel()
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
Map<String, String> replaceMap = new HashMap<>();
replaceMap.put("{name}", BossAPI.getSkillName(skill));
replaceMap.put("{selected}", customSkillElement.getCustom().getType());
panelBuilder.addReplaceData(replaceMap);
Panel panel = panelBuilder.getPanel()
.setParentPanelHandler(this.bossPanelManager.getCustomSkillEditorPanel(), skill);
fillPanel(panel, skill, customSkillElement);
@ -59,10 +67,11 @@ 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;
int maxPage = panel.getMaxPage(customButtons);
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
if(requestedPage < 0 || requestedPage > maxPage) return false;
@ -95,13 +104,12 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler<Skill, C
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);
if(displayStack == null || displayStack.getType() == Material.AIR) return;
panel.setItem(realisticSlot, displayStack, event -> {
clickAction.onClick(event);
loadPage(panel, page, clickActions);
});
ItemStackUtils.applyDisplayName(displayStack, this.plugin.getConfig().getString("Display.Skills.CustomSetting.name"), replaceMap);
ItemStackUtils.applyDisplayLore(displayStack, this.plugin.getConfig().getStringList("Display.Skills.CustomSetting.lore"), replaceMap);
panel.setItem(realisticSlot, displayStack, clickAction);
}
}));
}

View File

@ -17,7 +17,7 @@ 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 com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.Material;
@ -200,8 +200,8 @@ public class Cage extends CustomSkillHandler {
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
public ISubVariablePanelHandler<Skill, CustomSkillElement> getParentHolder() {
return this.bossPanelManager.getSpecialSettingsEditorMenu();
}
};
}
@ -230,8 +230,8 @@ public class Cage extends CustomSkillHandler {
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
public ISubVariablePanelHandler<Skill, CustomSkillElement> getParentHolder() {
return this.bossPanelManager.getSpecialSettingsEditorMenu();
}
};
}
@ -260,8 +260,8 @@ public class Cage extends CustomSkillHandler {
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
public ISubVariablePanelHandler<Skill, CustomSkillElement> getParentHolder() {
return this.bossPanelManager.getSpecialSettingsEditorMenu();
}
};
}

View File

@ -24,7 +24,7 @@ public class Insidious extends CustomSkillHandler {
}
@Override
public Map<String, Class<?>> getOtherSkillData() {
public Map<String, Object> getOtherSkillData() {
return null;
}

View File

@ -163,7 +163,7 @@ public enum Message {
Boss_Skills_SetDisplayName("&b&lEpicBosses &8» &7Your next input in to chat will be the display name for the skill. If you enter &f-&7 it will remove/clear the display name of the skill. For color codes use the &f& &7sign."),
Boss_Skills_NotCompleteEnough("&c&l(!) &cThe potion effect was unable to be created due to it not having enough information. Please make sure that the potion effect type is selected."),
Boss_Skills_SetCommandChance("&b&lEpicBosses &8» &7You have {0} the chance for the command skill to &f{1}%&7."),
Boss_Skills_SetMinionAmount("&b&lEpicBosses &8» &&You have {0} the amount of minions to spawn from this skill to &f{1}&7."),
Boss_Skills_SetMinionAmount("&b&lEpicBosses &8» &7You have {0} the amount of minions to spawn from this skill to &f{1}&7."),
Boss_Spawn_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_Spawn_InvalidArgs("&c&l(!) &cYou must use &n/boss spawn [name] (location)&c to spawn a boss."),

View File

@ -198,6 +198,8 @@ public class ItemStackUtils {
}
}
if(itemMeta == null) return;
itemMeta.setDisplayName(StringUtils.get().translateColor(name));
itemStack.setItemMeta(itemMeta);
}

View File

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