mirror of
https://github.com/songoda/EpicBosses.git
synced 2024-09-28 21:37:33 +02:00
fix skills
This commit is contained in:
parent
1621536206
commit
d8ee559047
@ -40,6 +40,8 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
@Override
|
@Override
|
||||||
public void fillPanel(Panel panel, Skill skill) {
|
public void fillPanel(Panel panel, Skill skill) {
|
||||||
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
||||||
|
if (commandSkillElement == null)
|
||||||
|
commandSkillElement = new CommandSkillElement(new ArrayList<>());
|
||||||
List<SubCommandSkillElement> subCommandSkillElements = commandSkillElement.getCommands();
|
List<SubCommandSkillElement> subCommandSkillElements = commandSkillElement.getCommands();
|
||||||
int maxPage = panel.getMaxPage(subCommandSkillElements);
|
int maxPage = panel.getMaxPage(subCommandSkillElements);
|
||||||
|
|
||||||
@ -55,7 +57,6 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openFor(Player player, Skill skill) {
|
public void openFor(Player player, Skill skill) {
|
||||||
ServerUtils.get().runTaskAsync(() -> {
|
|
||||||
Map<String, String> replaceMap = new HashMap<>();
|
Map<String, String> replaceMap = new HashMap<>();
|
||||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||||
|
|
||||||
@ -72,7 +73,6 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
panel.openFor(player);
|
panel.openFor(player);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,6 +84,8 @@ public class CommandSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
return event -> {
|
return event -> {
|
||||||
SubCommandSkillElement subCommandSkillElement = new SubCommandSkillElement(UUID.randomUUID().toString(), 100.0, new ArrayList<>());
|
SubCommandSkillElement subCommandSkillElement = new SubCommandSkillElement(UUID.randomUUID().toString(), 100.0, new ArrayList<>());
|
||||||
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
CommandSkillElement commandSkillElement = this.plugin.getBossSkillManager().getCommandSkillElement(skill);
|
||||||
|
if (commandSkillElement == null)
|
||||||
|
commandSkillElement = new CommandSkillElement(new ArrayList<>());
|
||||||
|
|
||||||
List<SubCommandSkillElement> subElements = commandSkillElement.getCommands();
|
List<SubCommandSkillElement> subElements = commandSkillElement.getCommands();
|
||||||
|
|
||||||
|
@ -45,14 +45,17 @@ public class GroupSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
@Override
|
@Override
|
||||||
public void fillPanel(Panel panel, Skill skill) {
|
public void fillPanel(Panel panel, Skill skill) {
|
||||||
GroupSkillElement groupSkillElement = this.plugin.getBossSkillManager().getGroupSkillElement(skill);
|
GroupSkillElement groupSkillElement = this.plugin.getBossSkillManager().getGroupSkillElement(skill);
|
||||||
|
if (groupSkillElement == null)
|
||||||
|
groupSkillElement = new GroupSkillElement(new ArrayList<>());
|
||||||
Map<String, Skill> skillMap = this.plugin.getSkillsFileManager().getSkillMap();
|
Map<String, Skill> skillMap = this.plugin.getSkillsFileManager().getSkillMap();
|
||||||
List<String> entryList = new ArrayList<>(skillMap.keySet());
|
List<String> entryList = new ArrayList<>(skillMap.keySet());
|
||||||
int maxPage = panel.getMaxPage(entryList);
|
int maxPage = panel.getMaxPage(entryList);
|
||||||
|
|
||||||
|
GroupSkillElement finalGroupSkillElement = groupSkillElement;
|
||||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||||
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
||||||
|
|
||||||
loadPage(panel, requestedPage, skill, groupSkillElement, skillMap, entryList);
|
loadPage(panel, requestedPage, skill, finalGroupSkillElement, skillMap, entryList);
|
||||||
return true;
|
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.panel.builder.PanelBuilderCounter;
|
||||||
import com.songoda.epicbosses.utils.potion.PotionEffectConverter;
|
import com.songoda.epicbosses.utils.potion.PotionEffectConverter;
|
||||||
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
||||||
|
import java.util.ArrayList;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -56,13 +57,16 @@ public class PotionSkillEditorPanel extends VariablePanelHandler<Skill> {
|
|||||||
@Override
|
@Override
|
||||||
public void fillPanel(Panel panel, Skill skill) {
|
public void fillPanel(Panel panel, Skill skill) {
|
||||||
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
||||||
|
if (potionSkillElement == null)
|
||||||
|
potionSkillElement = new PotionSkillElement(new ArrayList<>());
|
||||||
List<PotionEffectHolder> potionEffectHolders = potionSkillElement.getPotions();
|
List<PotionEffectHolder> potionEffectHolders = potionSkillElement.getPotions();
|
||||||
int maxPage = panel.getMaxPage(potionEffectHolders);
|
int maxPage = panel.getMaxPage(potionEffectHolders);
|
||||||
|
|
||||||
|
PotionSkillElement finalPotionSkillElement = potionSkillElement;
|
||||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||||
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
if (requestedPage < 0 || requestedPage > maxPage) return false;
|
||||||
|
|
||||||
loadPage(panel, requestedPage, potionEffectHolders, potionSkillElement, skill);
|
loadPage(panel, requestedPage, potionEffectHolders, finalPotionSkillElement, skill);
|
||||||
return true;
|
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.PanelBuilder;
|
||||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||||
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder;
|
||||||
|
import java.util.ArrayList;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
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()) {
|
if (duration != null && level != null && type != null && !type.isEmpty()) {
|
||||||
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
PotionSkillElement potionSkillElement = this.bossSkillManager.getPotionSkillElement(skill);
|
||||||
|
if (potionSkillElement == null)
|
||||||
|
potionSkillElement = new PotionSkillElement(new ArrayList<>());
|
||||||
PotionEffectFinder potionEffectFinder = PotionEffectFinder.getByName(type);
|
PotionEffectFinder potionEffectFinder = PotionEffectFinder.getByName(type);
|
||||||
|
|
||||||
if (potionEffectFinder != null) {
|
if (potionEffectFinder != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user