mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-07 07:47:41 +01:00
fix skills
This commit is contained in:
parent
1621536206
commit
d8ee559047
@ -40,6 +40,8 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
||||
@Override
|
||||
public void fillPanel(Panel panel, Skill skill) {
|
||||
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
||||
if (commandSkillElement == null)
|
||||
commandSkillElement = new CommandSkillElement(new ArrayList<>());
|
||||
List<SubCommandSkillElement> subCommandSkillElements = commandSkillElement.getCommands();
|
||||
int maxPage = panel.getMaxPage(subCommandSkillElements);
|
||||
|
||||
@ -55,24 +57,22 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, Skill skill) {
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
|
||||
replaceMap.put("{name}", BossAPI.getSkillName(skill));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter counter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getMainSkillEditMenu(), skill);
|
||||
|
||||
ServerUtils.get().runTaskAsync(() -> {
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
|
||||
replaceMap.put("{name}", BossAPI.getSkillName(skill));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter counter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getMainSkillEditMenu(), skill);
|
||||
|
||||
ServerUtils.get().runTaskAsync(() -> {
|
||||
counter.getSlotsWith("AddNew").forEach(slot -> panel.setOnClick(slot, getAddNewAction(skill)));
|
||||
fillPanel(panel, skill);
|
||||
});
|
||||
|
||||
panel.openFor(player);
|
||||
counter.getSlotsWith("AddNew").forEach(slot -> panel.setOnClick(slot, getAddNewAction(skill)));
|
||||
fillPanel(panel, skill);
|
||||
});
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,7 +84,9 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
||||
return event -> {
|
||||
SubCommandSkillElement subCommandSkillElement = new SubCommandSkillElement(UUID.randomUUID().toString(), 100.0, new ArrayList<>());
|
||||
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
||||
|
||||
if (commandSkillElement == null)
|
||||
commandSkillElement = new CommandSkillElement(new ArrayList<>());
|
||||
|
||||
List<SubCommandSkillElement> subElements = commandSkillElement.getCommands();
|
||||
|
||||
subElements.add(subCommandSkillElement);
|
||||
|
@ -45,14 +45,17 @@ public class GroupSkillEditorPanel extends VariablePanelHandler<Skill> {
|
||||
@Override
|
||||
public void fillPanel(Panel panel, Skill skill) {
|
||||
GroupSkillElement groupSkillElement = this.plugin.getBossSkillManager().getGroupSkillElement(skill);
|
||||
if (groupSkillElement == null)
|
||||
groupSkillElement = new GroupSkillElement(new ArrayList<>());
|
||||
Map<String, Skill> skillMap = this.plugin.getSkillsFileManager().getSkillMap();
|
||||
List<String> entryList = new ArrayList<>(skillMap.keySet());
|
||||
int maxPage = panel.getMaxPage(entryList);
|
||||
|
||||
GroupSkillElement finalGroupSkillElement = groupSkillElement;
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, skill, groupSkillElement, skillMap, entryList);
|
||||
loadPage(panel, requestedPage, skill, finalGroupSkillElement, skillMap, entryList);
|
||||
return true;
|
||||
}));
|
||||
|
||||
|
@ -19,6 +19,7 @@ import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||
import com.songoda.epicbosses.utils.potion.PotionEffectConverter;
|
||||
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -56,13 +57,16 @@ public class PotionSkillEditorPanel extends VariablePanelHandler<Skill> {
|
||||
@Override
|
||||
public void fillPanel(Panel panel, Skill skill) {
|
||||
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
||||
if (potionSkillElement == null)
|
||||
potionSkillElement = new PotionSkillElement(new ArrayList<>());
|
||||
List<PotionEffectHolder> potionEffectHolders = potionSkillElement.getPotions();
|
||||
int maxPage = panel.getMaxPage(potionEffectHolders);
|
||||
|
||||
PotionSkillElement finalPotionSkillElement = potionSkillElement;
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, potionEffectHolders, potionSkillElement, skill);
|
||||
loadPage(panel, requestedPage, potionEffectHolders, finalPotionSkillElement, skill);
|
||||
return true;
|
||||
}));
|
||||
|
||||
|
@ -18,6 +18,7 @@ import com.songoda.epicbosses.utils.panel.base.handlers.SubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
@ -146,6 +147,8 @@ public class CreatePotionEffectEditorPanel extends SubVariablePanelHandler<Skill
|
||||
|
||||
if (duration != null && level != null && type != null && !type.isEmpty()) {
|
||||
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
||||
if (potionSkillElement == null)
|
||||
potionSkillElement = new PotionSkillElement(new ArrayList<>());
|
||||
PotionEffectFinder potionEffectFinder = PotionEffectFinder.getByName(type);
|
||||
|
||||
if (potionEffectFinder != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user