1.0.0-SNAPSHOT-U105

+ Fixed issues with PotionSkillEditor panel not loading properly
+ Fixed issue with GUN_POWDER in editor.yml
This commit is contained in:
Charles 2018-12-02 21:15:41 +08:00
parent b56dc45cf1
commit 4b54e5d387
4 changed files with 38 additions and 8 deletions

View File

@ -125,4 +125,11 @@ Display:
- '&7'
- '&7Click to edit the custom skill.'
MainEdit:
menuName: '&b&l{name} Skill Editor'
menuName: '&b&l{name} Skill Editor'
Potions:
name: '&b&l{effect} Potion Effect'
lore:
- '&3Duration: &7{duration}'
- '&3Level: &7{level}'
- '&7'
- '&7Click to remove potion effect.'

View File

@ -74,12 +74,12 @@ MainMenu:
name: '&b&lCustom Skills'
lore:
- '&3Left Click »'
- '&fEdit any of the already created'
- '&fcustom skills.'
- '&7Edit any of the already created'
- '&7custom skills.'
- '&7'
- '&3Right Click »'
- '&fCreate a new custom skill from'
- '&fscratch.'
- '&7Create a new custom skill from'
- '&7scratch.'
Button: CustomSkills
ListPanel:
name: '{panelName}'
@ -1347,7 +1347,7 @@ SkillEditorPanel:
- '&7sure it stands out and is unique, or not.'
Button: DisplayName
'14':
type: GUN_POWDER
type: GUNPOWDER
name: '&e&lType'
lore:
- '&bCurrently: &f{type}'
@ -1434,6 +1434,7 @@ PotionSkillEditorPanel:
slots: 54
Settings:
backButton: true
fillTo: 45
Buttons:
backButton: 54
Items:

View File

@ -7,17 +7,24 @@ import com.songoda.epicbosses.managers.BossSkillManager;
import com.songoda.epicbosses.managers.files.SkillsFileManager;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.PotionSkillElement;
import com.songoda.epicbosses.utils.NumberUtils;
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.handlers.VariablePanelHandler;
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 org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import java.util.HashMap;
import java.util.List;
@ -33,10 +40,12 @@ public class PotionSkillEditorPanel extends VariablePanelHandler<Skill> {
private PotionEffectConverter potionEffectConverter;
private SkillsFileManager skillsFileManager;
private BossSkillManager bossSkillManager;
private CustomBosses plugin;
public PotionSkillEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.plugin = plugin;
this.bossSkillManager = plugin.getBossSkillManager();
this.skillsFileManager = plugin.getSkillsFileManager();
this.potionEffectConverter = new PotionEffectConverter();
@ -74,8 +83,8 @@ public class PotionSkillEditorPanel extends VariablePanelHandler<Skill> {
.setCancelLowerClick(true)
.setParentPanelHandler(this.bossPanelManager.getMainSkillEditMenu(), skill);
fillPanel(panel, skill);
counter.getSlotsWith("PotionEffect").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getCreatePotionEffectMenu().openFor((Player) event.getWhoClicked(), skill, potionSkillElement)));
fillPanel(panel, skill);
panel.openFor(player);
}
@ -98,10 +107,23 @@ public class PotionSkillEditorPanel extends VariablePanelHandler<Skill> {
ItemStack itemStack = new ItemStack(Material.POTION);
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
PotionType potionType = PotionType.getByEffect(PotionEffectType.BLINDNESS);
if(potionType == null) potionType = PotionType.WATER;
potionMeta.addCustomEffect(potionEffect, true);
potionMeta.setBasePotionData(new PotionData(potionType));
itemStack.setItemMeta(potionMeta);
Map<String, String> replaceMap = new HashMap<>();
replaceMap.put("{effect}", StringUtils.get().formatString(potionEffect.getType().getName()));
replaceMap.put("{level}", NumberUtils.get().formatDouble(potionEffectHolder.getLevel()));
replaceMap.put("{duration}", NumberUtils.get().formatDouble(potionEffectHolder.getDuration()));
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.Skills.Potions.lore"), replaceMap);
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.Potions.name"), replaceMap);
panel.setItem(realisticSlot, itemStack, e -> {
potionEffectHolders.remove(potionEffectHolder);
potionSkillElement.setPotions(potionEffectHolders);

View File

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