1.0.0-SNAPSHOT-U92

+ Fixed up the Death Text Editor to contain all the true adjustable settings
+ Renamed the files correctly
+ Updated editor.yml with the new data and fixed some old data issues
+ Added IPanelListHandler for the easy access to the custom abstract methods
This commit is contained in:
Charles 2018-12-01 00:12:24 +08:00
parent a30ef0bebc
commit fa419e4203
10 changed files with 185 additions and 57 deletions

View File

@ -601,8 +601,6 @@ LeggingsEditorPanel:
lore:
- '&7Click here to go to the previous'
- '&7page of leggings.'
- '&7'
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
PreviousPage: true
'50':
type: DIAMOND_BLOCK
@ -618,8 +616,6 @@ LeggingsEditorPanel:
lore:
- '&7Click here to go to the next'
- '&7page of leggings.'
- '&7'
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
NextPage: true
'52':
type: WHITE_STAINED_GLASS_PANE
@ -937,17 +933,11 @@ SkillMainEditorPanel:
- '&7skills to be procced each hit is'
- '&f{chance}%&7.'
- '&7'
- '&bLeft Click »'
- '&7Increase the chance by &f1.0%&7.'
- '&bLeft Click &8» &f+1.0'
- '&bShift Left-Click &8» &f+0.1'
- '&7'
- '&bShift Left-Click »'
- '&7Increase the chance by &f0.1%&7.'
- '&7'
- '&bRight Click »'
- '&7Decrease the chance by &f1.0%&7.'
- '&7'
- '&bShift Right-Click »'
- '&7Decrease the chance by &f0.1%&7.'
- '&bRight Click &8» &f-1.0'
- '&bShift Right-Click &8» &f-0.1'
Button: OverallChance
'5':
type: BOOK
@ -1020,17 +1010,11 @@ StatisticsMainEditorPanel:
- '&7The current health for this entity'
- '&7is &c{health}'
- '&7'
- '&bLeft Click »'
- '&7Increase the health by &f1.0%&7.'
- '&bLeft Click &8» &f+1.0'
- '&bShift Left-Click &8» &f+0.1'
- '&7'
- '&bShift Left-Click »'
- '&7Increase the health by &f0.1%&7.'
- '&7'
- '&bRight Click »'
- '&7Decrease the health by &f1.0%&7.'
- '&7'
- '&bShift Right-Click »'
- '&7Decrease the health by &f0.1%&7.'
- '&bRight Click &8» &f-1.0'
- '&bShift Right-Click &8» &f-0.1'
Button: Health
'9':
type: PAPER
@ -1122,7 +1106,7 @@ TextEditorMainPanel:
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
TextEditorSubPanel:
DeathTextEditorPanel:
name: '&b&l{name} Editor'
slots: 9
Settings:
@ -1134,7 +1118,76 @@ TextEditorSubPanel:
Buttons:
backButton: 5
Items:
'2':
type: TALL_GRASS
name: '&e&lMain Message'
lore:
- '&7Here you can change the main message that is'
- '&7currently selected.'
- '&7'
- '&bCurrent: &f{mainMessage}'
Button: MainMessage
'3':
type: PLAYER_HEAD
name: '&e&lPosition Message'
lore:
- '&7Here you can change the position message that is'
- '&7currently selected.'
- '&7'
- '&bCurrent: &f{positionMessage}'
- '&7'
- '&7The position message is a message that is'
- '&7injected in to the main message to display'
- '&7the positions, damage and percentage of damage'
- '&7that the selected amount of people did to'
- '&7the boss.'
Button: PositionMessage
'5':
type: PAPER
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
'7':
type: REDSTONE_BLOCK
name: '&e&lOnly Show'
lore:
- '&7Here you can change the amount of damaging'
- '&7users it will display on the main message'
- '&7with the position message injection.'
- '&7Currently it will show the top &f{onlyShow}'
- '&7players on the death message.'
- '&7'
- '&bLeft Click &8» &f+1'
- '&bRight Click &8» &f-1'
Button: OnlyShow
'8':
type: REDSTONE
name: '&e&lRadius'
lore:
- '&7Here you can change the radius for'
- '&7this message. It is currently: &f{radius}'
- '&7blocks. Set it to &f-1&7 if you want it'
- '&7to be a server-wide broadcast.'
- '&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
SpawnTextEditorPanel:
name: '&b&l{name} Editor'
slots: 9
Settings:
backButton: true
emptySpaceFiller: true
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Buttons:
backButton: 5
Items:
'2':
type: TALL_GRASS
name: '&e&lSelect Message'
lore:
@ -1148,7 +1201,7 @@ TextEditorSubPanel:
name: '&e&lGo Back'
lore:
- '&7Click here to go back.'
'7':
'8':
type: REDSTONE
name: '&e&lRadius'
lore:

