Skip to content

Commit

Permalink
PlayerUtils.getGameMode() null change
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Sep 14, 2024
1 parent a920528 commit b4afa0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit b4afa0b

Please sign in to comment.