1.0.0-SNAPSHOT-U138

+ Implemented MainDropTableEditor
+ Started implementing the further DropTable editing menu's
This commit is contained in:
Charles 2018-12-23 19:11:54 +08:00
parent 80db161ddd
commit 5aba97b5c0
10 changed files with 185 additions and 15 deletions

6
TODO
View File

@ -17,10 +17,6 @@
01:00 -> Wilderness - Button to change max coords, boss that autospawn applies to, maxActiveBosses, spawnChance
01:00 -> Spawner - Button to change max coords, boss that autospawn applies to, maxActiveBosses, spawnChance
00:30 -> Complete the /boss new skill command
00:30 -> Connect the /boss time [section] to the AutoSpawns timer (can only be applied to Interval AutoSpawns)
00:30 -> Add support for HolographicDisplays placeholder as the entityName for bosses and minions
01:00 -> Add a new branch for the plugin and add support for Legacy version
------
28.15hrs
01:00 -> Add a new branch for the plugin and add support for Legacy version

View File

@ -1880,4 +1880,49 @@ SpecialSettingsEditorPanel:
lore:
- '&7Click this button to go back to'
- '&7the skill editor panel to configure'
- '&7the general skill options.'
- '&7the general skill options.'
DropTableMainEditorPanel:
name: '&b&l{name} Editor'
slots: 9
Settings:
emptySpaceFiller: true
backButton: true
Buttons:
backButton: 9
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Items:
'1':
type: BOOK
name: '&c&lDrop Table Guide'
lore:
- '&7Here you are able to configure'
- '&7each aspect of the drop table to'
- '&7your liking. Remember that the moment'
- '&7something changes then it will also'
- '&7change for any live bosses.'
'4':
type: GUNPOWDER
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
'6':
type: DIAMOND
name: '&e&lRewards'
lore:
- '&7Click here to edit the rewards related to'
- '&7this drop table. The menu that appears will'
- '&7be relevant to the drop table type.'
Button: Rewards
'9':
type: REDSTONE
name: '&cClick here to go back'
lore:
- '&7Click this button to go back to'
- '&7the drop table list page.'

View File

@ -167,6 +167,21 @@ public class BossAPI {
return null;
}
/**
* Used to get the DropTable configuration section
* name from a DropTable instance.
*
* @param dropTable - the dropTable instance
* @return name of the dropTable from the DropTableFileManager or null if not found.
*/
public static String getDropTableName(DropTable dropTable) {
for(Map.Entry<String, DropTable> entry : PLUGIN.getDropTableFileManager().getDropTables().entrySet()) {
if(entry.getValue().equals(dropTable)) return entry.getKey();
}
return null;
}
/**
* Used to get the Minion configuration section name
* from a MinionEntity instance.
@ -384,10 +399,10 @@ public class BossAPI {
* @return ActiveBossHolder class with stored information
*/
public static ActiveBossHolder spawnNewBoss(BossEntity bossEntity, Location location, Player player, ItemStack itemStack) {
// if(bossEntity.isEditing()) {
// Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug();
// return null;
// }
if(bossEntity.isEditing()) {
Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug();
return null;
}
String name = PLUGIN.getBossEntityContainer().getName(bossEntity);

View File

@ -1,6 +1,7 @@
package com.songoda.epicbosses.managers;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.droptable.DropTable;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
import com.songoda.epicbosses.entity.elements.EquipmentElement;
@ -18,6 +19,7 @@ import com.songoda.epicbosses.panel.bosses.list.BossListWeaponEditorPanel;
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.droptables.MainDropTableEditorPanel;
import com.songoda.epicbosses.panel.handlers.*;
import com.songoda.epicbosses.panel.skills.MainSkillEditorPanel;
import com.songoda.epicbosses.panel.skills.SkillTypeEditorPanel;
@ -81,6 +83,8 @@ public class BossPanelManager implements ILoadable, IReloadable {
@Getter private ISubVariablePanelHandler<Skill, SubCommandSkillElement> modifyCommandEditMenu, commandListSkillEditMenu;
@Getter private ISubVariablePanelHandler<Skill, CustomSkillElement> customSkillTypeEditorMenu, specialSettingsEditorMenu, minionSelectEditorMenu;
@Getter private IVariablePanelHandler<DropTable> mainDropTableEditMenu;
private final CustomBosses customBosses;
public BossPanelManager(CustomBosses customBosses) {
@ -112,6 +116,7 @@ public class BossPanelManager implements ILoadable, IReloadable {
loadEquipmentEditMenus();
loadSkillEditMenus();
loadDropTableEditMenus();
}
@Override
@ -139,6 +144,7 @@ public class BossPanelManager implements ILoadable, IReloadable {
reloadEquipmentEditMenus();
reloadSkillEditMenus();
reloadDropTableEditMenus();
}
public int isItemStackUsed(String name) {
@ -182,6 +188,26 @@ public class BossPanelManager implements ILoadable, IReloadable {
return new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("ListPanel"), replaceMap);
}
//---------------------------------------------
//
// D R O P T A B L E E D I T P A N E L S
//
//---------------------------------------------
private void loadDropTableEditMenus() {
FileConfiguration editor = this.customBosses.getEditor();
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("DropTableMainEditorPanel"));
this.mainDropTableEditMenu = new MainDropTableEditorPanel(this, panelBuilder);
}
private void reloadDropTableEditMenus() {
FileConfiguration editor = this.customBosses.getEditor();
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("DropTableMainEditorPanel"));
this.mainDropTableEditMenu.initializePanel(panelBuilder);
}
//---------------------------------------------
//
// S K I L L E D I T P A N E L S

View File

@ -13,6 +13,7 @@ import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
import com.songoda.epicbosses.utils.panel.Panel;
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.ArrayList;
@ -77,9 +78,7 @@ public class DropTablePanel extends MainListPanelHandler {
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.name"), replaceMap);
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.lore"), replaceMap);
panel.setItem(realisticSlot, itemStack, e -> {
//TODO: Add Drop Table editing
});
panel.setItem(realisticSlot, itemStack, e -> this.bossPanelManager.getMainDropTableEditMenu().openFor((Player) e.getWhoClicked(), dropTable));
}
});
}

