aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-05 16:17:24 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-05 16:17:24 +0200
commit088007bb1e1b515b897ca6cd9fef232fb2e2048b (patch)
treedfb6b0193a7eda1e94904116be0de4e0e972273c /src/main/java
parent16e7c91cb2e68748b2704d793278943ff9429279 (diff)
downloadNotEnoughUpdates-088007bb1e1b515b897ca6cd9fef232fb2e2048b.tar.gz
NotEnoughUpdates-088007bb1e1b515b897ca6cd9fef232fb2e2048b.tar.bz2
NotEnoughUpdates-088007bb1e1b515b897ca6cd9fef232fb2e2048b.zip
add toggle and config settings
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperChatLoader.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MinionHelper.java45
9 files changed, 68 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
index 297bda8d..5eac048b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
@@ -128,7 +128,6 @@ public class MinionHelperManager {
}
public void onProfileSwitch() {
- //TODO check if the feature is enabled
for (Minion minion : minions.values()) {
minion.setCrafted(false);
minion.setMeetRequirements(false);
@@ -150,6 +149,11 @@ public class MinionHelperManager {
}
public void handleCommand(String[] args) {
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) {
+ Utils.addChatMessage("§e[NEU] Minion Helper gui is disabled!");
+ return;
+ }
+
if (args.length > 1) {
String parameter = args[1];
@@ -192,7 +196,7 @@ public class MinionHelperManager {
int x = Integer.parseInt(args[2]);
int y = Integer.parseInt(args[3]);
Utils.addChatMessage("set page pos to " + x + ";" + y);
- overlay.setTopLeft(new int[] {x, y});
+ overlay.setTopLeft(new int[]{x, y});
return;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
index 9b7ec1f4..b1a4ba06 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
@@ -68,6 +68,7 @@ public class MinionHelperApiLoader {
public void onTick(TickEvent.ClientTickEvent event) {
if (Minecraft.getMinecraft().thePlayer == null) return;
if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
ticks++;
if (ticks % 20 != 0) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperChatLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperChatLoader.java
index e3189fb3..592ebc0e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperChatLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperChatLoader.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.Minion;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
@@ -39,6 +40,7 @@ public class MinionHelperChatLoader {
public void onChat(ClientChatReceivedEvent event) {
if (event.type != 0) return;
String message = event.message.getFormattedText();
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
try {
if (message.startsWith("§r§aYou crafted a §eTier ") && message.contains("§a! That's a new one!")) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
index 5e495889..1e8e3e27 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java
@@ -48,6 +48,7 @@ public class MinionHelperInventoryLoader {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
if (!manager.isReadyToUse()) return;
ticks++;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java
index 74828f51..e73e8e7a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoLoader.java
@@ -67,6 +67,7 @@ public class MinionHelperRepoLoader {
public void onTick(TickEvent.ClientTickEvent event) {
if (Minecraft.getMinecraft().thePlayer == null) return;
if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
ticks++;
if (ticks % 5 != 0) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
index 2cebf0ff..84db8c00 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
@@ -85,6 +85,7 @@ public class MinionHelperOverlay {
@SubscribeEvent
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!manager.inCraftedMinionsInventory()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
if (!manager.isReadyToUse()) {
LinkedHashMap<String, OverviewLine> map = new LinkedHashMap<>();
map.put("§cLoading...", new OverviewText(Collections.emptyList(), () -> {}));
@@ -125,6 +126,7 @@ public class MinionHelperOverlay {
@SubscribeEvent
public void onMouseClick(GuiScreenEvent.MouseInputEvent.Pre event) {
if (!manager.inCraftedMinionsInventory()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
if (!manager.isReadyToUse()) return;
if (!Mouse.getEventButtonState()) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java
index 3638b029..945594a0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.miscgui.minionhelper.render;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.Minion;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
@@ -44,6 +45,7 @@ public class MinionHelperTooltips {
@SubscribeEvent(priority = EventPriority.LOW)
public void onItemTooltip(ItemTooltipEvent event) {
if (!manager.inCraftedMinionsInventory()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.minionHelper.tooltip) return;
if (!manager.isReadyToUse()) return;
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index ade9edfe..bb2ae6ba 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -49,6 +49,7 @@ import io.github.moulberry.notenoughupdates.options.seperateSections.ItemOverlay
import io.github.moulberry.notenoughupdates.options.seperateSections.Itemlist;
import io.github.moulberry.notenoughupdates.options.seperateSections.LocationEdit;
import io.github.moulberry.notenoughupdates.options.seperateSections.Mining;
+import io.github.moulberry.notenoughupdates.options.seperateSections.MinionHelper;
import io.github.moulberry.notenoughupdates.options.seperateSections.Misc;
import io.github.moulberry.notenoughupdates.options.seperateSections.MiscOverlays;
import io.github.moulberry.notenoughupdates.options.seperateSections.NeuAuctionHouse;
@@ -392,6 +393,13 @@ public class NEUConfig extends Config {
@Expose
@Category(
+ name = "Minion Helper",
+ desc = "Minion Helper"
+ )
+ public MinionHelper minionHelper = new MinionHelper();
+
+ @Expose
+ @Category(
name = "Apis",
desc = "Api Data"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MinionHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MinionHelper.java
new file mode 100644
index 00000000..089b2ae7
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MinionHelper.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+//TODO jani rename message format
+public class MinionHelper {
+ @Expose
+ @ConfigOption(
+ name = "Enable gui",
+ desc =
+ "Shows a list in the crafted minions inventory of every available to craft or all missing minion, in multiple pages " +
+ "that you need to get the next minion slot, sorted by upgrade cost"
+ )
+
+ @ConfigEditorBoolean
+ public boolean gui = true;
+ @Expose
+ @ConfigOption(
+ name = "Enable tooltip",
+ desc = "Shows the price per minion at the crafted minions "
+ )
+ @ConfigEditorBoolean
+ public boolean tooltip = true;
+}