mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-08 08:17:43 +01:00
1.0.0-SNAPSHOT-U142
+ Partially completed the implementation of SprayDropTable editing + Started the implementation of GiveDropTable editing + Started the implementation of DropDropTable editing
This commit is contained in:
parent
c8c7ff22dc
commit
c7162a38df
@ -1981,4 +1981,75 @@ DropTableTypeEditorPanel:
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
- '&7Click here to go back.'
|
||||
SprayDropTableMainEditMenu:
|
||||
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: DIAMOND
|
||||
name: '&e&lRewards'
|
||||
lore:
|
||||
- '&7Click here to modify the rewards and their'
|
||||
- '&7assigned drop chances. You can add more by'
|
||||
- '&7clicking the emerald block at the middle'
|
||||
- '&7bottom of the rewards menu.'
|
||||
Button: Rewards
|
||||
'3':
|
||||
type: GUNPOWDER
|
||||
name: '&e&lRandom Drops'
|
||||
lore:
|
||||
- '&bCurrently: &f{randomDrops}'
|
||||
- '&7Click here to toggle the random drop mode.'
|
||||
- '&7If this is set to &ftrue&7 then when the'
|
||||
- '&7drop table is called it will shuffle the'
|
||||
- '&7list contents so it''s not in the same order.'
|
||||
- '&7If this is set to &ffalse&7 then when the'
|
||||
- '&7drop table is called it will go from top to'
|
||||
- '&7bottom through the list.'
|
||||
Button: RandomDrops
|
||||
'5':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
'7':
|
||||
type: REDSTONE
|
||||
name: '&e&lMax Distance'
|
||||
lore:
|
||||
- '&bCurrently: &f{maxDistance}'
|
||||
- '&7Click here to modify the maximum distance'
|
||||
- '&7an item can be thrown from the bosses death'
|
||||
- '&7location when the drop table is called.'
|
||||
- '&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: MaxDistance
|
||||
'8':
|
||||
type: EMERALD
|
||||
name: '&e&lMax Drops'
|
||||
lore:
|
||||
- '&bCurrently: &f{maxDrops}'
|
||||
- '&7Click here to modify the maximum amount of'
|
||||
- '&7drops this drop table can have. Keep in mind'
|
||||
- '&7that when getting drops the drop table will'
|
||||
- '&7only cycle through the list once. Not until'
|
||||
- '&7this amount of drops has been met.'
|
||||
- '&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: MaxDrops
|
||||
|
@ -2,6 +2,10 @@ package com.songoda.epicbosses.droptable;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.songoda.epicbosses.droptable.elements.DropTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.GiveTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.utils.BossesGson;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -20,4 +24,28 @@ public class DropTable {
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
||||
public GiveTableElement getGiveTableData() {
|
||||
if(getDropType().equalsIgnoreCase("GIVE")) {
|
||||
return BossesGson.get().fromJson(this.rewards, GiveTableElement.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SprayTableElement getSprayTableData() {
|
||||
if(getDropType().equalsIgnoreCase("GIVE")) {
|
||||
return BossesGson.get().fromJson(this.rewards, SprayTableElement.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public DropTableElement getDropTableData() {
|
||||
if(getDropType().equalsIgnoreCase("DROP")) {
|
||||
return BossesGson.get().fromJson(this.rewards, DropTableElement.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ package com.songoda.epicbosses.managers;
|
||||
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.DropTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.GiveTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.entity.BossEntity;
|
||||
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
|
||||
import com.songoda.epicbosses.entity.elements.EquipmentElement;
|
||||
@ -21,6 +24,9 @@ import com.songoda.epicbosses.panel.bosses.weapons.MainHandEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.weapons.OffHandEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.DropTableTypeEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.MainDropTableEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropDropTableMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.GiveDropTableMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayDropTableMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.handlers.*;
|
||||
import com.songoda.epicbosses.panel.skills.MainSkillEditorPanel;
|
||||
import com.songoda.epicbosses.panel.skills.SkillTypeEditorPanel;
|
||||
@ -85,6 +91,9 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
@Getter private ISubVariablePanelHandler<Skill, CustomSkillElement> customSkillTypeEditorMenu, specialSettingsEditorMenu, minionSelectEditorMenu;
|
||||
|
||||
@Getter private IVariablePanelHandler<DropTable> mainDropTableEditMenu, dropTableTypeEditMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, SprayTableElement> sprayDropTableMainEditMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, GiveTableElement> giveDropTableMainEditMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, DropTableElement> dropDropTableMainEditMenu;
|
||||
|
||||
private final CustomBosses customBosses;
|
||||
|
||||
@ -199,18 +208,30 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
FileConfiguration editor = this.customBosses.getEditor();
|
||||
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("DropTableMainEditorPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("DropTableTypeEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("SprayDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("GiveDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
|
||||
this.mainDropTableEditMenu = new MainDropTableEditorPanel(this, panelBuilder);
|
||||
this.dropTableTypeEditMenu = new DropTableTypeEditorPanel(this, panelBuilder1, this.customBosses);
|
||||
this.sprayDropTableMainEditMenu = new SprayDropTableMainEditorPanel(this, panelBuilder2, this.customBosses);
|
||||
this.giveDropTableMainEditMenu = new GiveDropTableMainEditorPanel(this, panelBuilder3, this.customBosses);
|
||||
this.dropDropTableMainEditMenu = new DropDropTableMainEditorPanel(this, panelBuilder4, this.customBosses);
|
||||
}
|
||||
|
||||
private void reloadDropTableEditMenus() {
|
||||
FileConfiguration editor = this.customBosses.getEditor();
|
||||
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("DropTableMainEditorPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("DropTableTypeEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("SprayDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("GiveDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
|
||||
this.mainDropTableEditMenu.initializePanel(panelBuilder);
|
||||
this.dropTableTypeEditMenu.initializePanel(panelBuilder1);
|
||||
this.sprayDropTableMainEditMenu.initializePanel(panelBuilder2);
|
||||
this.giveDropTableMainEditMenu.initializePanel(panelBuilder3);
|
||||
this.dropDropTableMainEditMenu.initializePanel(panelBuilder4);
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
|
@ -2,9 +2,14 @@ package com.songoda.epicbosses.panel.droptables;
|
||||
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.DropTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.GiveTableElement;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.utils.Debug;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
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;
|
||||
@ -43,7 +48,7 @@ public class MainDropTableEditorPanel extends VariablePanelHandler<DropTable> {
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropTables());
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Type").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getDropTableTypeEditMenu().openFor(player, dropTable)));
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, getRewardsAction(dropTable)));
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
@ -52,4 +57,27 @@ public class MainDropTableEditorPanel extends VariablePanelHandler<DropTable> {
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
|
||||
private ClickAction getRewardsAction(DropTable dropTable) {
|
||||
return event -> {
|
||||
String dropTableType = dropTable.getDropType();
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
|
||||
if(dropTableType.equalsIgnoreCase("SPRAY")) {
|
||||
SprayTableElement sprayTableElement = dropTable.getSprayTableData();
|
||||
|
||||
this.bossPanelManager.getSprayDropTableMainEditMenu().openFor(player, dropTable, sprayTableElement);
|
||||
} else if(dropTableType.equalsIgnoreCase("GIVE")) {
|
||||
GiveTableElement giveTableElement = dropTable.getGiveTableData();
|
||||
|
||||
this.bossPanelManager.getGiveDropTableMainEditMenu().openFor(player, dropTable, giveTableElement);
|
||||
} else if(dropTableType.equalsIgnoreCase("DROP")) {
|
||||
DropTableElement dropTableElement = dropTable.getDropTableData();
|
||||
|
||||
this.bossPanelManager.getDropDropTableMainEditMenu().openFor(player, dropTable, dropTableElement);
|
||||
} else {
|
||||
Debug.FAILED_TO_FIND_DROP_TABLE_TYPE.debug(dropTableType);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.drop;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.DropTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
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 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 24-Dec-18
|
||||
*/
|
||||
public class DropDropTableMainEditorPanel extends SubVariablePanelHandler<DropTable, DropTableElement> {
|
||||
|
||||
public DropDropTableMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
|
||||
replaceMap.put("{name}", BossAPI.getDropTableName(dropTable));
|
||||
replaceMap.put("{randomDrops}", StringUtils.get().formatString(""+dropTableElement.getRandomDrops()));
|
||||
replaceMap.put("{maxDrops}", NumberUtils.get().formatDouble(dropTableElement.getDropMaxDrops()));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropTables());
|
||||
|
||||
//handle buttons
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.GiveTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
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 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 24-Dec-18
|
||||
*/
|
||||
public class GiveDropTableMainEditorPanel extends SubVariablePanelHandler<DropTable, GiveTableElement> {
|
||||
|
||||
public GiveDropTableMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, GiveTableElement giveTableElement) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, GiveTableElement giveTableElement) {
|
||||
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());
|
||||
|
||||
//handle buttons
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.spray;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
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 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 24-Dec-18
|
||||
*/
|
||||
public class SprayDropTableMainEditorPanel extends SubVariablePanelHandler<DropTable, SprayTableElement> {
|
||||
|
||||
public SprayDropTableMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
|
||||
replaceMap.put("{name}", BossAPI.getDropTableName(dropTable));
|
||||
replaceMap.put("{randomDrops}", StringUtils.get().formatString(""+sprayTableElement.getRandomSprayDrops()));
|
||||
replaceMap.put("{maxDrops}", NumberUtils.get().formatDouble(sprayTableElement.getSprayMaxDrops()));
|
||||
replaceMap.put("{maxDistance}", NumberUtils.get().formatDouble(sprayTableElement.getSprayMaxDistance()));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropTables());
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
panelBuilderCounter.getSlotsWith("RandomDrops").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
panelBuilderCounter.getSlotsWith("MaxDistance").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
panelBuilderCounter.getSlotsWith("MaxDrops").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
}
|
2
pom.xml
2
pom.xml
@ -20,7 +20,7 @@
|
||||
|
||||
<properties>
|
||||
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
|
||||
<plugin.version>1.0.0-U141</plugin.version>
|
||||
<plugin.version>1.0.0-U142</plugin.version>
|
||||
<plugin.name>EpicBosses</plugin.name>
|
||||
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
|
||||
<plugin.author>AMinecraftDev</plugin.author>
|
||||
|
Loading…
Reference in New Issue
Block a user