View File

@ -107,7 +107,7 @@ public class MainMenuPanel extends PanelHandler {
if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) {
this.bossPanelManager.getCustomSkills().openFor(player);
} else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) {
//TODO: Set up create skills command
Message.Boss_New_CreateArgumentsSkill.msg(player);
player.closeInventory();
}
};

View File

@ -0,0 +1,35 @@
package com.songoda.epicbosses.panel.droptables;
import com.songoda.epicbosses.droptable.DropTable;
import com.songoda.epicbosses.managers.BossPanelManager;
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 org.bukkit.entity.Player;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 23-Dec-18
*/
public class DropTableTypeEditorPanel extends VariablePanelHandler<DropTable> {
public DropTableTypeEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder) {
super(bossPanelManager, panelBuilder);
}
@Override
public void fillPanel(Panel panel, DropTable dropTable) {
}
@Override
public void openFor(Player player, DropTable dropTable) {
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
}
}

View File

@ -0,0 +1,53 @@
package com.songoda.epicbosses.panel.droptables;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.droptable.DropTable;
import com.songoda.epicbosses.managers.BossPanelManager;
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 23-Dec-18
*/
public class MainDropTableEditorPanel extends VariablePanelHandler<DropTable> {
public MainDropTableEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder) {
super(bossPanelManager, panelBuilder);
}
@Override
public void fillPanel(Panel panel, DropTable dropTable) {
}
@Override
public void openFor(Player player, DropTable dropTable) {
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
Map<String, String> replaceMap = new HashMap<>();
replaceMap.put("{name}", BossAPI.getDropTableName(dropTable));
panelBuilder.addReplaceData(replaceMap);
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
Panel panel = panelBuilder.getPanel()
.setParentPanelHandler(this.bossPanelManager.getDropTables());
panelBuilderCounter.getSlotsWith("Type").forEach(slot -> panel.setOnClick(slot, event -> {}));
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> {}));
panel.openFor(player);
}
@Override
public void initializePanel(PanelBuilder panelBuilder) {
}
}

View File

@ -138,6 +138,7 @@ public enum Message {
Boss_New_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_New_InvalidArgs("&c&l(!) &cInvalid arguments! You must use &n/boss new droptable [name] (type)&c or &n/boss new skill [name]&c!"),
Boss_New_CreateArgumentsDropTable("&b&lEpicBosses &8» &7Create a new droptable with the command &f/boss new droptable [name] [type]&7."),
Boss_New_CreateArgumentsSkill("&b&lEpicBosses &8» &7Create a new skill with the command &f/boss new skill [name] [type] [mode]&7."),
Boss_New_CreateArgumentsMessage("&b&lEpicBosses &8» &7Create a new message with the command &f/boss new message [name] [message(s)]. \n&7&oUse &f|| &7&oto reference a new line."),
Boss_New_CreateArgumentsCommand("&b&lEpicBosses &8» &7Create a new command with the command &f/boss new command [name] [command(s)]. \n&7&oUse &f|| &7&oto reference a new line."),
Boss_New_AlreadyExists("&c&l(!) &cThe specified {0} name already exists. Please try another name."),

View File

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