1.0.0-SNAPSHOT-U89

+ Started working on TextEditor
+ Added DropsMainEditor
+ Fixed few issues within config.yml
This commit is contained in:
Charles 2018-11-28 23:06:13 +08:00
parent 1a42d8860f
commit 171fb1819f
7 changed files with 219 additions and 5 deletions

View File

@ -44,6 +44,7 @@ Display:
Taunts:
menuName: '&b&l{name} Editor'
Drops:
name: '&bDropTable: &f{name}'
lore:
- '&3Type: &7{type}'
- '&7'

View File

@ -240,6 +240,58 @@ MainEditorPanel:
- '&7Click here to edit the taunts, sayings,'
- '&7etc. for this boss.'
Button: Text
DropsMainEditorPanel:
name: '&b&l{name} Editor'
slots: 9
Settings:
backButton: true
emptySpaceFiller: true
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Buttons:
backButton: 9
Items:
'1':
type: BOOK
name: '&c&lDrops Guide'
lore:
- '&7Here you can configure the drop systems'
- '&7the boss has when he dies.'
'4':
type: GUN_POWDER
name: '&e&lNatural Drops'
lore:
- '&bCurrently: &f{naturalDrops}'
- '&7'
- '&7Click to toggle the natural drops'
- '&7for this boss.'
Button: NaturalDrops
'5':
type: BOOK
name: '&e&lDrop Table'
lore:
- '&bCurrently: &f{dropTable}'
- '&7Click here to change the drop table'
- '&7assigned to this boss.'
Button: DropTable
'6':
type: REDSTONE
name: '&e&lNatural EXP'
lore:
- '&bCurrently: &f{naturalExp}'
- '&7'
- '&7Click to toggle the natural drop'
- '&7of exp for this boss.'
Button: NaturalEXP
'9':
type: PAPER
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
DropsEditorPanel:
name: '&b&l{name} Editor'
slots: 54
@ -1029,3 +1081,47 @@ CommandsEditorPanel:
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
TextEditorMainPanel:
name: '&b&l{name} Editor'
slots: 9
Settings:
backButton: true
emptySpaceFiller: true
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Buttons:
backButton: 9
Items:
'1':
type: BOOK
name: '&c&lCommands Guide'
lore:
- '&7Here you can configure which command set'
- '&7the boss has for specific events.'
'4':
type: TALL_GRASS
name: '&e&lOn Spawn'
lore:
- '&7Here you can change the settings for'
- '&7the spawn messages of the boss.'
Button: OnSpawn
'5':
type: REDSTONE_TORCH
name: '&e&lTaunts'
lore:
- '&7Here you can adjust the settings for'
- '&7the taunts of the boss.'
'6':
type: REDSTONE
name: '&e&lOn Death'
lore:
- '&7Here you can change the settings for'
- '&7the death messages of the boss.'
Button: OnDeath
'9':
type: PAPER
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'

View File

@ -47,6 +47,7 @@ public class BossPanelManager implements ILoadable, IReloadable {
@Getter private ISubVariablePanelHandler<BossEntity, EntityStatsElement> weaponEditMenu, offHandEditorMenu, mainHandEditorMenu;
@Getter private ISubVariablePanelHandler<BossEntity, EntityStatsElement> statisticMainEditMenu, entityTypeEditMenu;
@Getter private IVariablePanelHandler<BossEntity> mainBossEditMenu, dropsEditMenu, targetingEditMenu, skillsBossEditMenu, skillListBossEditMenu, commandsMainEditMenu, onSpawnCommandEditMenu, onDeathCommandEditMenu;
@Getter private IVariablePanelHandler<BossEntity> mainDropsEditMenu;
@Getter private BossListEditorPanel equipmentListEditMenu, weaponListEditMenu, statisticListEditMenu;
private final CustomBosses customBosses;
@ -219,14 +220,14 @@ public class BossPanelManager implements ILoadable, IReloadable {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("StatisticsMainEditorPanel"));
this.statisticMainEditMenu = new StatisticMainEditorPanel(this, panelBuilder, this.customBosses);
this.entityTypeEditMenu = new EntityTypeEditorPanel(this, getListMenu("EntityTypeEditor"), this.customBosses);
this.entityTypeEditMenu = new EntityTypeEditorPanel(this, getListMenu("Boss.EntityType"), this.customBosses);
}
private void reloadStatEditMenu() {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("StatisticsMainEditorPanel"));
this.statisticMainEditMenu.initializePanel(panelBuilder);
this.entityTypeEditMenu.initializePanel(getListMenu("EntityTypeEditor"));
this.entityTypeEditMenu.initializePanel(getListMenu("Boss.EntityType"));
}
//---------------------------------------------
@ -293,13 +294,17 @@ public class BossPanelManager implements ILoadable, IReloadable {
private void loadDropsEditMenu() {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DropsEditorPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DropsMainEditorPanel"));
this.mainDropsEditMenu = new DropsMainEditorPanel(this, panelBuilder1, this.customBosses);
this.dropsEditMenu = new DropsEditorPanel(this, panelBuilder, this.customBosses);
}
private void reloadDropsEditMenu() {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DropsEditorPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DropsMainEditorPanel"));
this.mainDropsEditMenu.initializePanel(panelBuilder1);
this.dropsEditMenu.initializePanel(panelBuilder);
}
@ -467,8 +472,10 @@ public class BossPanelManager implements ILoadable, IReloadable {
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(this.customBosses.getConfig().getString(getPath(path))));
replaceMap.put("{panelName}", StringUtils.get().translateColor(value));
return new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("ListPanel"), replaceMap);
}