View File

@ -14,10 +14,10 @@ import com.songoda.epicbosses.panel.bosses.equipment.HelmetEditorPanel;
import com.songoda.epicbosses.panel.bosses.equipment.LeggingsEditorPanel;
import com.songoda.epicbosses.panel.bosses.list.BossListStatisticEditorPanel;
import com.songoda.epicbosses.panel.bosses.list.BossListWeaponEditorPanel;
import com.songoda.epicbosses.panel.bosses.text.OnDeathTextEditor;
import com.songoda.epicbosses.panel.bosses.text.OnDeathTextSubEditor;
import com.songoda.epicbosses.panel.bosses.text.OnSpawnTextEditor;
import com.songoda.epicbosses.panel.bosses.text.OnSpawnTextSubEditor;
import com.songoda.epicbosses.panel.bosses.text.DeathMessageListEditor;
import com.songoda.epicbosses.panel.bosses.text.DeathTextEditorPanel;
import com.songoda.epicbosses.panel.bosses.text.SpawnMessageListEditor;
import com.songoda.epicbosses.panel.bosses.text.SpawnTextEditorPanel;
import com.songoda.epicbosses.panel.bosses.weapons.MainHandEditorPanel;
import com.songoda.epicbosses.panel.bosses.weapons.OffHandEditorPanel;
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
@ -51,7 +51,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, mainTextEditMenu, mainTauntEditMenu, onSpawnTextEditMenu, onSpawnSubTextEditMenu, onDeathTextEditMenu, onDeathSubTextEditMenu;
@Getter private IVariablePanelHandler<BossEntity> mainDropsEditMenu, mainTextEditMenu, mainTauntEditMenu, onSpawnTextEditMenu, onSpawnSubTextEditMenu, onDeathTextEditMenu, onDeathSubTextEditMenu, onDeathPositionTextEditMenu;
@Getter private BossListEditorPanel equipmentListEditMenu, weaponListEditMenu, statisticListEditMenu;
private final CustomBosses customBosses;
@ -147,22 +147,46 @@ public class BossPanelManager implements ILoadable, IReloadable {
private void loadTextEditMenus() {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorMainPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorSubPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("SpawnTextEditorPanel"));
PanelBuilder panelBuilder2 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DeathTextEditorPanel"));
this.mainTextEditMenu = new TextMainEditorPanel(this, panelBuilder);
this.onSpawnSubTextEditMenu = new OnSpawnTextSubEditor(this, panelBuilder1.cloneBuilder(), this.customBosses);
this.onDeathSubTextEditMenu = new OnDeathTextSubEditor(this, panelBuilder1.cloneBuilder(), this.customBosses);
this.onSpawnTextEditMenu = new OnSpawnTextEditor(this, getListMenu("Boss.Text"), this.customBosses);
this.onDeathTextEditMenu = new OnDeathTextEditor(this, getListMenu("Boss.Text"), this.customBosses);
this.onSpawnSubTextEditMenu = new SpawnTextEditorPanel(this, panelBuilder1, this.customBosses);
this.onDeathSubTextEditMenu = new DeathTextEditorPanel(this, panelBuilder2, this.customBosses);
this.onSpawnTextEditMenu = new SpawnMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses);
this.onDeathTextEditMenu = new DeathMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
@Override
public String getCurrent(BossEntity bossEntity) {
return bossEntity.getMessages().getOnDeath().getMessage();
}
@Override
public void updateMessage(BossEntity bossEntity, String newPath) {
bossEntity.getMessages().getOnDeath().setMessage(newPath);
}
};
this.onDeathPositionTextEditMenu = new DeathMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
@Override
public String getCurrent(BossEntity bossEntity) {
return bossEntity.getMessages().getOnDeath().getPositionMessage();
}
@Override
public void updateMessage(BossEntity bossEntity, String newPath) {
bossEntity.getMessages().getOnDeath().setPositionMessage(newPath);
}
};
}
private void reloadTextEditMenus() {
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorMainPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorSubPanel"));
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("SpawnTextEditorPanel"));
PanelBuilder panelBuilder2 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DeathTextEditorPanel"));
this.mainTextEditMenu.initializePanel(panelBuilder);
this.onSpawnSubTextEditMenu.initializePanel(panelBuilder1.cloneBuilder());
this.onDeathSubTextEditMenu.initializePanel(panelBuilder1.cloneBuilder());
this.onSpawnSubTextEditMenu.initializePanel(panelBuilder1);
this.onDeathSubTextEditMenu.initializePanel(panelBuilder2);
this.onSpawnTextEditMenu.initializePanel(getListMenu("Boss.Text"));
this.onDeathTextEditMenu.initializePanel(getListMenu("Boss.Text"));
}

