1.0.0-SNAPSHOT-U129

+ Optimized some of the custom skill handler code
+ Fixed a few issues regarding the CustomSkillEditorPanel
+ Fixed a few issues from the config.yml
This commit is contained in:
Charles 2018-12-16 21:20:42 +08:00
parent d63555d933
commit 598a330dbc
9 changed files with 30 additions and 14 deletions

View File

@ -165,6 +165,5 @@ Display:
selectedName: '&bCustom Skill: &f{name} &a** Selected **'
name: '&bCustom Skill: &f{name}'
lore:
- '&3Type: &7{type}'
- '&3Multiplier: &7{multiplier}'
- '&3Uses Multiplier: &7{multiplier}'
- '&3Has Custom Data: &7{customData}'

View File

@ -105,7 +105,7 @@ public abstract class SingleMessageListEditor<T> extends VariablePanelHandler<T>
replaceMap.put("{name}", name);
if(current.equalsIgnoreCase(name)) {
if(current != null && current.equalsIgnoreCase(name)) {
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Boss.Text.selectedName"), replaceMap);
} else {
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Boss.Text.name"), replaceMap);

View File

@ -94,7 +94,7 @@ public class MainSkillEditorPanel extends VariablePanelHandler<Skill> {
} else if(type.equalsIgnoreCase("GROUP")) {
this.bossPanelManager.getGroupSkillEditorPanel().openFor(player, skill);
} else if(type.equalsIgnoreCase("CUSTOM")) {
this.bossPanelManager.getCustomMessageEditMenu().openFor(player, skill);
this.bossPanelManager.getCustomSkillEditorPanel().openFor(player, skill);
} else if(type.equalsIgnoreCase("COMMAND")) {
this.bossPanelManager.getCommandSkillEditorPanel().openFor(player, skill);
}

View File

@ -44,12 +44,16 @@ public class CustomSkillEditorPanel extends VariablePanelHandler<Skill> {
public void openFor(Player player, Skill skill) {
Map<String, String> replaceMap = new HashMap<>();
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
CustomSkillElement customSkillElement = this.bossSkillManager.getCustomSkillElement(skill);
Double multiplier = customSkillElement.getCustom().getMultiplier();
String multiplierValue = multiplier == null? "N/A" : NumberUtils.get().formatDouble(multiplier);
replaceMap.put("{name}", BossAPI.getSkillName(skill));
replaceMap.put("{type}", customSkillElement.getCustom().getType());
replaceMap.put("{multiplier}", multiplierValue);
panelBuilder.addReplaceData(replaceMap);
PanelBuilderCounter counter = panelBuilder.getPanelBuilderCounter();
CustomSkillElement customSkillElement = this.bossSkillManager.getCustomSkillElement(skill);
Panel panel = panelBuilder.getPanel()
.setParentPanelHandler(this.bossPanelManager.getMainSkillEditMenu(), skill);
@ -105,8 +109,9 @@ public class CustomSkillEditorPanel extends VariablePanelHandler<Skill> {
}
if(newAmount != null) {
if(newAmount < 0.0) {
newAmount = 1.0;
if(newAmount <= 0.0) {
newAmount = null;
modifyValue = "removed";
}
}
@ -117,6 +122,8 @@ public class CustomSkillEditorPanel extends VariablePanelHandler<Skill> {
skill.setCustomData(jsonObject);
this.skillsFileManager.save();
Message.Boss_Skills_SetMultiplier.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble((newAmount == null? 0.0 : newAmount)));
openFor((Player) event.getWhoClicked(), skill);
};
}
}

View File

@ -86,7 +86,7 @@ public class CustomSkillTypeEditorPanel extends SubVariablePanelHandler<Skill, C
CustomSkillHandler customSkillHandler = customSkillHandlers.get(slot);
String name = customSkillHandler.getSkillName();
Map<String, String> replaceMap = new HashMap<>();
String hasCustomData = customSkillHandler.getOtherSkillData().isEmpty()? "false" : "true";
String hasCustomData = customSkillHandler.getOtherSkillData() == null? "false" : customSkillHandler.getOtherSkillData().isEmpty()? "false" : "true";
replaceMap.put("{name}", name);
replaceMap.put("{multiplier}", ""+customSkillHandler.doesUseMultiplier());

View File

@ -1,13 +1,11 @@
package com.songoda.epicbosses.skills;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 18-Nov-18
*/
public abstract class CustomSkillHandler implements ISkillHandler<CustomSkillElement> {
public abstract class CustomSkillHandler implements ICustomSkillHandler {
@Override
public String getSkillName() {

View File

@ -0,0 +1,14 @@
package com.songoda.epicbosses.skills;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Dec-18
*/
public interface ICustomSkillHandler extends ISkillHandler<CustomSkillElement> {
String getSkillName();
}

View File

@ -14,8 +14,6 @@ import java.util.Map;
*/
public interface ISkillHandler<T> {
String getSkillName();
boolean doesUseMultiplier();
Map<String, Class<?>> getOtherSkillData();

View File

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