aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorolim <bobq4582@gmail.com>2024-05-03 20:20:31 +0100
committerolim <bobq4582@gmail.com>2024-07-01 14:26:13 +0100
commit6f2fd92438566a6193bbbce15b12dcf329e47368 (patch)
treea22db6b1096721b43a6f1b71c9b87e4803f4b03b /src
parente56c6ebe57a150f6c442f0bbe81875665c3a7ad9 (diff)
downloadSkyblocker-6f2fd92438566a6193bbbce15b12dcf329e47368.tar.gz
Skyblocker-6f2fd92438566a6193bbbce15b12dcf329e47368.tar.bz2
Skyblocker-6f2fd92438566a6193bbbce15b12dcf329e47368.zip
add config options
add config options to toggle each helper for the dojo
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DojoManager.java33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DojoManager.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DojoManager.java
index 45819578..77fb7d2b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DojoManager.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/dojo/DojoManager.java
@@ -1,5 +1,6 @@
package de.hysky.skyblocker.skyblock.crimson.dojo;
+import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.Utils;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
@@ -22,6 +23,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.Arrays;
+import java.util.function.Function;
+import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -34,23 +37,26 @@ public class DojoManager {
protected enum DojoChallenges {
- NONE("none"),
- FORCE("Force"),
- MASTERY("Mastery"),
- DISCIPLINE("Discipline"),
- SWIFTNESS("Swiftness"),
- CONTROL("Control"),
- TENACITY("Tenacity");
+ NONE("none", enabled -> false),
+ FORCE("Force",enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableForceHelper),
+ MASTERY("Mastery", enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableMasteryHelper),
+ DISCIPLINE("Discipline", enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableDisciplineHelper),
+ SWIFTNESS("Swiftness", enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableSwiftnessHelper),
+ CONTROL("Control", enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableControlHelper),
+ TENACITY("Tenacity", enabled -> SkyblockerConfigManager.get().locations.crimsonIsle.dojo.enableTenacityHelper);
private final String name;
+ private final Predicate<Boolean> enabled;
- DojoChallenges(String name) {
+ DojoChallenges(String name, Predicate<Boolean> enabled) {
this.name = name;
+ this.enabled = enabled;
}
public static DojoChallenges from(String name) {
return Arrays.stream(DojoChallenges.values()).filter(n -> name.equals(n.name)).findFirst().orElse(NONE);
}
+
}
protected static DojoChallenges currentChallenge = DojoChallenges.NONE;
@@ -77,7 +83,8 @@ public class DojoManager {
/**
* works out if the player is in dojo and if so what challenge based on chat messages
- * @param text message
+ *
+ * @param text message
* @param overlay is overlay
*/
private static void onMessage(Text text, Boolean overlay) {
@@ -103,11 +110,15 @@ public class DojoManager {
Matcher nextChallenge = TEST_OF_PATTERN.matcher(text.getString());
if (nextChallenge.matches()) {
currentChallenge = DojoChallenges.from(nextChallenge.group(1));
+ if (!currentChallenge.enabled.test(true)) {
+ currentChallenge = DojoChallenges.NONE;
+ }
}
}
/**
* called from the {@link de.hysky.skyblocker.skyblock.entity.MobGlow} class and checks the current challenge to see if zombies should be glowing
+ *
* @param name name of the zombie
* @return if the zombie should glow
*/
@@ -124,6 +135,7 @@ public class DojoManager {
/**
* called from the {@link de.hysky.skyblocker.skyblock.entity.MobGlow} class and checks the current challenge to see zombie outline color
+ *
* @return if the zombie should glow
*/
public static int getColor() {
@@ -139,7 +151,8 @@ public class DojoManager {
/**
* when a block is updated check the current challenge and send the packet to correct helper
- * @param pos the location of the updated block
+ *
+ * @param pos the location of the updated block
* @param state the state of the new block
*/
public static void onBlockUpdate(BlockPos pos, BlockState state) {