View File

@ -27,13 +27,13 @@ import java.util.Map;
* @version 1.0.0
* @since 29-Nov-18
*/
public class OnDeathTextEditor extends VariablePanelHandler<BossEntity> {
public abstract class DeathMessageListEditor extends VariablePanelHandler<BossEntity> {
private MessagesFileManager messagesFileManager;
private ItemStackConverter itemStackConverter;
private CustomBosses plugin;
public OnDeathTextEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
public DeathMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.plugin = plugin;
@ -41,6 +41,10 @@ public class OnDeathTextEditor extends VariablePanelHandler<BossEntity> {
this.messagesFileManager = plugin.getBossMessagesFileManager();
}
public abstract String getCurrent(BossEntity bossEntity);
public abstract void updateMessage(BossEntity bossEntity, String newPath);
@Override
public void fillPanel(Panel panel, BossEntity bossEntity) {
Map<String, List<String>> currentTexts = this.messagesFileManager.getMessagesMap();
@ -82,7 +86,7 @@ public class OnDeathTextEditor extends VariablePanelHandler<BossEntity> {
}
private void loadPage(Panel panel, int page, Map<String, List<String>> currentMessages, List<String> entryList, BossEntity bossEntity) {
String current = bossEntity.getMessages().getOnDeath().getMessage();
String current = getCurrent(bossEntity);
panel.loadPage(page, (slot, realisticSlot) -> {
if(slot >= entryList.size()) {
@ -121,7 +125,7 @@ public class OnDeathTextEditor extends VariablePanelHandler<BossEntity> {
itemStack.setItemMeta(itemMeta);
panel.setItem(realisticSlot, itemStack, e -> {
bossEntity.getMessages().getOnDeath().setMessage(name);
updateMessage(bossEntity, name);
this.plugin.getBossesFileManager().save();
loadPage(panel, page, currentMessages, entryList, bossEntity);
});

View File

@ -23,11 +23,11 @@ import java.util.Map;
* @version 1.0.0
* @since 29-Nov-18
*/
public class OnDeathTextSubEditor extends VariablePanelHandler<BossEntity> {
public class DeathTextEditorPanel extends VariablePanelHandler<BossEntity> {
private BossesFileManager bossesFileManager;
public OnDeathTextSubEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
public DeathTextEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.bossesFileManager = plugin.getBossesFileManager();
@ -60,8 +60,10 @@ public class OnDeathTextSubEditor extends VariablePanelHandler<BossEntity> {
.setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity);
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
counter.getSlotsWith("Select").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnDeathTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity)));
counter.getSlotsWith("MainMessage").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnDeathTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity)));
counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity)));
counter.getSlotsWith("OnlyShow").forEach(slot -> panel.setOnClick(slot, getOnlyShowAction(bossEntity)));
counter.getSlotsWith("PositionMessage").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getOnDeathPositionTextEditMenu().openFor((Player) event.getWhoClicked(), bossEntity)));
panel.openFor(player);
}
@ -71,7 +73,9 @@ public class OnDeathTextSubEditor extends VariablePanelHandler<BossEntity> {
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
panelBuilderCounter
.addSlotCounter("Select")
.addSlotCounter("MainMessage")
.addSlotCounter("PositionMessage")
.addSlotCounter("OnlyShow")
.addSlotCounter("Radius");
}
@ -107,4 +111,33 @@ public class OnDeathTextSubEditor extends VariablePanelHandler<BossEntity> {
openFor((Player) event.getWhoClicked(), bossEntity);
};
}
private ClickAction getOnlyShowAction(BossEntity bossEntity) {
return event -> {
ClickType clickType = event.getClick();
int amountToModifyBy = 0;
if(clickType.name().contains("LEFT")) {
amountToModifyBy = 1;
} else if(clickType.name().contains("RIGHT")) {
amountToModifyBy = -1;
}
String modifyValue = amountToModifyBy > 0? "increased" : "decreased";
Integer currentAmount = bossEntity.getMessages().getOnDeath().getOnlyShow();
if(currentAmount == null) currentAmount = 3;
int newAmount = currentAmount + amountToModifyBy;
if(newAmount < -1) {
newAmount = -1;
}
bossEntity.getMessages().getOnDeath().setOnlyShow(newAmount);
this.bossesFileManager.save();
Message.Boss_Messages_SetOnlyShowOnDeath.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble(newAmount));
openFor((Player) event.getWhoClicked(), bossEntity);
};
}
}

