1.0.0-SNAPSHOT-U130

+ Begun the implementation of the extra settings menu
+ Fixed a few issues on the end of the config.yml
This commit is contained in:
Charles 2018-12-16 22:53:50 +08:00
parent 598a330dbc
commit e9980c982a
23 changed files with 429 additions and 54 deletions

View File

@ -166,4 +166,8 @@ Display:
name: '&bCustom Skill: &f{name}'
lore:
- '&3Uses Multiplier: &7{multiplier}'
- '&3Has Custom Data: &7{customData}'
- '&3Has Custom Data: &7{customData}'
Material:
menuName: '&b&lSelect Material'
selectedName: '&bMaterial: &f{type} &a** Selected **'
name: '&bMaterial: &f{type}'

View File

@ -27,6 +27,7 @@ import com.songoda.epicbosses.panel.skills.custom.GroupSkillEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.commands.CommandListSkillEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.commands.ModifyCommandEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.custom.CustomSkillTypeEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.potions.CreatePotionEffectEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.potions.PotionEffectTypeEditorPanel;
import com.songoda.epicbosses.panel.skills.custom.PotionSkillEditorPanel;
@ -163,6 +164,21 @@ public class BossPanelManager implements ILoadable, IReloadable {
return timesUsed;
}
//---------------------------------------------
//
// G E N E R A L L I S T P A N E L
//
//---------------------------------------------
public PanelBuilder getListMenu(String path) {
Map<String, String> replaceMap = new HashMap<>();
String finalPath = getPath(path);
String value = this.customBosses.getConfig().getString(finalPath);
replaceMap.put("{panelName}", StringUtils.get().translateColor(value));
return new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("ListPanel"), replaceMap);
}
//---------------------------------------------
//
@ -702,22 +718,6 @@ public class BossPanelManager implements ILoadable, IReloadable {
this.customItems.initializePanel(panelBuilder);
}
//---------------------------------------------
//
// G E N E R A L L I S T P A N E L
//
//---------------------------------------------
private PanelBuilder getListMenu(String path) {
Map<String, String> replaceMap = new HashMap<>();
String finalPath = getPath(path);
String value = this.customBosses.getConfig().getString(finalPath);
replaceMap.put("{panelName}", StringUtils.get().translateColor(value));
return new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("ListPanel"), replaceMap);
}
private String getPath(String key) {
return "Display." + key + ".menuName";
}

View File

@ -1,5 +1,6 @@
package com.songoda.epicbosses.managers;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.events.BossSkillEvent;
import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
@ -27,9 +28,15 @@ public class BossSkillManager implements ILoadable {
private static final Set<CustomSkillHandler> SKILLS = new HashSet<>();
private CustomBosses plugin;
public BossSkillManager(CustomBosses plugin) {
this.plugin = plugin;
}
@Override
public void load() {
registerCustomSkill(new Cage());
registerCustomSkill(new Cage(this.plugin));
registerCustomSkill(new Disarm());
registerCustomSkill(new Fireball());
registerCustomSkill(new Grapple());
@ -37,7 +44,7 @@ public class BossSkillManager implements ILoadable {
registerCustomSkill(new Knockback());
registerCustomSkill(new Launch());
registerCustomSkill(new Lightning());
registerCustomSkill(new Minions());
registerCustomSkill(new Minions(this.plugin));
registerCustomSkill(new Warp());
}

View File

@ -0,0 +1,9 @@
package com.songoda.epicbosses.panel.skills.custom.custom;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Dec-18
*/
public class CustomMinionSkillListEditorPanel {
}

View File

@ -0,0 +1,110 @@
package com.songoda.epicbosses.panel.skills.custom.custom;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.skills.Skill;
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;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.*;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Dec-18
*/
public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler<Skill, CustomSkillElement> {
private CustomBosses plugin;
public MaterialTypeEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.plugin = plugin;
}
public abstract void saveSetting(Skill skill, CustomSkillElement customSkillElement, String newValue);
public abstract String getCurrentSetting(CustomSkillElement customSkillElement);
public abstract IVariablePanelHandler<Skill> getParentHolder(Skill skill);
@Override
public void fillPanel(Panel panel, Skill skill, CustomSkillElement customSkillElement) {
List<Material> materials = Arrays.asList(Material.values());
List<Material> filteredList = getFilteredList(materials);
int maxPage = panel.getMaxPage(filteredList);
panel.setOnPageChange((player, currentPage, requestedPage) -> {
if(requestedPage < 0 || requestedPage > maxPage) return false;
loadPage(panel, requestedPage, materials, skill, customSkillElement);
return true;
});
loadPage(panel, 0, materials, skill, customSkillElement);
}
@Override
public void openFor(Player player, Skill skill, CustomSkillElement customSkillElement) {
Panel panel = getPanelBuilder().getPanel()
.setParentPanelHandler(getParentHolder(skill), skill);
fillPanel(panel, skill, customSkillElement);
panel.openFor(player);
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
}
private void loadPage(Panel panel, int page, List<Material> filteredList, Skill skill, CustomSkillElement customSkillElement) {
String current = getCurrentSetting(customSkillElement);
panel.loadPage(page, (slot, realisticSlot) -> {
if(slot >= filteredList.size()) {
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{});
} else {
Material material = filteredList.get(slot);
ItemStack itemStack = new ItemStack(material);
Map<String, String> replaceMap = new HashMap<>();
String name = material.name();
replaceMap.put("{type}", StringUtils.get().formatString(name));
if(current.equalsIgnoreCase(name)) {
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.Material.selectedName"), replaceMap);
} else {
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.Material.name"), replaceMap);
}
panel.setItem(realisticSlot, itemStack, event -> {
saveSetting(skill, customSkillElement, name);
loadPage(panel, page, filteredList, skill, customSkillElement);
});
}
});
}
private List<Material> getFilteredList(List<Material> masterList) {
List<Material> materials = new ArrayList<>();
masterList.forEach(material -> {
if(material.isItem()) {
materials.add(material);
}
});
return materials;
}
}

