1.0.0-SNAPSHOT-U97

+ Begun working on SkillEditor
+ Cleaned up the BossPanelManager a bit
+ Added SkillEditorPanel in to editor.yml
This commit is contained in:
Charles 2018-12-02 00:44:08 +08:00
parent 4ac986d363
commit e5ebefd52e
9 changed files with 203 additions and 10 deletions

View File

@ -1276,3 +1276,83 @@ TauntEditorPanel:
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
SkillEditorPanel:
name: '&b&l{name} Skill Editor'
slots: 18
Settings:
emptySpaceFiller: true
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Items:
'2':
type: BOOK
name: '&e&lCustom Message'
lore:
- '&7Click here to change the custom message'
- '&7assigned to the skill. This will override'
- '&7the master message assigned to the boss when'
- '&7this skill is called.'
- '&7'
- '&bCurrently: &f{customMessage}'
- '&7'
- '&7To remove this message simply right click'
- '&7and it will then remove this and go back'
- '&7to using the master message assigned to the'
- '&7boss.'
Button: CustomMessage
'3':
type: REDSTONE
name: '&e&lRadius'
lore:
- '&7Here you can change the radius that the skill'
- '&7will see be called to within. It is currently'
- '&7set to &f{radius} blocks.'
- '&7'
- '&bLeft Click &8» &f+1'
- '&bShift Left-Click &8» &f+10'
- '&7'
- '&bRight Click &8» &f-1'
- '&bShift Right-Click &8» &f-10'
Button: Radius
'5':
type: DIAMOND
name: '&e&lCustom Data'
lore:
- '&7Click here to edit the custom data related'
- '&7to this skill. If it is a Potion skill you'
- '&7can modify the potions, etc. etc.'
Button: CustomData
'7':
type: TORCH
name: '&e&lMode'
lore:
- '&bCurrently: &f{mode}'
- '&7'
- '&7Click here to change the mode of the custom'
- '&7skill. It will cycle between all different'
- '&7types so when you find the right mode you can'
- '&7leave it and it will automatically save to'
- '&7that mode.'
Button: Mode
'8':
type: PAPER
name: '&e&lDisplay Name'
lore:
- '&bCurrently: &f{displayName}'
- '&7'
- '&7This is the skill display name. It is used'
- '&7in many things, from the in-game display of'
- '&7the skill, to the debug messages. So make'
- '&7sure it stands out and is unique, or not.'
Button: DisplayName
'14':
type: GUN_POWDER
name: '&e&lType'
lore:
- '&bCurrently: &f{type}'
- '&7Click this to change the skill type. Keep'
- '&7in mind that when you change your skill'
- '&7type the previous custom data will be erased'
- '&7to make room for the new custom data.'
Button: Type

View File

