diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index 2bada0a727..76b4a4d092 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -148,7 +148,7 @@ public static void init() { .set("dimension", () -> Value.string(PlayerUtils.getDimension().name())) .set("opposite_dimension", () -> Value.string(PlayerUtils.getDimension().opposite().name())) - .set("gamemode", () -> mc.player != null ? Value.string(StringUtils.capitalize(PlayerUtils.getGameMode().getName())) : Value.null_()) + .set("gamemode", () -> PlayerUtils.getGameMode() != null ? Value.string(StringUtils.capitalize(PlayerUtils.getGameMode().getName())) : Value.null_()) .set("pos", new ValueMap() .set("_toString", () -> posString(false, false)) @@ -231,6 +231,7 @@ public static String run(Script script, StringBuilder sb) { public static Section runSection(Script script) { return runSection(script, new StringBuilder()); } + public static String run(Script script) { return run(script, new StringBuilder()); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java index f05e1a5bfb..9f74da9817 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java @@ -346,8 +346,9 @@ public static Dimension getDimension() { } public static GameMode getGameMode() { + if (mc.player == null) return null; PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()); - if (playerListEntry == null) return GameMode.SPECTATOR; + if (playerListEntry == null) return null; return playerListEntry.getGameMode(); }