View File

@ -0,0 +1,52 @@
package com.songoda.epicbosses.panel.skills.custom.custom;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.managers.BossSkillManager;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.itemstack.ItemStackConverter;
import com.songoda.epicbosses.utils.panel.Panel;
import com.songoda.epicbosses.utils.panel.base.handlers.SubVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
import org.bukkit.entity.Player;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Dec-18
*/
public class SpecialSettingsEditorPanel extends SubVariablePanelHandler<Skill, CustomSkillElement> {
private ItemStackConverter itemStackConverter;
private BossSkillManager bossSkillManager;
private CustomBosses plugin;
public SpecialSettingsEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.plugin = plugin;
this.itemStackConverter = new ItemStackConverter();
this.bossSkillManager = plugin.getBossSkillManager();
}
@Override
public void openFor(Player player, Skill skill, CustomSkillElement customSkillElement) {
Panel panel = getPanelBuilder().getPanel()
.setParentPanelHandler(this.bossPanelManager.getCustomSkillEditorPanel(), skill);
fillPanel(panel, skill, customSkillElement);
panel.openFor(player);
}
@Override
public void fillPanel(Panel panel, Skill skill, CustomSkillElement customSkillElement) {
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
}
}

View File

@ -1,6 +1,9 @@
package com.songoda.epicbosses.skills;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import java.util.Map;
/**
* @author Charles Cullen
@ -9,6 +12,12 @@ import com.songoda.epicbosses.skills.types.CustomSkillElement;
*/
public interface ICustomSkillHandler extends ISkillHandler<CustomSkillElement> {
boolean doesUseMultiplier();
Map<String, Class<?>> getOtherSkillData();
Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement);
String getSkillName();
}

View File

@ -14,10 +14,6 @@ import java.util.Map;
*/
public interface ISkillHandler<T> {
boolean doesUseMultiplier();
Map<String, Class<?>> getOtherSkillData();
void castSkill(Skill skill, T t, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities);
}

View File

