aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java8
-rw-r--r--src/main/java/de/hysky/skyblocker/config/configs/GeneralConfig.java3
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/ItemProtection.java23
3 files changed, 26 insertions, 8 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
index f1ab7eb8..70121942 100644
--- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
+++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
@@ -349,6 +349,14 @@ public class GeneralCategory {
newValue -> config.general.itemProtection.protectValuableConsumables = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
+ .option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("skyblocker.config.general.itemProtection.displayChatNotification"))
+ .description(OptionDescription.of(Text.translatable("skyblocker.config.general.itemProtection.displayChatNotification.@Tooltip")))
+ .binding(defaults.general.itemProtection.displayChatNotification,
+ () -> config.general.itemProtection.displayChatNotification,
+ newValue -> config.general.itemProtection.displayChatNotification = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
.build())
//Wiki Lookup
diff --git a/src/main/java/de/hysky/skyblocker/config/configs/GeneralConfig.java b/src/main/java/de/hysky/skyblocker/config/configs/GeneralConfig.java
index a4dcbf8c..73bc4469 100644
--- a/src/main/java/de/hysky/skyblocker/config/configs/GeneralConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/configs/GeneralConfig.java
@@ -231,6 +231,9 @@ public class GeneralConfig {
@SerialEntry
public SlotLockStyle slotLockStyle = SlotLockStyle.FANCY;
+ @SerialEntry
+ public boolean displayChatNotification = true;
+
@SerialEntry
public boolean protectValuableConsumables = true;
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/ItemProtection.java b/src/main/java/de/hysky/skyblocker/skyblock/item/ItemProtection.java
index c691cc56..b18b33b0 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/ItemProtection.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/ItemProtection.java
@@ -60,6 +60,7 @@ public class ItemProtection {
}
private static int protectMyItem(FabricClientCommandSource source) {
+ boolean notifyConfiguration = SkyblockerConfigManager.get().general.itemProtection.displayChatNotification;
ItemStack heldItem = source.getPlayer().getMainHandStack();
if (Utils.isOnSkyblock()) {
@@ -71,13 +72,15 @@ public class ItemProtection {
if (!protectedItems.contains(itemUuid)) {
protectedItems.add(itemUuid);
SkyblockerConfigManager.save();
-
- source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.added", heldItem.getName())));
+ if (notifyConfiguration) {
+ source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.added", heldItem.getName())));
+ }
} else {
protectedItems.remove(itemUuid);
SkyblockerConfigManager.save();
-
- source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.removed", heldItem.getName())));
+ if (notifyConfiguration) {
+ source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.removed", heldItem.getName())));
+ }
}
} else {
source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.noItemUuid")));
@@ -90,6 +93,8 @@ public class ItemProtection {
}
public static void handleKeyPressed(ItemStack heldItem) {
+ boolean notifyConfiguration = SkyblockerConfigManager.get().general.itemProtection.displayChatNotification;
+
PlayerEntity playerEntity = MinecraftClient.getInstance().player;
if (playerEntity == null) {
return;
@@ -111,13 +116,15 @@ public class ItemProtection {
if (!protectedItems.contains(itemUuid)) {
protectedItems.add(itemUuid);
SkyblockerConfigManager.save();
-
- playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.added", heldItem.getName())), false);
+ if (notifyConfiguration) {
+ playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.added", heldItem.getName())), false);
+ }
} else {
protectedItems.remove(itemUuid);
SkyblockerConfigManager.save();
-
- playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.removed", heldItem.getName())), false);
+ if (notifyConfiguration) {
+ playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.removed", heldItem.getName())), false);
+ }
}
} else {
playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.itemProtection.noItemUuid")), false);