Skip to content

Commit

Permalink
Add overwriteOnActivate to the SettingsPanel.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Dec 10, 2020
1 parent e1c9975 commit 93d0aa3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void build()
panelBuilder.item(24, this.createButton(Action.BORDER_BLOCK_NAME));

panelBuilder.item(16, this.createButton(Action.UNLOCK_NOTIFY));
panelBuilder.item(25, this.createButton(Action.DISABLE_ON_ACTIVATE));

panelBuilder.item(35, this.createButton(Action.RETURN));
panelBuilder.build();
Expand Down Expand Up @@ -362,6 +363,35 @@ private PanelItem createButton(Action button)

break;
}
case DISABLE_ON_ACTIVATE:
{
clickHandler = (panel, user, clickType, i) -> {
this.settings.setOverwriteOnActive(!this.settings.isOverwriteOnActive());
this.saveSettings();
// Update button in panel
this.build();

return true;
};

glow = this.settings.isOverwriteOnActive();

if (glow)
{
description.add(this.user.getTranslation(reference + ".enabled"));
}
else
{
description.add(this.user.getTranslation(reference + ".disabled"));
}

description.add("");
description.add(this.user.getTranslation(Constants.TIPS + "click-to-toggle"));

material = Material.SADDLE;

break;
}
case RETURN:
{
description.add("");
Expand Down Expand Up @@ -456,6 +486,10 @@ private enum Action
* Process unlock notification action.
*/
UNLOCK_NOTIFY,
/**
* Process disable on activate action.
*/
DISABLE_ON_ACTIVATE,
/**
* Process Return Action.
*/
Expand Down
16 changes: 14 additions & 2 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,21 @@ stone-generator:
&7 to a user when he unlocks
&7 a new generator.
enabled: |-
&b Notify on unlock is &a enabled &b .
&b Notify on unlock is &a enabled &b.
disabled: |-
&b Notify on unlock is &c disabled &b .
&b Notify on unlock is &c disabled &b.
disable_on_activate:
name: "&f&l Disable on Activation"
description: |-
&7 Disable oldest active generator,
&7 if user is activation a new
&7 generator.
&7 Usefull for situations where
&7 only single generator is allwoed.
enabled: |-
&b Disable on activation is &a enabled &b.
disabled: |-
&b Disable on activation is &c disabled &b.
# Buttons in Library GUI
library:
name: "&f&l [name]"
Expand Down

0 comments on commit 93d0aa3

Please sign in to comment.