Skip to content

Commit

Permalink
added "Open chat on warn" configuration option
Browse files Browse the repository at this point in the history
- added german translation
- edited settings sprite
  • Loading branch information
RappyTV committed Mar 22, 2023
1 parent 7b97524 commit 0e19be2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
18 changes: 12 additions & 6 deletions core/src/main/java/com/rappytv/toolwarn/TbwConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,37 @@ public class TbwConfiguration extends AddonConfig {
private final ConfigProperty<Boolean> enabled = new ConfigProperty<>(true);
@SwitchSetting
@SpriteSlot(size = 32, x = 1)
private final ConfigProperty<Boolean> format = new ConfigProperty<>(true);
private final ConfigProperty<Boolean> openChat = new ConfigProperty<>(true);
@SwitchSetting
@SpriteSlot(size = 32, x = 2)
private final ConfigProperty<Boolean> format = new ConfigProperty<>(true);
@SwitchSetting
@SpriteSlot(size = 32, x = 3)
private final ConfigProperty<Boolean> debug = new ConfigProperty<>(false);

@SwitchSetting
@SpriteSlot(size = 32, x = 3)
@SpriteSlot(size = 32, y = 1)
private final ConfigProperty<Boolean> lastHit = new ConfigProperty<>(true);
@SliderSetting(steps = 1, min = 1, max = 25)
@SpriteSlot(size = 32, y = 1)
@SpriteSlot(size = 32, y = 3)
private final ConfigProperty<Integer> swordPercentage = new ConfigProperty<>(5);
@SliderSetting(steps = 1, min = 1, max = 25)
@SpriteSlot(size = 32, x = 1, y = 1)
@SpriteSlot(size = 32, x = 1, y = 3)
private final ConfigProperty<Integer> pickaxePercentage = new ConfigProperty<>(5);
@SliderSetting(steps = 1, min = 1, max = 25)
@SpriteSlot(size = 32, x = 2, y = 1)
@SpriteSlot(size = 32, x = 2, y = 3)
private final ConfigProperty<Integer> axePercentage = new ConfigProperty<>(5);
@SliderSetting(steps = 1, min = 1, max = 25)
@SpriteSlot(size = 32, x = 3, y = 1)
@SpriteSlot(size = 32, x = 3, y = 3)
private final ConfigProperty<Integer> shovelPercentage = new ConfigProperty<>(5);

@Override
public ConfigProperty<Boolean> enabled() {
return enabled;
}
public ConfigProperty<Boolean> openChat() {
return openChat;
}
public ConfigProperty<Boolean> format() {
return format;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public void toolUsed(ItemStack itemStack, ToolType toolType) {

if(itemUsedInt == itemWarnInt) {
if(!warns.contains(itemStack)) {
Laby.labyAPI().minecraft().openChat("");
if(this.config.openChat().get()) Laby.labyAPI().minecraft().openChat("");
Util.msg(I18n.getTranslation("toolwarn.messages.warning", toolType.getWarnPercentage(config)), true);
warns.add(itemStack);
}
} else if(isLastHit(itemStack)) {
if(!warns.contains(itemStack)) {
Laby.labyAPI().minecraft().openChat("");
if(this.config.openChat().get()) Laby.labyAPI().minecraft().openChat("");
Util.msg(Util.getTranslation("toolwarn.messages.lastHit"), true);
warns.add(itemStack);
}
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/resources/assets/toolwarn/i18n/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"enabled": {
"name": "Aktiviert"
},
"openChat": {
"name": "Chat öffnen beim warnen",
"description": "Wenn das Addon dich warnt, wird sich dein Chat öffnen, damit du daran gehindert wirst, die letzten Hits mit deinem Tool zu verbrauchen."
},
"format": {
"name": "Zahlen formatieren",
"description": "Unformatierte Zahl: 1561\nFormatierte Zahl: 1.561"
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/resources/assets/toolwarn/i18n/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"enabled": {
"name": "Activated"
},
"openChat": {
"name": "Open chat on warn",
"description": "When the addon warns you, your chat will open to prevent you from wasting the last durability of your tool."
},
"format": {
"name": "Format numbers",
"description": "Unformatted Number: 1561\nFormatted Number: 1.561"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e19be2

Please sign in to comment.