mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-11 01:37:40 +01:00
1.0.0-SNAPSHOT-U162
+ Removed the need for individual reward panels + Added DropTableNewRewardEditorPanel + Added DropTableRewardMainEditorPanel + Added DropTableRewardsListEditorPanel
This commit is contained in:
parent
ab87e02294
commit
4bbb92e0b6
@ -2066,179 +2066,6 @@ SprayDropTableMainEditMenu:
|
||||
- '&bRight Click &8» &f-1'
|
||||
- '&bShift Right-Click &8» &f-10'
|
||||
Button: MaxDrops
|
||||
SprayRewardsListEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lSpray Rewards Guide'
|
||||
lore:
|
||||
- '&7Here you can adjust the rewards for'
|
||||
- '&7the skill with the spray layout. To'
|
||||
- '&7adjust the chance of a section or to'
|
||||
- '&7remove a section, then all you have'
|
||||
- '&7to do is click on the section you''d'
|
||||
- '&7like to modify and then click the'
|
||||
- '&7corresponding button.'
|
||||
- '&7To add a new section click on the'
|
||||
- '&7emerald block in the bottom middle of'
|
||||
- '&7the menu in between the page buttons.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of rewards.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: EMERALD_BLOCK
|
||||
name: '&b&lAdd a New Reward Section'
|
||||
lore:
|
||||
- '&7Click here if you would like to add'
|
||||
- '&7a new reward section to this drop'
|
||||
- '&7table.'
|
||||
Button: NewReward
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of rewards.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table main edit menu.'
|
||||
SprayNewRewardEditMenu:
|
||||
name: '&b&lNew Reward for DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lNew Spray Reward Guide'
|
||||
lore:
|
||||
- '&7Once you click an item within this'
|
||||
- '&7menu it will create a new reward'
|
||||
- '&7section with that selected item'
|
||||
- '&7to the drop table you were working'
|
||||
- '&7on. From there you can adjust the'
|
||||
- '&7chance for it to be sprayed.'
|
||||
- '&7'
|
||||
- '&c&lWARNING'
|
||||
- '&7At this moment you cannot have'
|
||||
- '&7two sections for the same item,'
|
||||
- '&7an easy way to bypass this is to'
|
||||
- '&7add a new Item with the same'
|
||||
- '&7itemstack, therefore giving it'
|
||||
- '&7a new name, and allowing for'
|
||||
- '&7another new section of the same'
|
||||
- '&7item.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of itemstacks.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of itemstacks.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table reward list menu.'
|
||||
SprayRewardMainEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: WHITE_STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
Buttons:
|
||||
backButton: 9
|
||||
Items:
|
||||
'3':
|
||||
type: GUNPOWDER
|
||||
name: '&e&lSelected ItemStack'
|
||||
lore:
|
||||
- '&bCurrently: &f{itemStack}'
|
||||
- '&7This is the selected itemStack for this'
|
||||
- '&7reward section.'
|
||||
'4':
|
||||
type: EMERALD
|
||||
name: '&e&lChance'
|
||||
lore:
|
||||
- '&bCurrently: &f{chance}'
|
||||
- '&7Click here to modify the chance of this'
|
||||
- '&7reward '
|
||||
- '&7'
|
||||
- '&bLeft Click &8» &f+1%'
|
||||
- '&bShift Left-Click &8» &f+0.1%'
|
||||
- '&7'
|
||||
- '&bRight Click &8» &f-1%'
|
||||
- '&bShift Right-Click &8» &f-0.1%'
|
||||
Button: Chance
|
||||
'5':
|
||||
type: BARRIER
|
||||
name: '&e&lClick here to remove'
|
||||
lore:
|
||||
- '&7Click here to remove this rewards section.'
|
||||
- '&7You can always re-create this section if'
|
||||
- '&7was a mistake.'
|
||||
Button: Remove
|
||||
'9':
|
||||
type: REDSTONE
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
DropDropTableMainEditMenu:
|
||||
name: '&b&l{name} Editor'
|
||||
slots: 9
|
||||
@ -2295,179 +2122,6 @@ DropDropTableMainEditMenu:
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
DropRewardsListEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lDrop Rewards Guide'
|
||||
lore:
|
||||
- '&7Here you can adjust the rewards for'
|
||||
- '&7the skill with the drop layout. To'
|
||||
- '&7adjust the chance of a section or to'
|
||||
- '&7remove a section, then all you have'
|
||||
- '&7to do is click on the section you''d'
|
||||
- '&7like to modify and then click the'
|
||||
- '&7corresponding button.'
|
||||
- '&7To add a new section click on the'
|
||||
- '&7emerald block in the bottom middle of'
|
||||
- '&7the menu in between the page buttons.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of rewards.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: EMERALD_BLOCK
|
||||
name: '&b&lAdd a New Reward Section'
|
||||
lore:
|
||||
- '&7Click here if you would like to add'
|
||||
- '&7a new reward section to this drop'
|
||||
- '&7table.'
|
||||
Button: NewReward
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of rewards.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table main edit menu.'
|
||||
DropNewRewardEditMenu:
|
||||
name: '&b&lNew Reward for DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lNew Drop Reward Guide'
|
||||
lore:
|
||||
- '&7Once you click an item within this'
|
||||
- '&7menu it will create a new reward'
|
||||
- '&7section with that selected item'
|
||||
- '&7to the drop table you were working'
|
||||
- '&7on. From there you can adjust the'
|
||||
- '&7chance for it to be sprayed.'
|
||||
- '&7'
|
||||
- '&c&lWARNING'
|
||||
- '&7At this moment you cannot have'
|
||||
- '&7two sections for the same item,'
|
||||
- '&7an easy way to bypass this is to'
|
||||
- '&7add a new Item with the same'
|
||||
- '&7itemstack, therefore giving it'
|
||||
- '&7a new name, and allowing for'
|
||||
- '&7another new section of the same'
|
||||
- '&7item.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of itemstacks.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of itemstacks.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table reward list menu.'
|
||||
DropRewardMainEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: WHITE_STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
Buttons:
|
||||
backButton: 9
|
||||
Items:
|
||||
'3':
|
||||
type: GUNPOWDER
|
||||
name: '&e&lSelected ItemStack'
|
||||
lore:
|
||||
- '&bCurrently: &f{itemStack}'
|
||||
- '&7This is the selected itemStack for this'
|
||||
- '&7reward section.'
|
||||
'4':
|
||||
type: EMERALD
|
||||
name: '&e&lChance'
|
||||
lore:
|
||||
- '&bCurrently: &f{chance}'
|
||||
- '&7Click here to modify the chance of this'
|
||||
- '&7reward '
|
||||
- '&7'
|
||||
- '&bLeft Click &8» &f+1%'
|
||||
- '&bShift Left-Click &8» &f+0.1%'
|
||||
- '&7'
|
||||
- '&bRight Click &8» &f-1%'
|
||||
- '&bShift Right-Click &8» &f-0.1%'
|
||||
Button: Chance
|
||||
'5':
|
||||
type: BARRIER
|
||||
name: '&e&lClick here to remove'
|
||||
lore:
|
||||
- '&7Click here to remove this rewards section.'
|
||||
- '&7You can always re-create this section if'
|
||||
- '&7was a mistake.'
|
||||
Button: Remove
|
||||
'9':
|
||||
type: REDSTONE
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
GiveRewardPositionListMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 54
|
||||
@ -2706,4 +2360,177 @@ GiveRewardMainEditMenu:
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the reward drop section list menu.'
|
||||
- '&7the reward drop section list menu.'
|
||||
DropTableRewardsListEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lDrop Rewards Guide'
|
||||
lore:
|
||||
- '&7Here you can adjust the rewards for'
|
||||
- '&7the skill with the drop layout. To'
|
||||
- '&7adjust the chance of a section or to'
|
||||
- '&7remove a section, then all you have'
|
||||
- '&7to do is click on the section you''d'
|
||||
- '&7like to modify and then click the'
|
||||
- '&7corresponding button.'
|
||||
- '&7To add a new section click on the'
|
||||
- '&7emerald block in the bottom middle of'
|
||||
- '&7the menu in between the page buttons.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of rewards.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: EMERALD_BLOCK
|
||||
name: '&b&lAdd a New Reward Section'
|
||||
lore:
|
||||
- '&7Click here if you would like to add'
|
||||
- '&7a new reward section to this drop'
|
||||
- '&7table.'
|
||||
Button: NewReward
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of rewards.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table main edit menu.'
|
||||
DropTableNewRewardEditMenu:
|
||||
name: '&b&lNew Reward for DropTable'
|
||||
slots: 54
|
||||
Settings:
|
||||
backButton: true
|
||||
fillTo: 45
|
||||
Buttons:
|
||||
backButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: BOOK
|
||||
name: '&c&lNew Drop Reward Guide'
|
||||
lore:
|
||||
- '&7Once you click an item within this'
|
||||
- '&7menu it will create a new reward'
|
||||
- '&7section with that selected item'
|
||||
- '&7to the drop table you were working'
|
||||
- '&7on. From there you can adjust the'
|
||||
- '&7chance for it to be sprayed.'
|
||||
- '&7'
|
||||
- '&c&lWARNING'
|
||||
- '&7At this moment you cannot have'
|
||||
- '&7two sections for the same item,'
|
||||
- '&7an easy way to bypass this is to'
|
||||
- '&7add a new Item with the same'
|
||||
- '&7itemstack, therefore giving it'
|
||||
- '&7a new name, and allowing for'
|
||||
- '&7another new section of the same'
|
||||
- '&7item.'
|
||||
'47':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of itemstacks.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of itemstacks.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: REDSTONE
|
||||
name: '&cClick here to go back'
|
||||
lore:
|
||||
- '&7Click this button to go back to'
|
||||
- '&7the drop table reward list menu.'
|
||||
DropTableRewardMainEditMenu:
|
||||
name: '&b&l{name} DropTable'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: WHITE_STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
Buttons:
|
||||
backButton: 9
|
||||
Items:
|
||||
'3':
|
||||
type: GUNPOWDER
|
||||
name: '&e&lSelected ItemStack'
|
||||
lore:
|
||||
- '&bCurrently: &f{itemStack}'
|
||||
- '&7This is the selected itemStack for this'
|
||||
- '&7reward section.'
|
||||
'4':
|
||||
type: EMERALD
|
||||
name: '&e&lChance'
|
||||
lore:
|
||||
- '&bCurrently: &f{chance}'
|
||||
- '&7Click here to modify the chance of this'
|
||||
- '&7reward '
|
||||
- '&7'
|
||||
- '&bLeft Click &8» &f+1%'
|
||||
- '&bShift Left-Click &8» &f+0.1%'
|
||||
- '&7'
|
||||
- '&bRight Click &8» &f-1%'
|
||||
- '&bShift Right-Click &8» &f-0.1%'
|
||||
Button: Chance
|
||||
'5':
|
||||
type: BARRIER
|
||||
name: '&e&lClick here to remove'
|
||||
lore:
|
||||
- '&7Click here to remove this rewards section.'
|
||||
- '&7You can always re-create this section if'
|
||||
- '&7was a mistake.'
|
||||
Button: Remove
|
||||
'9':
|
||||
type: REDSTONE
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
@ -24,18 +24,21 @@ 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.rewards.DropTableNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropDropNewRewardPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropDropRewardListPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropDropRewardMainEditPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropDropTableMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.drop.DropRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.GiveRewardMainEditPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.GiveRewardPositionListPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.GiveRewardRewardsListPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.handlers.GiveRewardEditHandler;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayDropNewRewardPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayDropRewardListPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayDropRewardMainEditPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayDropTableMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.spray.SprayRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.panel.handlers.*;
|
||||
import com.songoda.epicbosses.panel.skills.MainSkillEditorPanel;
|
||||
import com.songoda.epicbosses.panel.skills.SkillTypeEditorPanel;
|
||||
@ -99,15 +102,23 @@ 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, sprayRewardListEditMenu, sprayNewRewardEditMenu;
|
||||
@Getter private ISubSubVariablePanelHandler<DropTable, SprayTableElement, String> sprayRewardMainEditMenu;
|
||||
|
||||
@Getter private ISubVariablePanelHandler<DropTable, SprayTableElement> sprayDropTableMainEditMenu;
|
||||
@Getter private DropTableRewardMainEditorPanel<SprayTableElement> sprayDropRewardMainEditPanel;
|
||||
@Getter private DropTableNewRewardEditorPanel<SprayTableElement> sprayDropNewRewardEditPanel;
|
||||
@Getter private DropTableRewardsListEditorPanel<SprayTableElement> sprayDropRewardListPanel;
|
||||
|
||||
@Getter private ISubSubVariablePanelHandler<DropTable, GiveTableElement, String> giveRewardRewardsListMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, GiveTableElement> giveRewardPositionListMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> giveRewardMainEditMenu;
|
||||
@Getter private DropTableRewardMainEditorPanel<GiveRewardEditHandler> giveDropRewardMainEditPanel;
|
||||
@Getter private DropTableNewRewardEditorPanel<GiveRewardEditHandler> giveDropNewRewardEditPanel;
|
||||
@Getter private DropTableRewardsListEditorPanel<GiveRewardEditHandler> giveDropRewardListPanel;
|
||||
|
||||
@Getter private ISubVariablePanelHandler<DropTable, DropTableElement> dropDropTableMainEditMenu, dropRewardListEditMenu, dropNewRewardEditMenu;
|
||||
@Getter private ISubSubVariablePanelHandler<DropTable, DropTableElement, String> dropRewardMainEditMenu;
|
||||
@Getter private ISubVariablePanelHandler<DropTable, DropTableElement> dropDropTableMainEditMenu;
|
||||
@Getter private DropTableRewardMainEditorPanel<DropTableElement> dropDropRewardMainEditPanel;
|
||||
@Getter private DropTableNewRewardEditorPanel<DropTableElement> dropDropNewRewardEditPanel;
|
||||
@Getter private DropTableRewardsListEditorPanel<DropTableElement> dropDropRewardListPanel;
|
||||
|
||||
private final CustomBosses customBosses;
|
||||
|
||||
@ -223,14 +234,12 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
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("SprayRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("SprayDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("SprayNewRewardEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("DropTableRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("DropTableNewRewardEditMenu"));
|
||||
PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("DropTableRewardMainEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder6 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder7 = new PanelBuilder(editor.getConfigurationSection("DropRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder9 = new PanelBuilder(editor.getConfigurationSection("DropNewRewardEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder10 = new PanelBuilder(editor.getConfigurationSection("GiveRewardPositionListMenu"));
|
||||
PanelBuilder panelBuilder11 = new PanelBuilder(editor.getConfigurationSection("GiveRewardRewardsListMenu"));
|
||||
@ -240,14 +249,14 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
this.dropTableTypeEditMenu = new DropTableTypeEditorPanel(this, panelBuilder1, this.customBosses);
|
||||
|
||||
this.sprayDropTableMainEditMenu = new SprayDropTableMainEditorPanel(this, panelBuilder2, this.customBosses);
|
||||
this.sprayRewardListEditMenu = new SprayRewardsListEditorPanel(this, panelBuilder3, this.customBosses);
|
||||
this.sprayRewardMainEditMenu = new SprayRewardMainEditorPanel(this, panelBuilder4, this.customBosses);
|
||||
this.sprayNewRewardEditMenu = new SprayNewRewardEditorPanel(this, panelBuilder5, this.customBosses);
|
||||
this.sprayDropNewRewardEditPanel = new SprayDropNewRewardPanel(this, panelBuilder4, this.customBosses);
|
||||
this.sprayDropRewardListPanel = new SprayDropRewardListPanel(this, panelBuilder3, this.customBosses);
|
||||
this.sprayDropRewardMainEditPanel = new SprayDropRewardMainEditPanel(this, panelBuilder5, this.customBosses);
|
||||
|
||||
this.dropDropTableMainEditMenu = new DropDropTableMainEditorPanel(this, panelBuilder6, this.customBosses);
|
||||
this.dropRewardListEditMenu = new DropRewardsListEditorPanel(this, panelBuilder7, this.customBosses);
|
||||
this.dropRewardMainEditMenu = new DropRewardMainEditorPanel(this, panelBuilder8, this.customBosses);
|
||||
this.dropNewRewardEditMenu = new DropNewRewardEditorPanel(this, panelBuilder9, this.customBosses);
|
||||
this.dropDropNewRewardEditPanel = new DropDropNewRewardPanel(this, panelBuilder4, this.customBosses);
|
||||
this.dropDropRewardListPanel = new DropDropRewardListPanel(this, panelBuilder3, this.customBosses);
|
||||
this.dropDropRewardMainEditPanel = new DropDropRewardMainEditPanel(this, panelBuilder5, this.customBosses);
|
||||
|
||||
this.giveRewardPositionListMenu = new GiveRewardPositionListPanel(this, panelBuilder10, this.customBosses);
|
||||
this.giveRewardRewardsListMenu = new GiveRewardRewardsListPanel(this, panelBuilder11, this.customBosses);
|
||||
@ -259,14 +268,12 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
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("SprayRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("SprayDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("SprayNewRewardEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("DropTableRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("DropTableNewRewardEditMenu"));
|
||||
PanelBuilder panelBuilder5 = new PanelBuilder(editor.getConfigurationSection("DropTableRewardMainEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder6 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder7 = new PanelBuilder(editor.getConfigurationSection("DropRewardsListEditMenu"));
|
||||
PanelBuilder panelBuilder8 = new PanelBuilder(editor.getConfigurationSection("DropDropTableMainEditMenu"));
|
||||
PanelBuilder panelBuilder9 = new PanelBuilder(editor.getConfigurationSection("DropNewRewardEditMenu"));
|
||||
|
||||
PanelBuilder panelBuilder10 = new PanelBuilder(editor.getConfigurationSection("GiveRewardPositionListMenu"));
|
||||
PanelBuilder panelBuilder11 = new PanelBuilder(editor.getConfigurationSection("GiveRewardRewardsListMenu"));
|
||||
@ -276,14 +283,14 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
this.dropTableTypeEditMenu.initializePanel(panelBuilder1);
|
||||
|
||||
this.sprayDropTableMainEditMenu.initializePanel(panelBuilder2);
|
||||
this.sprayRewardListEditMenu.initializePanel(panelBuilder3);
|
||||
this.sprayRewardMainEditMenu.initializePanel(panelBuilder4);
|
||||
this.sprayNewRewardEditMenu.initializePanel(panelBuilder5);
|
||||
this.sprayDropNewRewardEditPanel.initializePanel(panelBuilder4);
|
||||
this.sprayDropRewardListPanel.initializePanel(panelBuilder5);
|
||||
this.sprayDropRewardMainEditPanel.initializePanel(panelBuilder3);
|
||||
|
||||
this.dropDropTableMainEditMenu.initializePanel(panelBuilder6);
|
||||
this.dropRewardListEditMenu.initializePanel(panelBuilder7);
|
||||
this.dropRewardMainEditMenu.initializePanel(panelBuilder8);
|
||||
this.dropNewRewardEditMenu.initializePanel(panelBuilder9);
|
||||
this.dropDropNewRewardEditPanel.initializePanel(panelBuilder4);
|
||||
this.dropDropRewardListPanel.initializePanel(panelBuilder5);
|
||||
this.dropDropRewardMainEditPanel.initializePanel(panelBuilder3);
|
||||
|
||||
this.giveRewardPositionListMenu.initializePanel(panelBuilder10);
|
||||
this.giveRewardPositionListMenu.initializePanel(panelBuilder11);
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.drop;
|
||||
package com.songoda.epicbosses.panel.droptables.rewards;
|
||||
|
||||
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.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.interfaces.IDropTableNewRewardEditor;
|
||||
import com.songoda.epicbosses.utils.Message;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
@ -22,14 +22,14 @@ import java.util.Map;
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 29-Dec-18
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class DropNewRewardEditorPanel extends SubVariablePanelHandler<DropTable, DropTableElement> {
|
||||
public abstract class DropTableNewRewardEditorPanel<SubVariable> extends SubVariablePanelHandler<DropTable, SubVariable> implements IDropTableNewRewardEditor<SubVariable> {
|
||||
|
||||
private ItemsFileManager itemsFileManager;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public DropNewRewardEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
public DropTableNewRewardEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.itemsFileManager = plugin.getItemStackManager();
|
||||
@ -37,28 +37,28 @@ public class DropNewRewardEditorPanel extends SubVariablePanelHandler<DropTable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
public void fillPanel(Panel panel, DropTable dropTable, SubVariable subVariable) {
|
||||
Map<String, ItemStackHolder> itemStacks = this.itemsFileManager.getItemStackHolders();
|
||||
List<String> currentKeys = new ArrayList<>(dropTableElement.getDropRewards().keySet());
|
||||
List<String> currentKeys = getCurrentKeys(subVariable);
|
||||
List<String> filteredKeys = getFilteredKeys(itemStacks, currentKeys);
|
||||
int maxPage = panel.getMaxPage(filteredKeys);
|
||||
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
if(requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, dropTable, dropTableElement, filteredKeys, itemStacks);
|
||||
loadPage(panel, requestedPage, dropTable, subVariable, filteredKeys, itemStacks);
|
||||
return true;
|
||||
}));
|
||||
|
||||
loadPage(panel, 0, dropTable, dropTableElement, filteredKeys, itemStacks);
|
||||
loadPage(panel, 0, dropTable, subVariable, filteredKeys, itemStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
public void openFor(Player player, DropTable dropTable, SubVariable subVariable) {
|
||||
Panel panel = getPanelBuilder().getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropRewardListEditMenu(), dropTable, dropTableElement);
|
||||
.setParentPanelHandler(getParentPanelHandler(), dropTable, subVariable);
|
||||
|
||||
fillPanel(panel, dropTable, dropTableElement);
|
||||
fillPanel(panel, dropTable, subVariable);
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class DropNewRewardEditorPanel extends SubVariablePanelHandler<DropTable,
|
||||
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, DropTableElement dropTableElement, List<String> filteredKeys, Map<String, ItemStackHolder> itemStacks) {
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, SubVariable subVariable, List<String> filteredKeys, Map<String, ItemStackHolder> itemStacks) {
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= filteredKeys.size()) {
|
||||
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{});
|
||||
@ -77,14 +77,13 @@ public class DropNewRewardEditorPanel extends SubVariablePanelHandler<DropTable,
|
||||
ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
panel.setItem(realisticSlot, itemStack, event -> {
|
||||
Map<String, Double> currentRewards = dropTableElement.getDropRewards();
|
||||
Map<String, Double> currentRewards = getRewards(subVariable);
|
||||
|
||||
currentRewards.put(name, 50.0);
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(dropTableElement));
|
||||
this.plugin.getDropTableFileManager().save();
|
||||
saveDropTable(this.plugin.getDropTableFileManager(), dropTable, subVariable);
|
||||
|
||||
this.bossPanelManager.getDropRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement, name);
|
||||
Message.Boss_DropTable_DropAddedNewReward.msg(event.getWhoClicked(), BossAPI.getDropTableName(dropTable));
|
||||
getRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, subVariable, name);
|
||||
Message.Boss_DropTable_AddedNewReward.msg(event.getWhoClicked(), BossAPI.getDropTableName(dropTable));
|
||||
});
|
||||
}
|
||||
});
|
@ -1,14 +1,14 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.spray;
|
||||
package com.songoda.epicbosses.panel.droptables.rewards;
|
||||
|
||||
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.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.skills.Skill;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.interfaces.IDropTableRewardMainEditor;
|
||||
import com.songoda.epicbosses.utils.Message;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.ObjectUtils;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ClickAction;
|
||||
import com.songoda.epicbosses.utils.panel.base.handlers.SubSubVariablePanelHandler;
|
||||
@ -23,36 +23,34 @@ import java.util.Map;
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Dec-18
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class SprayRewardMainEditorPanel extends SubSubVariablePanelHandler<DropTable, SprayTableElement, String> {
|
||||
public abstract class DropTableRewardMainEditorPanel<SubVariable> extends SubSubVariablePanelHandler<DropTable, SubVariable, String> implements IDropTableRewardMainEditor<SubVariable> {
|
||||
|
||||
private DropTableFileManager dropTableFileManager;
|
||||
|
||||
public SprayRewardMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
public DropTableRewardMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.dropTableFileManager = plugin.getDropTableFileManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, SprayTableElement sprayTableElement, String string) {
|
||||
public void openFor(Player player, DropTable dropTable, SubVariable subVariable, String s) {
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
Double chance = sprayTableElement.getSprayRewards().get(string);
|
||||
|
||||
if(chance == null) chance = 50.0;
|
||||
double chance = ObjectUtils.getValue(getChance(subVariable, s), 50.0);
|
||||
|
||||
replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance));
|
||||
replaceMap.put("{itemStack}", string);
|
||||
replaceMap.put("{itemStack}", s);
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getSprayRewardListEditMenu(), dropTable, sprayTableElement);
|
||||
.setParentPanelHandler(getParentPanelHandler(), dropTable, subVariable);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Chance").forEach(slot -> panel.setOnClick(slot, getChanceAction(dropTable, sprayTableElement, string)));
|
||||
panelBuilderCounter.getSlotsWith("Remove").forEach(slot -> panel.setOnClick(slot, getRemoveAction(dropTable, sprayTableElement, string)));
|
||||
panelBuilderCounter.getSlotsWith("Chance").forEach(slot -> panel.setOnClick(slot, getChanceAction(dropTable, subVariable, s)));
|
||||
panelBuilderCounter.getSlotsWith("Remove").forEach(slot -> panel.setOnClick(slot, getRemoveAction(dropTable, subVariable, s)));
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
@ -62,7 +60,7 @@ public class SprayRewardMainEditorPanel extends SubSubVariablePanelHandler<DropT
|
||||
|
||||
}
|
||||
|
||||
private ClickAction getChanceAction(DropTable dropTable, SprayTableElement sprayTableElement, String name) {
|
||||
private ClickAction getChanceAction(DropTable dropTable, SubVariable subVariable, String name) {
|
||||
return event -> {
|
||||
ClickType clickType = event.getClick();
|
||||
double amountToModifyBy;
|
||||
@ -78,7 +76,7 @@ public class SprayRewardMainEditorPanel extends SubSubVariablePanelHandler<DropT
|
||||
}
|
||||
|
||||
String modifyValue = amountToModifyBy > 0? "increased" : "decreased";
|
||||
Map<String, Double> rewards = sprayTableElement.getSprayRewards();
|
||||
Map<String, Double> rewards = getRewards(subVariable);
|
||||
double currentValue = rewards.getOrDefault(name, 50.0);
|
||||
double newValue = currentValue + amountToModifyBy;
|
||||
|
||||
@ -91,29 +89,24 @@ public class SprayRewardMainEditorPanel extends SubSubVariablePanelHandler<DropT
|
||||
}
|
||||
|
||||
rewards.put(name, newValue);
|
||||
sprayTableElement.setSprayRewards(rewards);
|
||||
save(dropTable, sprayTableElement);
|
||||
openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement, name);
|
||||
setRewards(subVariable, rewards);
|
||||
saveDropTable(this.dropTableFileManager, dropTable, subVariable);
|
||||
openFor((Player) event.getWhoClicked(), dropTable, subVariable, name);
|
||||
|
||||
Message.Boss_DropTable_SprayRewardChance.msg(event.getWhoClicked(), modifyValue, BossAPI.getDropTableName(dropTable), NumberUtils.get().formatDouble(newValue));
|
||||
Message.Boss_DropTable_RewardChance.msg(event.getWhoClicked(), modifyValue, BossAPI.getDropTableName(dropTable), NumberUtils.get().formatDouble(newValue));
|
||||
};
|
||||
}
|
||||
|
||||
private ClickAction getRemoveAction(DropTable dropTable, SprayTableElement sprayTableElement, String name) {
|
||||
private ClickAction getRemoveAction(DropTable dropTable, SubVariable subVariable, String name) {
|
||||
return event -> {
|
||||
Map<String, Double> current = sprayTableElement.getSprayRewards();
|
||||
Map<String, Double> rewards = getRewards(subVariable);
|
||||
|
||||
current.remove(name);
|
||||
sprayTableElement.setSprayRewards(current);
|
||||
save(dropTable, sprayTableElement);
|
||||
rewards.remove(name);
|
||||
setRewards(subVariable, rewards);
|
||||
saveDropTable(this.dropTableFileManager, dropTable, subVariable);
|
||||
|
||||
Message.Boss_DropTable_SprayRewardRemoved.msg(event.getWhoClicked());
|
||||
this.bossPanelManager.getSprayRewardListEditMenu().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement);
|
||||
Message.Boss_DropTable_RewardRemoved.msg(event.getWhoClicked());
|
||||
getParentPanelHandler().openFor((Player) event.getWhoClicked(), dropTable, subVariable);
|
||||
};
|
||||
}
|
||||
|
||||
private void save(DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(sprayTableElement));
|
||||
this.dropTableFileManager.save();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.drop;
|
||||
package com.songoda.epicbosses.panel.droptables.rewards;
|
||||
|
||||
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.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.interfaces.IDropTableRewardsListEditor;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
@ -24,14 +24,14 @@ import java.util.Map;
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 29-Dec-18
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class DropRewardsListEditorPanel extends SubVariablePanelHandler<DropTable, DropTableElement> {
|
||||
public abstract class DropTableRewardsListEditorPanel<SubVariable> extends SubVariablePanelHandler<DropTable, SubVariable> implements IDropTableRewardsListEditor<SubVariable> {
|
||||
|
||||
private ItemsFileManager itemsFileManager;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public DropRewardsListEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
public DropTableRewardsListEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.plugin = plugin;
|
||||
@ -39,23 +39,23 @@ public class DropRewardsListEditorPanel extends SubVariablePanelHandler<DropTabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
Map<String, Double> rewardMap = dropTableElement.getDropRewards();
|
||||
public void fillPanel(Panel panel, DropTable dropTable, SubVariable subVariable) {
|
||||
Map<String, Double> rewardMap = getRewards(subVariable);
|
||||
List<String> keyList = new ArrayList<>(rewardMap.keySet());
|
||||
int maxPage = panel.getMaxPage(keyList);
|
||||
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
panel.setOnPageChange((player, currentPage, requestedPage) -> {
|
||||
if(requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, dropTable, dropTableElement, rewardMap, keyList);
|
||||
loadPage(panel, requestedPage, dropTable, subVariable, rewardMap, keyList);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
|
||||
loadPage(panel, 0, dropTable, dropTableElement, rewardMap, keyList);
|
||||
loadPage(panel, 0, dropTable, subVariable, rewardMap, keyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
public void openFor(Player player, DropTable dropTable, SubVariable subVariable) {
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
|
||||
@ -64,10 +64,10 @@ public class DropRewardsListEditorPanel extends SubVariablePanelHandler<DropTabl
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropDropTableMainEditMenu(), dropTable, dropTableElement);
|
||||
.setParentPanelHandler(getParentPanelHandler(), dropTable, subVariable);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("NewReward").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getDropNewRewardEditMenu().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement)));
|
||||
fillPanel(panel, dropTable, dropTableElement);
|
||||
panelBuilderCounter.getSlotsWith("NewReward").forEach(slot -> panel.setOnClick(slot, event -> getNewRewardPanelHandler().openFor((Player) event.getWhoClicked(), dropTable, subVariable)));
|
||||
fillPanel(panel, dropTable, subVariable);
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class DropRewardsListEditorPanel extends SubVariablePanelHandler<DropTabl
|
||||
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, DropTableElement dropTableElement, Map<String, Double> rewardMap, List<String> keyList) {
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, SubVariable subVariable, Map<String, Double> rewardMap, List<String> keyList) {
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= keyList.size()) {
|
||||
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {});
|
||||
@ -96,8 +96,8 @@ public class DropRewardsListEditorPanel extends SubVariablePanelHandler<DropTabl
|
||||
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.RewardList.name"), replaceMap);
|
||||
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.RewardList.lore"), replaceMap);
|
||||
|
||||
panel.setItem(realisticSlot, itemStack, event -> this.bossPanelManager.getDropRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement, name));
|
||||
panel.setItem(realisticSlot, itemStack, event -> getRewardMainEditPanel().openFor((Player) event.getWhoClicked(), dropTable, subVariable, name));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.songoda.epicbosses.panel.droptables.rewards.interfaces;
|
||||
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public interface IDropTableNewRewardEditor<SubVariable> {
|
||||
|
||||
List<String> getCurrentKeys(SubVariable subVariable);
|
||||
|
||||
ISubVariablePanelHandler<DropTable, SubVariable> getParentPanelHandler();
|
||||
|
||||
Map<String, Double> getRewards(SubVariable subVariable);
|
||||
|
||||
void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, SubVariable subVariable);
|
||||
|
||||
ISubSubVariablePanelHandler<DropTable, SubVariable, String> getRewardMainEditMenu();
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.songoda.epicbosses.panel.droptables.rewards.interfaces;
|
||||
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public interface IDropTableRewardMainEditor<SubVariable> {
|
||||
|
||||
double getChance(SubVariable subVariable, String name);
|
||||
|
||||
ISubVariablePanelHandler<DropTable, SubVariable> getParentPanelHandler();
|
||||
|
||||
Map<String, Double> getRewards(SubVariable subVariable);
|
||||
|
||||
void setRewards(SubVariable subVariable, Map<String, Double> rewards);
|
||||
|
||||
void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, SubVariable subVariable);
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.songoda.epicbosses.panel.droptables.rewards.interfaces;
|
||||
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public interface IDropTableRewardsListEditor<SubVariable> {
|
||||
|
||||
Map<String, Double> getRewards(SubVariable subVariable);
|
||||
|
||||
ISubVariablePanelHandler<DropTable, SubVariable> getParentPanelHandler();
|
||||
|
||||
ISubVariablePanelHandler<DropTable, SubVariable> getNewRewardPanelHandler();
|
||||
|
||||
ISubSubVariablePanelHandler<DropTable, SubVariable, String> getRewardMainEditPanel();
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class DropDropNewRewardPanel extends DropTableNewRewardEditorPanel<DropTableElement> {
|
||||
|
||||
public DropDropNewRewardPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCurrentKeys(DropTableElement dropTableElement) {
|
||||
return new ArrayList<>(dropTableElement.getDropRewards().keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, DropTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getDropDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(DropTableElement dropTableElement) {
|
||||
return dropTableElement.getDropRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(dropTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, DropTableElement, String> getRewardMainEditMenu() {
|
||||
return this.bossPanelManager.getDropDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.drop;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.DropTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class DropDropRewardListPanel extends DropTableRewardsListEditorPanel<DropTableElement> {
|
||||
|
||||
public DropDropRewardListPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(DropTableElement dropTableElement) {
|
||||
return dropTableElement.getDropRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, DropTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getDropDropTableMainEditMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, DropTableElement> getNewRewardPanelHandler() {
|
||||
return this.bossPanelManager.getDropDropNewRewardEditPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, DropTableElement, String> getRewardMainEditPanel() {
|
||||
return this.bossPanelManager.getDropDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
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.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class DropDropRewardMainEditPanel extends DropTableRewardMainEditorPanel<DropTableElement> {
|
||||
|
||||
public DropDropRewardMainEditPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChance(DropTableElement dropTableElement, String name) {
|
||||
Map<String, Double> dropMap = dropTableElement.getDropRewards();
|
||||
|
||||
return dropMap.getOrDefault(name, 50.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, DropTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getDropDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(DropTableElement dropTableElement) {
|
||||
return dropTableElement.getDropRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRewards(DropTableElement dropTableElement, Map<String, Double> rewards) {
|
||||
dropTableElement.setDropRewards(rewards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, DropTableElement dropTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(dropTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
}
|
@ -59,7 +59,7 @@ public class DropDropTableMainEditorPanel extends SubVariablePanelHandler<DropTa
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getMainDropTableEditMenu(), dropTable);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getDropRewardListEditMenu().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getDropDropRewardListPanel().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("RandomDrops").forEach(slot -> panel.setOnClick(slot, getRandomDropsAction(dropTable, dropTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("MaxDrops").forEach(slot -> panel.setOnClick(slot, getMaxDropsAction(dropTable, dropTableElement)));
|
||||
|
||||
|
@ -1,119 +0,0 @@
|
||||
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.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.utils.Message;
|
||||
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.SubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 29-Dec-18
|
||||
*/
|
||||
public class DropRewardMainEditorPanel extends SubSubVariablePanelHandler<DropTable, DropTableElement, String> {
|
||||
|
||||
private DropTableFileManager dropTableFileManager;
|
||||
|
||||
public DropRewardMainEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.dropTableFileManager = plugin.getDropTableFileManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, DropTableElement dropTableElement, String s) {
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
Double chance = dropTableElement.getDropRewards().get(s);
|
||||
|
||||
if(chance == null) chance = 50.0;
|
||||
|
||||
replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance));
|
||||
replaceMap.put("{itemStack}", s);
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getDropRewardListEditMenu(), dropTable, dropTableElement);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Chance").forEach(slot -> panel.setOnClick(slot, getChanceAction(dropTable, dropTableElement, s)));
|
||||
panelBuilderCounter.getSlotsWith("Remove").forEach(slot -> panel.setOnClick(slot, getRemoveAction(dropTable, dropTableElement, s)));
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
|
||||
private ClickAction getChanceAction(DropTable dropTable, DropTableElement dropTableElement, String name) {
|
||||
return event -> {
|
||||
ClickType clickType = event.getClick();
|
||||
double amountToModifyBy;
|
||||
|
||||
if(clickType == ClickType.SHIFT_LEFT) {
|
||||
amountToModifyBy = 0.1;
|
||||
} else if(clickType == ClickType.RIGHT) {
|
||||
amountToModifyBy = -1.0;
|
||||
} else if(clickType == ClickType.SHIFT_RIGHT) {
|
||||
amountToModifyBy = -0.1;
|
||||
} else {
|
||||
amountToModifyBy = 1.0;
|
||||
}
|
||||
|
||||
String modifyValue = amountToModifyBy > 0? "increased" : "decreased";
|
||||
Map<String, Double> rewards = dropTableElement.getDropRewards();
|
||||
double currentValue = rewards.getOrDefault(name, 50.0);
|
||||
double newValue = currentValue + amountToModifyBy;
|
||||
|
||||
if(newValue < 0) {
|
||||
newValue = 0;
|
||||
}
|
||||
|
||||
if(newValue > 100) {
|
||||
newValue = 100;
|
||||
}
|
||||
|
||||
rewards.put(name, newValue);
|
||||
dropTableElement.setDropRewards(rewards);
|
||||
save(dropTable, dropTableElement);
|
||||
openFor((Player) event.getWhoClicked(), dropTable, dropTableElement, name);
|
||||
|
||||
Message.Boss_DropTable_DropRewardChance.msg(event.getWhoClicked(), modifyValue, BossAPI.getDropTableName(dropTable), NumberUtils.get().formatDouble(newValue));
|
||||
};
|
||||
}
|
||||
|
||||
private ClickAction getRemoveAction(DropTable dropTable, DropTableElement dropTableElement, String name) {
|
||||
return event -> {
|
||||
Map<String, Double> current = dropTableElement.getDropRewards();
|
||||
|
||||
current.remove(name);
|
||||
dropTableElement.setDropRewards(current);
|
||||
save(dropTable, dropTableElement);
|
||||
|
||||
Message.Boss_DropTable_DropRewardRemoved.msg(event.getWhoClicked());
|
||||
this.bossPanelManager.getDropRewardListEditMenu().openFor((Player) event.getWhoClicked(), dropTable, dropTableElement);
|
||||
};
|
||||
}
|
||||
|
||||
private void save(DropTable dropTable, DropTableElement dropTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(dropTableElement));
|
||||
this.dropTableFileManager.save();
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
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.droptable.elements.GiveTableSubElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.handlers.GiveRewardEditHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveDropNewRewardPanel extends DropTableNewRewardEditorPanel<GiveRewardEditHandler> {
|
||||
|
||||
public GiveDropNewRewardPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCurrentKeys(GiveRewardEditHandler giveRewardEditHandler) {
|
||||
return new ArrayList<>(giveRewardEditHandler.getGiveTableSubElement().getItems().keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getGiveDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(GiveRewardEditHandler giveRewardEditHandler) {
|
||||
return giveRewardEditHandler.getGiveTableSubElement().getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, GiveRewardEditHandler giveRewardEditHandler) {
|
||||
GiveTableSubElement giveTableSubElement = giveRewardEditHandler.getGiveTableSubElement();
|
||||
GiveTableElement giveTableElement = giveRewardEditHandler.getGiveTableElement();
|
||||
Map<String, Map<String, GiveTableSubElement>> positionMap = giveTableElement.getGiveRewards();
|
||||
Map<String, GiveTableSubElement> rewardMap = positionMap.get(giveRewardEditHandler.getDamagePosition());
|
||||
|
||||
rewardMap.put(giveRewardEditHandler.getDropSection(), giveTableSubElement);
|
||||
positionMap.put(giveRewardEditHandler.getDamagePosition(), rewardMap);
|
||||
giveTableElement.setGiveRewards(positionMap);
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(giveTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, GiveRewardEditHandler, String> getRewardMainEditMenu() {
|
||||
return this.bossPanelManager.getGiveDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.handlers.GiveRewardEditHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveDropRewardListPanel extends DropTableRewardsListEditorPanel<GiveRewardEditHandler> {
|
||||
|
||||
public GiveDropRewardListPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(GiveRewardEditHandler giveRewardEditHandler) {
|
||||
return giveRewardEditHandler.getGiveTableSubElement().getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getGiveRewardMainEditMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> getNewRewardPanelHandler() {
|
||||
return this.bossPanelManager.getGiveDropNewRewardEditPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, GiveRewardEditHandler, String> getRewardMainEditPanel() {
|
||||
return this.bossPanelManager.getGiveDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
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.droptable.elements.GiveTableSubElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.handlers.GiveRewardEditHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveDropRewardMainEditPanel extends DropTableRewardMainEditorPanel<GiveRewardEditHandler> {
|
||||
|
||||
public GiveDropRewardMainEditPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChance(GiveRewardEditHandler giveRewardEditHandler, String name) {
|
||||
Map<String, Double> dropMap = giveRewardEditHandler.getGiveTableSubElement().getItems();
|
||||
|
||||
return dropMap.getOrDefault(name, 50.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, GiveRewardEditHandler> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getGiveDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(GiveRewardEditHandler giveRewardEditHandler) {
|
||||
return giveRewardEditHandler.getGiveTableSubElement().getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRewards(GiveRewardEditHandler giveRewardEditHandler, Map<String, Double> rewards) {
|
||||
giveRewardEditHandler.getGiveTableSubElement().setItems(rewards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, GiveRewardEditHandler giveRewardEditHandler) {
|
||||
GiveTableSubElement giveTableSubElement = giveRewardEditHandler.getGiveTableSubElement();
|
||||
GiveTableElement giveTableElement = giveRewardEditHandler.getGiveTableElement();
|
||||
Map<String, Map<String, GiveTableSubElement>> positionMap = giveTableElement.getGiveRewards();
|
||||
Map<String, GiveTableSubElement> rewardMap = positionMap.get(giveRewardEditHandler.getDamagePosition());
|
||||
|
||||
rewardMap.put(giveRewardEditHandler.getDropSection(), giveTableSubElement);
|
||||
positionMap.put(giveRewardEditHandler.getDamagePosition(), rewardMap);
|
||||
giveTableElement.setGiveRewards(positionMap);
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(giveTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.GiveTableSubElement;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.types.give.handlers.GiveRewardEditHandler;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
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.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveRewardDropsListEditPanel extends SubVariablePanelHandler<DropTable, GiveRewardEditHandler> {
|
||||
|
||||
private ItemsFileManager itemsFileManager;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public GiveRewardDropsListEditPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.itemsFileManager = plugin.getItemStackManager();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, GiveRewardEditHandler giveRewardEditHandler) {
|
||||
GiveTableSubElement giveTableSubElement = giveRewardEditHandler.getGiveTableSubElement();
|
||||
Map<String, Double> rewardMap = giveTableSubElement.getItems();
|
||||
List<String> keyList = new ArrayList<>();
|
||||
int maxPage = panel.getMaxPage(keyList);
|
||||
|
||||
panel.setOnPageChange((player, currentPage, requestedPage) -> {
|
||||
if(requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, dropTable, giveRewardEditHandler, rewardMap, keyList);
|
||||
return true;
|
||||
});
|
||||
|
||||
loadPage(panel, 0, dropTable, giveRewardEditHandler, rewardMap, keyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, GiveRewardEditHandler giveRewardEditHandler) {
|
||||
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.getGiveRewardMainEditMenu(), dropTable, giveRewardEditHandler);
|
||||
|
||||
// panelBuilderCounter.getSlotsWith("NewReward").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getSprayNewRewardEditMenu().openFor((Player) event.getWhoClicked(), dropTable, giveRewardEditHandler)));
|
||||
fillPanel(panel, dropTable, giveRewardEditHandler);
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, GiveRewardEditHandler giveRewardEditHandler, Map<String, Double> rewardMap, List<String> keyList) {
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= keyList.size()) {
|
||||
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {});
|
||||
} else {
|
||||
String name = keyList.get(slot);
|
||||
Double chance = rewardMap.get(name);
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
|
||||
if(chance == null) chance = 100.0;
|
||||
|
||||
replaceMap.put("{itemName}", name);
|
||||
replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance));
|
||||
|
||||
ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(this.itemsFileManager.getItemStackHolder(name));
|
||||
|
||||
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.RewardList.name"), replaceMap);
|
||||
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.RewardList.lore"), replaceMap);
|
||||
|
||||
// panel.setItem(realisticSlot, itemStack, event -> this.bossPanelManager.getSprayRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, giveRewardEditHandler, name));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveRewardDropsMainEditPanel {
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.give.drops;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class GiveRewardDropsNewDropEditPanel {
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableNewRewardEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class SprayDropNewRewardPanel extends DropTableNewRewardEditorPanel<SprayTableElement> {
|
||||
|
||||
public SprayDropNewRewardPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCurrentKeys(SprayTableElement sprayTableElement) {
|
||||
return new ArrayList<>(sprayTableElement.getSprayRewards().keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, SprayTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getSprayDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(SprayTableElement sprayTableElement) {
|
||||
return sprayTableElement.getSprayRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(sprayTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, SprayTableElement, String> getRewardMainEditMenu() {
|
||||
return this.bossPanelManager.getSprayDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.songoda.epicbosses.panel.droptables.types.spray;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.droptable.DropTable;
|
||||
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardsListEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubSubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class SprayDropRewardListPanel extends DropTableRewardsListEditorPanel<SprayTableElement> {
|
||||
|
||||
public SprayDropRewardListPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(SprayTableElement sprayTableElement) {
|
||||
return sprayTableElement.getSprayRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, SprayTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getSprayDropTableMainEditMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, SprayTableElement> getNewRewardPanelHandler() {
|
||||
return this.bossPanelManager.getSprayDropNewRewardEditPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubSubVariablePanelHandler<DropTable, SprayTableElement, String> getRewardMainEditPanel() {
|
||||
return this.bossPanelManager.getSprayDropRewardMainEditPanel();
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
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.managers.files.DropTableFileManager;
|
||||
import com.songoda.epicbosses.panel.droptables.rewards.DropTableRewardMainEditorPanel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jan-19
|
||||
*/
|
||||
public class SprayDropRewardMainEditPanel extends DropTableRewardMainEditorPanel<SprayTableElement> {
|
||||
|
||||
public SprayDropRewardMainEditPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChance(SprayTableElement sprayTableElement, String name) {
|
||||
Map<String, Double> dropMap = sprayTableElement.getSprayRewards();
|
||||
|
||||
return dropMap.getOrDefault(name, 50.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubVariablePanelHandler<DropTable, SprayTableElement> getParentPanelHandler() {
|
||||
return this.bossPanelManager.getSprayDropRewardListPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Double> getRewards(SprayTableElement sprayTableElement) {
|
||||
return sprayTableElement.getSprayRewards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRewards(SprayTableElement sprayTableElement, Map<String, Double> rewards) {
|
||||
sprayTableElement.setSprayRewards(rewards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDropTable(DropTableFileManager dropTableFileManager, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(sprayTableElement));
|
||||
dropTableFileManager.save();
|
||||
}
|
||||
}
|
@ -62,7 +62,7 @@ public class SprayDropTableMainEditorPanel extends SubVariablePanelHandler<DropT
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getMainDropTableEditMenu(), dropTable);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getSprayRewardListEditMenu().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("Rewards").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getSprayDropRewardListPanel().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("RandomDrops").forEach(slot -> panel.setOnClick(slot, getRandomDropsAction(dropTable, sprayTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("MaxDistance").forEach(slot -> panel.setOnClick(slot, getMaxDistanceAction(dropTable, sprayTableElement)));
|
||||
panelBuilderCounter.getSlotsWith("MaxDrops").forEach(slot -> panel.setOnClick(slot, getMaxDropsAction(dropTable, sprayTableElement)));
|
||||
|
@ -1,104 +0,0 @@
|
||||
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.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.utils.Message;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
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 org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Dec-18
|
||||
*/
|
||||
public class SprayNewRewardEditorPanel extends SubVariablePanelHandler<DropTable, SprayTableElement> {
|
||||
|
||||
private ItemsFileManager itemsFileManager;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public SprayNewRewardEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.itemsFileManager = plugin.getItemStackManager();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
Map<String, ItemStackHolder> itemStacks = this.itemsFileManager.getItemStackHolders();
|
||||
List<String> currentKeys = new ArrayList<>(sprayTableElement.getSprayRewards().keySet());
|
||||
List<String> filteredKeys = getFilteredKeys(itemStacks, currentKeys);
|
||||
int maxPage = panel.getMaxPage(filteredKeys);
|
||||
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
if(requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, dropTable, sprayTableElement, filteredKeys, itemStacks);
|
||||
return true;
|
||||
}));
|
||||
|
||||
loadPage(panel, 0, dropTable, sprayTableElement, filteredKeys, itemStacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
Panel panel = getPanelBuilder().getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getSprayRewardListEditMenu(), dropTable, sprayTableElement);
|
||||
|
||||
fillPanel(panel, dropTable, sprayTableElement);
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, SprayTableElement sprayTableElement, List<String> filteredKeys, Map<String, ItemStackHolder> itemStacks) {
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= filteredKeys.size()) {
|
||||
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{});
|
||||
} else {
|
||||
String name = filteredKeys.get(slot);
|
||||
ItemStackHolder itemStackHolder = itemStacks.get(name);
|
||||
ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(itemStackHolder);
|
||||
|
||||
panel.setItem(realisticSlot, itemStack, event -> {
|
||||
Map<String, Double> currentRewards = sprayTableElement.getSprayRewards();
|
||||
|
||||
currentRewards.put(name, 50.0);
|
||||
dropTable.setRewards(BossAPI.convertObjectToJsonObject(sprayTableElement));
|
||||
this.plugin.getDropTableFileManager().save();
|
||||
|
||||
this.bossPanelManager.getSprayRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement, name);
|
||||
Message.Boss_DropTable_SprayAddedNewReward.msg(event.getWhoClicked(), BossAPI.getDropTableName(dropTable));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> getFilteredKeys(Map<String, ItemStackHolder> itemStacks, List<String> currentKeys) {
|
||||
List<String> filteredList = new ArrayList<>();
|
||||
|
||||
itemStacks.keySet().forEach(string -> {
|
||||
if(currentKeys.contains(string)) return;
|
||||
|
||||
filteredList.add(string);
|
||||
});
|
||||
|
||||
return filteredList;
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
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.managers.files.ItemsFileManager;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
import com.songoda.epicbosses.utils.panel.base.ClickAction;
|
||||
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.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Dec-18
|
||||
*/
|
||||
public class SprayRewardsListEditorPanel extends SubVariablePanelHandler<DropTable, SprayTableElement> {
|
||||
|
||||
private ItemsFileManager itemsFileManager;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public SprayRewardsListEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.plugin = plugin;
|
||||
this.itemsFileManager = plugin.getItemStackManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, DropTable dropTable, SprayTableElement sprayTableElement) {
|
||||
Map<String, Double> rewardMap = sprayTableElement.getSprayRewards();
|
||||
List<String> keyList = new ArrayList<>(rewardMap.keySet());
|
||||
int maxPage = panel.getMaxPage(keyList);
|
||||
|
||||
panel.setOnPageChange(((player, currentPage, requestedPage) -> {
|
||||
if(requestedPage < 0 || requestedPage > maxPage) return false;
|
||||
|
||||
loadPage(panel, requestedPage, dropTable, sprayTableElement, rewardMap, keyList);
|
||||
return true;
|
||||
}));
|
||||
|
||||
loadPage(panel, 0, dropTable, sprayTableElement, rewardMap, keyList);
|
||||
}
|
||||
|
||||
@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));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setParentPanelHandler(this.bossPanelManager.getSprayDropTableMainEditMenu(), dropTable, sprayTableElement);
|
||||
|
||||
panelBuilderCounter.getSlotsWith("NewReward").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getSprayNewRewardEditMenu().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement)));
|
||||
fillPanel(panel, dropTable, sprayTableElement);
|
||||
|
||||
panel.openFor(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, DropTable dropTable, SprayTableElement sprayTableElement, Map<String, Double> rewardMap, List<String> keyList) {
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= keyList.size()) {
|
||||
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {});
|
||||
} else {
|
||||
String name = keyList.get(slot);
|
||||
Double chance = rewardMap.get(name);
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
|
||||
if(chance == null) chance = 100.0;
|
||||
|
||||
replaceMap.put("{itemName}", name);
|
||||
replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance));
|
||||
|
||||
ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(this.itemsFileManager.getItemStackHolder(name));
|
||||
|
||||
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.RewardList.name"), replaceMap);
|
||||
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.RewardList.lore"), replaceMap);
|
||||
|
||||
panel.setItem(realisticSlot, itemStack, event -> this.bossPanelManager.getSprayRewardMainEditMenu().openFor((Player) event.getWhoClicked(), dropTable, sprayTableElement, name));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -35,12 +35,12 @@ public enum Message {
|
||||
Boss_Debug_Toggled("&b&lEpicBosses &8» &7You have toggled debug mode for &fEpicBosses &7to {0}."),
|
||||
|
||||
Boss_DropTable_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||
Boss_DropTable_AddedNewReward("&b&lEpicBosses &8» &7You have added a new reward to the drop table &f{0}&7. Now opening the editing panel for the new reward."),
|
||||
Boss_DropTable_RewardChance("&b&lEpicBosses &8» &7You have {0} the chance for the reward section for &f{1}&7 to &f{2}%&7."),
|
||||
Boss_DropTable_RewardRemoved("&b&lEpicBosses &8» &7You have removed the reward section from the drop table."),
|
||||
Boss_DropTable_SetMaxDrops("&b&lEpicBosses &8» &7You have {0} the max drops for the drop table to &f{1}&7."),
|
||||
Boss_DropTable_SetMaxDistance("&b&lEpicBosses &8» &7You have {0} the max distance for the drop table to &f{1}&7."),
|
||||
Boss_DropTable_SetRandomDrops("&b&lEpicBosses &8» &7You have set the random drops mode for the drop table to &f{0}&7."),
|
||||
Boss_DropTable_SprayAddedNewReward("&b&lEpicBosses &8» &7You have added a new reward to the drop table &f{0}&7. Now opening the editing panel for the new reward."),
|
||||
Boss_DropTable_SprayRewardRemoved("&b&lEpicBosses &8» &7You have removed the reward section from the spray drop table."),
|
||||
Boss_DropTable_SprayRewardChance("&b&lEpicBosses &8» &7You have {0} the chance for the reward section for &f{1}&7 to &f{2}%&7."),
|
||||
Boss_DropTable_DropAddedNewReward("&b&lEpicBosses &8» &7You have added a new reward to the drop table &f{0}&7. Now opening the editing panel for the new reward."),
|
||||
Boss_DropTable_DropRewardChance("&b&lEpicBosses &8» &7You have {0} the chance for the reward section for &f{1}&7 to &f{2}%&7."),
|
||||
Boss_DropTable_DropRewardRemoved("&b&lEpicBosses &8» &7You have removed the reward section from the drop drop table."),
|
||||
|
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-U161</plugin.version>
|
||||
<plugin.version>1.0.0-U162</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