Skip to content

Commit

Permalink
Adds Bundle and Generator ID view buttons to the edit panels
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed May 10, 2022
1 parent cc54710 commit 0b6af68
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ private void populateInfo(PanelBuilder panelBuilder)
{
// Users should see only icon
panelBuilder.item(13, this.createButton(Button.BUNDLE_NAME));
panelBuilder.item(22, this.createButton(Button.BUNDLE_ID));
panelBuilder.item(11, this.createButton(Button.BUNDLE_ICON));
panelBuilder.item(14, this.createButton(Button.BUNDLE_DESCRIPTION));
}
Expand Down Expand Up @@ -228,6 +229,14 @@ private PanelItem createButton(Button button)
description.add("");
description.add(this.user.getTranslation(Constants.TIPS + "click-to-change"));
}
case BUNDLE_ID -> {
itemStack = new ItemStack(Material.COMMAND_BLOCK);

clickHandler = (panel, user, clickType, i) -> true;

description.add(this.user.getTranslation(reference + ".value",
Constants.ID, this.bundle.getUniqueId()));
}
case BUNDLE_ICON -> {
itemStack = this.bundle.getGeneratorIcon();

Expand Down Expand Up @@ -641,6 +650,10 @@ private enum Button
* Holds Name type that allows to interact with bundle name.
*/
BUNDLE_NAME,
/**
* Holds ID type.
*/
BUNDLE_ID,
/**
* Holds Name type that allows to interact with bundle icon.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private void populateHeader(PanelBuilder panelBuilder)
private void populateInfo(PanelBuilder panelBuilder)
{
panelBuilder.item(10, this.createButton(Button.NAME));
panelBuilder.item(11, this.createButton(Button.ID));
panelBuilder.item(19, this.createButton(Button.ICON));
panelBuilder.item(28, this.createButton(Button.DESCRIPTION));

Expand Down Expand Up @@ -370,6 +371,14 @@ private PanelItem createButton(Button button)
description.add("");
description.add(this.user.getTranslation(Constants.TIPS + "click-to-change"));
}
case ID -> {
description.add(this.user.getTranslation(reference + ".value",
Constants.ID, this.generatorTier.getUniqueId()));

itemStack = new ItemStack(Material.COMMAND_BLOCK);

clickHandler = (panel, user, clickType, i) -> true;
}
case ICON, LOCKED_ICON -> {
itemStack = button == Button.LOCKED_ICON ?
this.generatorTier.getLockedIcon() :
Expand Down Expand Up @@ -1560,6 +1569,10 @@ private enum Button
* Holds Name type that allows to interact with generator treasure chance.
*/
TREASURE_CHANCE,
/**
* Holds ID of the generator ID.
*/
ID,
}


Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ stone-generator:
description: |-
&7 Change the bundle name.
value: "&b Name: &r [bundle]"
bundle_id:
name: "&f&l Bundle Id"
description: |-
&7 The current bundle ID.
value: "&b ID: &r [id]"
bundle_icon:
name: "&f&l Bundle Icon"
description: |-
Expand Down Expand Up @@ -331,6 +336,11 @@ stone-generator:
&7 Title for this generator.
&7 Supports color codes.
value: "&b Name: &r [generator]"
id:
name: "&f&l Generator Id"
description: |-
&7 The current generator ID.
value: "&b ID: &r [id]"
icon:
name: "&f&l Generator Icon"
description: |-
Expand Down

0 comments on commit 0b6af68

Please sign in to comment.