aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/mayaqq/ygasi/util
diff options
context:
space:
mode:
authorMaximusbarcz <maxim.baranek@gmail.com>2023-01-16 18:34:34 +0100
committerMaximusbarcz <maxim.baranek@gmail.com>2023-01-16 18:34:34 +0100
commitf7770f7e2b6d3029b207d8e574a9bb63b10a2651 (patch)
tree1204cf4b609666811955e3993522728fe408e4c6 /src/main/java/dev/mayaqq/ygasi/util
parent290ad0d1d979431fe8bfda966013a8de7b77a7fd (diff)
downloadygasi-f7770f7e2b6d3029b207d8e574a9bb63b10a2651.tar.gz
ygasi-f7770f7e2b6d3029b207d8e574a9bb63b10a2651.tar.bz2
ygasi-f7770f7e2b6d3029b207d8e574a9bb63b10a2651.zip
Improved Reset function, added more translations, added more features to AdvUtils, added more stuff to gui common (now you cannot accidentally click higher skill than the before making you lose skill points), made the entries in the main gui display a barrier because they will be done later after the first public beta release, tried and fail to improve PlayerConnectEvent and thats about it
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/util')
-rw-r--r--src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java b/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java
index b2227fe..708ed36 100644
--- a/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java
+++ b/src/main/java/dev/mayaqq/ygasi/util/AdvUtils.java
@@ -26,7 +26,7 @@ public class AdvUtils {
}
}
- public static void revokeAllAdvancements(ServerPlayerEntity player, String namespace ,String path) {
+ public static void revokeAllAdvancements(ServerPlayerEntity player, String namespace, String path) {
if (player.getServer() == null) {
return;
}
@@ -48,4 +48,21 @@ public class AdvUtils {
}
return player.getAdvancementTracker().getProgress(player.getServer().getAdvancementLoader().get(new Identifier(namespace, path))).isDone();
}
+
+ public static boolean hasBeforeAdvancements(ServerPlayerEntity player, String namespace, String path) {
+ int level = Integer.parseInt(path.substring(path.length() - 1));
+ if (player.getServer() == null) {
+ return false;
+ }
+ for (int i = 1; i < level; i++) {
+ try {
+ if (!getAdvancementProgress(player, namespace, path.substring(0, path.length() - 1) + i)) {
+ return false;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ return true;
+ }
} \ No newline at end of file