View File

@ -27,13 +27,13 @@ import java.util.Map;
* @version 1.0.0
* @since 29-Nov-18
*/
public class OnSpawnTextEditor extends VariablePanelHandler<BossEntity> {
public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
private MessagesFileManager messagesFileManager;
private ItemStackConverter itemStackConverter;
private CustomBosses plugin;
public OnSpawnTextEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
public SpawnMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.plugin = plugin;

View File

@ -23,11 +23,11 @@ import java.util.Map;
* @version 1.0.0
* @since 29-Nov-18
*/
public class OnSpawnTextSubEditor extends VariablePanelHandler<BossEntity> {
public class SpawnTextEditorPanel extends VariablePanelHandler<BossEntity> {
private BossesFileManager bossesFileManager;
public OnSpawnTextSubEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
public SpawnTextEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.bossesFileManager = plugin.getBossesFileManager();

View File

@ -11,6 +11,7 @@ import com.songoda.epicbosses.utils.itemstack.ItemStackConverter;
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
import com.songoda.epicbosses.utils.panel.Panel;
import com.songoda.epicbosses.utils.panel.base.IPanelListHandler;
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.base.handlers.SubVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
@ -30,7 +31,7 @@ import java.util.Map;
* @version 1.0.0
* @since 24-Nov-18
*/
public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandler<BossEntity, EntityStatsElement> {
public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandler<BossEntity, EntityStatsElement> implements IPanelListHandler<ItemStackHolder, ISubVariablePanelHandler<BossEntity, EntityStatsElement>> {
protected ItemStackConverter itemStackConverter;
@ -47,10 +48,6 @@ public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandl
this.itemStackConverter = new ItemStackConverter();
}
public abstract Map<String, ItemStackHolder> getFilteredMap(Map<String, ItemStackHolder> originalMap);
public abstract ISubVariablePanelHandler<BossEntity, EntityStatsElement> getParentHolder();
public abstract void getUpdateAction(EntityStatsElement entityStatsElement, String newName);
public abstract String getCurrent(EntityStatsElement entityStatsElement);

View File

@ -108,6 +108,7 @@ public enum Message {
Boss_Messages_SetRadiusOnSpawn("&b&lEpicBosses &8» &7You have just {0} the radius for the onSpawn message to &f{1}&7."),
Boss_Messages_SetRadiusOnDeath("&b&lEpicBosses &8» &7You have just {0} the radius for the onDeath message to &f{1}&7."),
Boss_Messages_SetOnlyShowOnDeath("&b&lEpicBosses &8» &7You have just {0} the only show amount for the onDeath message to &f{1}&7."),
Boss_Nearby_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_Nearby_MaxRadius("&c&l(!) &cYou cannot check for bosses any further then &f{0}&c away from your position."),

View File

@ -0,0 +1,16 @@
package com.songoda.epicbosses.utils.panel.base;
import java.util.Map;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 30-Nov-18
*/
public interface IPanelListHandler<FilteredValue, PanelHandler extends IBasicPanelHandler> {
Map<String, FilteredValue> getFilteredMap(Map<String, FilteredValue> originalMap);
PanelHandler getParentHolder();
}

View File

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