From e1f015f1b05115958e5cc24eba7110815a38bd9e Mon Sep 17 00:00:00 2001 From: nopo Date: Sun, 9 Oct 2022 12:57:51 +1100 Subject: [PATCH] Added option to only work while in a chest --- src/main/java/com/nopo/Config.kt | 8 ++++++++ src/main/java/com/nopo/SlotBind.java | 1 + 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/nopo/Config.kt b/src/main/java/com/nopo/Config.kt index fdaa3ea..7238eec 100644 --- a/src/main/java/com/nopo/Config.kt +++ b/src/main/java/com/nopo/Config.kt @@ -14,6 +14,14 @@ object Config: Vigilant(File("./config/skywars-sorter.toml")) { ) var enabled = true + @Property( + type = PropertyType.SWITCH, + name = "Only Enable While In A Chest", + description = "Doesn't sort when you are in your inventory", + category = "Sorting" + ) + var chestOnly = false + @Property( type = PropertyType.SWITCH, name = "Enable In Skywars", diff --git a/src/main/java/com/nopo/SlotBind.java b/src/main/java/com/nopo/SlotBind.java index b24f902..1f4ee98 100644 --- a/src/main/java/com/nopo/SlotBind.java +++ b/src/main/java/com/nopo/SlotBind.java @@ -32,6 +32,7 @@ public LockedSlot(int boundTo) { @SubscribeEvent public void onWindowClick(SlotClickEvent slotClickEvent) { if (!shouldBeEnabled()) return; + if (SkywarsSorter.config.getChestOnly() && !(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return; LockedSlot locked = new LockedSlot(getSlotToBind(getSlotToBind(slotClickEvent.slot), slotClickEvent));