@ -148,6 +148,21 @@ public class BossAPI {
return null;
}
/**
* Used to get the Skill configuration section
* name from a Skill instance.
*
* @param skill - the skill instance
* @return name of the skill from the SkillsFileManager or null if not found.
*/
public static String getSkillName(Skill skill) {
for(Map.Entry<String, Skill> entry : PLUGIN.getSkillsFileManager().getSkillMap().entrySet()) {
if(entry.getValue().equals(skill)) return entry.getKey();
}
return null;
}
/**
* Used to get the Minion configuration section name
* from a MinionEntity instance.

View File

@ -1,5 +1,8 @@
package com.songoda.epicbosses.commands.boss;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.container.BossEntityContainer;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.Permission;
@ -14,12 +17,14 @@ import org.bukkit.entity.Player;
*/
public class BossEditCmd extends SubCommand {
private BossEntityContainer bossEntityContainer;
private BossPanelManager bossPanelManager;
public BossEditCmd(BossPanelManager bossPanelManager) {
public BossEditCmd(BossPanelManager bossPanelManager, BossEntityContainer bossEntityContainer) {
super("edit");
this.bossPanelManager = bossPanelManager;
this.bossEntityContainer = bossEntityContainer;
}
@Override
@ -42,7 +47,16 @@ public class BossEditCmd extends SubCommand {
this.bossPanelManager.getBosses().openFor(player);
break;
case 2:
//TODO: Open specific boss editing menu
String input = args[1];
if(!this.bossEntityContainer.exists(input)) {
Message.Boss_Edit_DoesntExist.msg(sender);
return;
}
BossEntity bossEntity = this.bossEntityContainer.getData().get(input);
this.bossPanelManager.getMainBossEditMenu().openFor(player, bossEntity);
break;
}
}

View File

@ -16,7 +16,7 @@ import org.bukkit.command.CommandSender;
* @since 19-Nov-18
*
* boss new droptable [name] [type]
* boss new skill [name]
* boss new skill [name] [type] [mode]
*/
public class BossNewCmd extends SubCommand {

View File

@ -18,6 +18,7 @@ import com.songoda.epicbosses.panel.bosses.text.*;
import com.songoda.epicbosses.panel.bosses.weapons.MainHandEditorPanel;
import com.songoda.epicbosses.panel.bosses.weapons.OffHandEditorPanel;
import com.songoda.epicbosses.panel.handlers.*;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
import lombok.Getter;
@ -56,6 +57,8 @@ public class BossPanelManager implements ILoadable, IReloadable {
onTauntTextEditMenu;
@Getter private BossListEditorPanel equipmentListEditMenu, weaponListEditMenu, statisticListEditMenu;
@Getter private IVariablePanelHandler<Skill> mainSkillEditMenu;
private final CustomBosses customBosses;
public BossPanelManager(CustomBosses customBosses) {
@ -82,10 +85,8 @@ public class BossPanelManager implements ILoadable, IReloadable {
loadStatEditMenu();
loadCommandEditMenus();
loadTextEditMenus();
loadEquipmentEditMenu();
loadWeaponEditMenu();
loadEquipmentEditMenus();
}
@ -109,10 +110,8 @@ public class BossPanelManager implements ILoadable, IReloadable {
reloadStatEditMenu();
reloadCommandEditMenus();
reloadTextEditMenus();
reloadEquipmentEditMenu();
reloadWeaponEditMenu();
reloadEquipmentEditMenus();
}

View File

@ -69,9 +69,9 @@ public class CustomSkillsPanel extends MainListPanelHandler {
Map<String, String> replaceMap = new HashMap<>();
replaceMap.put("{name}", name);
replaceMap.put("{type}", StringUtils.get().formatString(skill.getType()));
replaceMap.put("{type}", skill.getType());
replaceMap.put("{displayName}", skill.getDisplayName());
replaceMap.put("{customMessage}", StringUtils.get().formatString(skill.getCustomMessage()));
replaceMap.put("{customMessage}", skill.getCustomMessage());
replaceMap.put("{radius}", NumberUtils.get().formatDouble(skill.getRadius()));
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Skills.name"), replaceMap);

View File

@ -0,0 +1,84 @@
package com.songoda.epicbosses.panel.skills;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.skills.Skill;
import com.songoda.epicbosses.utils.NumberUtils;
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 org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 02-Dec-18
*/
public class MainSkillEditorPanel extends VariablePanelHandler<Skill> {
public MainSkillEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder) {
super(bossPanelManager, panelBuilder);
}
@Override
public void fillPanel(Panel panel, Skill skill) {
}
@Override
public void openFor(Player player, Skill skill) {
Map<String, String> replaceMap = new HashMap<>();
String customMessage = skill.getCustomMessage();
Double radius = skill.getRadius();
String mode = skill.getMode();
String displayName = skill.getDisplayName();
String type = skill.getType();
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
if(customMessage == null || customMessage.equals("")) customMessage = "N/A";
if(radius == null) radius = 100.0;
if(mode == null || mode.equals("")) mode = "N/A";
if(displayName == null || displayName.equals("")) displayName = "N/A";
if(type == null || type.equals("")) type = "N/A";
replaceMap.put("{name}", BossAPI.getSkillName(skill));
replaceMap.put("{customMessage}", customMessage);
replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius));
replaceMap.put("{mode}", mode);
replaceMap.put("{displayName}", displayName);
replaceMap.put("{type}", type);
panelBuilder.addReplaceData(replaceMap);
Panel panel = panelBuilder.getPanel()
.setDestroyWhenDone(true)
.setCancelClick(true)
.setCancelLowerClick(true);
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
counter.getSlotsWith("Radius").forEach(slot -> {});
counter.getSlotsWith("CustomData").forEach(slot -> {});
counter.getSlotsWith("Mode").forEach(slot -> {});
counter.getSlotsWith("DisplayName").forEach(slot -> {});
counter.getSlotsWith("CustomMessage").forEach(slot -> {});
counter.getSlotsWith("Type").forEach(slot -> {});
panel.openFor(player);
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
panelBuilderCounter
.addSlotCounter("CustomMessage")
.addSlotCounter("Radius")
.addSlotCounter("CustomData")
.addSlotCounter("Mode")
.addSlotCounter("DisplayName")
.addSlotCounter("Type");
}
}

View File

@ -41,6 +41,7 @@ public enum Message {
Boss_Edit_CannotSpawn("&c&l(!) &cYou cannot spawn this boss while editing is enabled. If you think this is a mistake please contact an administrator to disable the editing of the boss."),
Boss_Edit_Toggled("&b&lEpicBosses &8» &7You have toggled the editing mode for &f{0}&7 to &f{1}&7."),
Boss_Edit_NotCompleteEnough("&c&l(!) &cThe boss is not set up enough to be enabled. Please make sure it has: &fA Spawn Item, Entity Type, Health and Position&c before you try and enable the boss."),
Boss_Edit_DoesntExist("&c&l(!) &cThe specified boss does not exist. Please try again with the proper name. If you cannot figure it out please check the bosses.json file to find the one you're looking for."),
Boss_GiveEgg_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_GiveEgg_InvalidArgs("&c&l(!) &cYou must use &n/boss giveegg [name] [player] (amount)&c to give an egg."),

View File

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