View File

@ -0,0 +1,101 @@
package com.songoda.epicbosses.panel.bosses;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.managers.files.BossesFileManager;
import com.songoda.epicbosses.utils.NumberUtils;
import com.songoda.epicbosses.utils.panel.Panel;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
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 28-Nov-18
*/
public class DropsMainEditorPanel extends VariablePanelHandler<BossEntity> {
private BossesFileManager bossesFileManager;
public DropsMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.bossesFileManager = plugin.getBossesFileManager();
}
@Override
public void fillPanel(Panel panel, BossEntity bossEntity) {
}
@Override
public void openFor(Player player, BossEntity bossEntity) {
Map<String, String> replaceMap = new HashMap<>();
Boolean naturalDrops = bossEntity.getDrops().getNaturalDrops();
Boolean naturalExp = bossEntity.getDrops().getDropExp();
String dropTable = bossEntity.getDrops().getDropTable();
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
if(naturalDrops == null) naturalDrops = true;
if(naturalExp == null) naturalExp = true;
if(dropTable == null) dropTable = "N/A";
replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity));
replaceMap.put("{naturalDrops}", ""+naturalDrops);
replaceMap.put("{naturalExp}", ""+naturalExp);
replaceMap.put("{dropTable}", dropTable);
panelBuilder.addReplaceData(replaceMap);
Panel panel = panelBuilder.getPanel()
.setDestroyWhenDone(true)
.setCancelClick(true)
.setCancelLowerClick(true)
.setParentPanelHandler(this.bossPanelManager.getMainBossEditMenu(), bossEntity);
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
Boolean finalNaturalDrops = naturalDrops;
Boolean finalNaturalEXP = naturalExp;
counter.getSlotsWith("NaturalDrops").forEach(slot -> panel.setOnClick(slot, getNaturalDropsAction(bossEntity, finalNaturalDrops)));
counter.getSlotsWith("DropTable").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getDropsEditMenu().openFor((Player) event.getWhoClicked(), bossEntity)));
counter.getSlotsWith("NaturalEXP").forEach(slot -> panel.setOnClick(slot, getNaturalExpAction(bossEntity, finalNaturalEXP)));
panel.openFor(player);
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
panelBuilderCounter
.addSlotCounter("NaturalDrops")
.addSlotCounter("DropTable")
.addSlotCounter("NaturalEXP");
}
private ClickAction getNaturalDropsAction(BossEntity bossEntity, Boolean current) {
return event -> {
bossEntity.getDrops().setNaturalDrops(!current);
this.bossesFileManager.save();
openFor((Player) event.getWhoClicked(), bossEntity);
};
}
private ClickAction getNaturalExpAction(BossEntity bossEntity, Boolean current) {
return event -> {
bossEntity.getDrops().setDropExp(!current);
this.bossesFileManager.save();
openFor((Player) event.getWhoClicked(), bossEntity);
};
}
}

View File

@ -76,7 +76,7 @@ public class MainBossEditPanel extends VariablePanelHandler<BossEntity> {
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
counter.getSlotsWith("Editing").forEach(slot -> panel.setOnClick(slot, getEditingAction(bossEntity)));
counter.getSlotsWith("Drops").forEach(slot -> panel.setOnClick(slot, e -> this.bossPanelManager.getDropsEditMenu().openFor((Player) e.getWhoClicked(), bossEntity)));
counter.getSlotsWith("Drops").forEach(slot -> panel.setOnClick(slot, e -> this.bossPanelManager.getMainDropsEditMenu().openFor((Player) e.getWhoClicked(), bossEntity)));
counter.getSlotsWith("Targeting").forEach(slot -> panel.setOnClick(slot, e -> this.bossPanelManager.getTargetingEditMenu().openFor((Player) e.getWhoClicked(), bossEntity)));
counter.getSlotsWith("Equipment").forEach(slot -> panel.setOnClick(slot, e -> this.bossPanelManager.getEquipmentListEditMenu().openFor((Player) e.getWhoClicked(), bossEntity)));
counter.getSlotsWith("Weapon").forEach(slot -> panel.setOnClick(slot, e -> this.bossPanelManager.getWeaponListEditMenu().openFor((Player) e.getWhoClicked(), bossEntity)));

View File

@ -0,0 +1,9 @@
package com.songoda.epicbosses.panel.bosses;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 28-Nov-18
*/
public class TextMainEditorPanel {
}

View File

@ -19,7 +19,7 @@
</modules>
<properties>
<plugin.version>maven-version-number-SNAPSHOT-U88</plugin.version>
<plugin.version>maven-version-number-SNAPSHOT-U89</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>