@ -1,6 +1,10 @@
package com.songoda.epicbosses.skills.custom;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.panel.skills.custom.custom.MaterialTypeEditorPanel;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.custom.cage.CageLocationData;
@ -10,11 +14,16 @@ import com.songoda.epicbosses.skills.types.CustomSkillElement;
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.Panel;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.*;
@ -30,6 +39,19 @@ public class Cage extends CustomSkillHandler {
@Getter private static final Map<Location, CageLocationData> cageLocationDataMap = new HashMap<>();
@Getter private static final List<UUID> playersInCage = new ArrayList<>();
private final MaterialTypeEditorPanel flatTypeEditor, wallTypeEditor, insideTypeEditor;
private BossPanelManager bossPanelManager;
private CustomBosses plugin;
public Cage(CustomBosses plugin) {
this.plugin = plugin;
this.bossPanelManager = plugin.getBossPanelManager();
this.flatTypeEditor = getFlatTypeEditor();
this.wallTypeEditor = getWallTypeEditor();
this.insideTypeEditor = getInsideTypeEditor();
}
@Override
public boolean doesUseMultiplier() {
return false;
@ -46,6 +68,17 @@ public class Cage extends CustomSkillHandler {
return map;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
Map<Integer, ClickAction> clickActionMap = new HashMap<>();
clickActionMap.put(1, event -> this.flatTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
clickActionMap.put(2, event -> this.wallTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
clickActionMap.put(3, event -> this.insideTypeEditor.openFor((Player) event.getWhoClicked(), skill, customSkillElement));
return clickActionMap;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
nearbyEntities.forEach(livingEntity -> {
@ -137,4 +170,77 @@ public class Cage extends CustomSkillHandler {
return currentLocation.clone().add(0.5, 0, 0.5);
}
private MaterialTypeEditorPanel getFlatTypeEditor() {
return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) {
@Override
public void saveSetting(Skill skill, CustomSkillElement customSkillElement, String newValue) {
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
customCageSkillElement.setFlatType(newValue);
customSkillElement.getCustom().setOtherSkillData(BossAPI.convertObjectToJsonObject(customCageSkillElement));
skill.setCustomData(BossAPI.convertObjectToJsonObject(customSkillElement));
Cage.this.plugin.getSkillsFileManager().save();
}
@Override
public String getCurrentSetting(CustomSkillElement customSkillElement) {
return customSkillElement.getCustom().getCustomCageSkillData().getFlatType();
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
}
};
}
private MaterialTypeEditorPanel getWallTypeEditor() {
return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) {
@Override
public void saveSetting(Skill skill, CustomSkillElement customSkillElement, String newValue) {
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
customCageSkillElement.setWallType(newValue);
customSkillElement.getCustom().setOtherSkillData(BossAPI.convertObjectToJsonObject(customCageSkillElement));
skill.setCustomData(BossAPI.convertObjectToJsonObject(customSkillElement));
Cage.this.plugin.getSkillsFileManager().save();
}
@Override
public String getCurrentSetting(CustomSkillElement customSkillElement) {
return customSkillElement.getCustom().getCustomCageSkillData().getWallType();
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
}
};
}
private MaterialTypeEditorPanel getInsideTypeEditor() {
return new MaterialTypeEditorPanel(this.bossPanelManager, this.bossPanelManager.getListMenu("Skills.Material"), this.plugin) {
@Override
public void saveSetting(Skill skill, CustomSkillElement customSkillElement, String newValue) {
CustomCageSkillElement customCageSkillElement = customSkillElement.getCustom().getCustomCageSkillData();
customCageSkillElement.setInsideType(newValue);
customSkillElement.getCustom().setOtherSkillData(BossAPI.convertObjectToJsonObject(customCageSkillElement));
skill.setCustomData(BossAPI.convertObjectToJsonObject(customSkillElement));
Cage.this.plugin.getSkillsFileManager().save();
}
@Override
public String getCurrentSetting(CustomSkillElement customSkillElement) {
return customSkillElement.getCustom().getCustomCageSkillData().getInsideType();
}
@Override
public IVariablePanelHandler<Skill> getParentHolder(Skill skill) {
return this.bossPanelManager.getCustomSkillEditorPanel();
}
};
}
}

View File

@ -7,6 +7,7 @@ import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.RandomUtils;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
@ -33,6 +34,11 @@ public class Disarm extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
nearbyEntities.forEach(livingEntity -> {

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
@ -27,6 +28,11 @@ public class Fireball extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
LivingEntity boss = activeBossHolder.getLivingEntity();

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
@ -28,6 +29,11 @@ public class Grapple extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
Location bossLocation = activeBossHolder.getLocation();

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.entity.LivingEntity;
import java.util.List;
@ -26,6 +27,11 @@ public class Insidious extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
Double multiplier = customSkillElement.getCustom().getMultiplier();

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
@ -28,6 +29,11 @@ public class Knockback extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
Double multiplier = customSkillElement.getCustom().getMultiplier();

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
@ -27,6 +28,11 @@ public class Launch extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
Location bossLocation = activeBossHolder.getLocation();

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.entity.LivingEntity;
import java.util.List;
@ -26,6 +27,11 @@ public class Lightning extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
nearbyEntities.forEach(livingEntity -> livingEntity.getWorld().strikeLightningEffect(livingEntity.getEyeLocation()));

View File

@ -1,11 +1,19 @@
package com.songoda.epicbosses.skills.custom;
import com.google.gson.JsonObject;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.elements.CustomMinionSkillElement;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.NumberUtils;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.HashMap;
import java.util.List;
@ -18,6 +26,12 @@ import java.util.Map;
*/
public class Minions extends CustomSkillHandler {
private CustomBosses plugin;
public Minions(CustomBosses plugin) {
this.plugin = plugin;
}
@Override
public boolean doesUseMultiplier() {
return false;
@ -33,8 +47,57 @@ public class Minions extends CustomSkillHandler {
return map;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
Map<Integer, ClickAction> clickActionMap = new HashMap<>();
clickActionMap.put(1, getAmountAction(skill, customSkillElement));
return clickActionMap;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
BossAPI.spawnNewMinion(activeBossHolder, skill);
}
private ClickAction getAmountAction(Skill skill, CustomSkillElement customSkillElement) {
return event -> {
CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData();
ClickType clickType = event.getClick();
Integer amountToModifyBy;
if(clickType.name().contains("RIGHT")) {
amountToModifyBy = -1;
} else {
amountToModifyBy = 1;
}
Integer currentAmount = customMinionSkillElement.getAmount();
String modifyValue;
Integer newAmount;
if(currentAmount == null) currentAmount = 0;
if(amountToModifyBy > 0.0) {
modifyValue = "increased";
newAmount = currentAmount + amountToModifyBy;
} else {
modifyValue = "decreased";
newAmount = currentAmount + amountToModifyBy;
}
if(newAmount <= 0) {
newAmount = 0;
}
customMinionSkillElement.setAmount(newAmount);
customSkillElement.getCustom().setOtherSkillData(BossAPI.convertObjectToJsonObject(customMinionSkillElement));
skill.setCustomData(BossAPI.convertObjectToJsonObject(customSkillElement));
this.plugin.getSkillsFileManager().save();
Message.Boss_Skills_SetMinionAmount.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble(newAmount));
};
}
}

View File

@ -4,6 +4,7 @@ import com.songoda.epicbosses.holder.ActiveBossHolder;
import com.songoda.epicbosses.skills.CustomSkillHandler;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.skills.types.CustomSkillElement;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import org.bukkit.entity.LivingEntity;
import java.util.List;
@ -26,6 +27,11 @@ public class Warp extends CustomSkillHandler {
return null;
}
@Override
public Map<Integer, ClickAction> getOtherSkillDataActions(Skill skill, CustomSkillElement customSkillElement) {
return null;
}
@Override
public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
LivingEntity target = nearbyEntities.get(0);

View File

@ -28,16 +28,6 @@ public class CommandSkillElement implements ISkillHandler<CommandSkillElement> {
this.commands = commandSkillElements;
}
@Override
public boolean doesUseMultiplier() {
return false;
}
@Override
public Map<String, Class<?>> getOtherSkillData() {
return null;
}
@Override
public void castSkill(Skill skill, CommandSkillElement commandSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
List<SubCommandSkillElement> commandSkillElements = getCommands();

View File

@ -28,16 +28,6 @@ public class GroupSkillElement implements ISkillHandler<GroupSkillElement> {
this.groupedSkills = groupedSkills;
}
@Override
public boolean doesUseMultiplier() {
return false;
}
@Override
public Map<String, Class<?>> getOtherSkillData() {
return null;
}
@Override
public void castSkill(Skill skill, GroupSkillElement groupSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
List<String> currentGroupedSkills = getGroupedSkills();

View File

@ -30,16 +30,6 @@ public class PotionSkillElement implements ISkillHandler<PotionSkillElement> {
this.potionEffectConverter = new PotionEffectConverter();
}
@Override
public boolean doesUseMultiplier() {
return false;
}
@Override
public Map<String, Class<?>> getOtherSkillData() {
return null;
}
@Override
public void castSkill(Skill skill, PotionSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List<LivingEntity> nearbyEntities) {
List<PotionEffectHolder> potionElements = getPotions();

View File

@ -163,6 +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_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

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