Skip to content

Commit

Permalink
gamemode tag for offline players
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 28, 2021
1 parent 54758dd commit 1f0881d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1982,9 +1982,13 @@ else if (foodLevel / maxHunger < 1) {
// @mechanism PlayerTag.gamemode
// @description
// Returns the name of the gamemode the player is currently set to.
// Works with offline players.
// -->
registerOnlineOnlyTag("gamemode", (attribute, object) -> {
return new ElementTag(object.getPlayerEntity().getGameMode().name());
registerTag("gamemode", (attribute, object) -> {
if (object.isOnline()) {
return new ElementTag(object.getPlayerEntity().getGameMode().name());
}
return new ElementTag(object.getNBTEditor().getGameMode().name());
});

// <--[tag]
Expand Down Expand Up @@ -2832,6 +2836,7 @@ public void adjust(Mechanism mechanism) {
// @description
// Sets the game mode of the player.
// Valid gamemodes are survival, creative, adventure, and spectator.
// Works with offline players.
// @tags
// <PlayerTag.gamemode>
// -->
Expand Down

0 comments on commit 1f0881d

Please sign in to comment.