From 474603beb3f6ec9fdafe5e2c8a23317184e11d0f Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 17 Jan 2022 10:12:15 +1100 Subject: [PATCH] SPIGOT-6899: Add Player#getPreviousGameMode By: Doc --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index f9a0af35b7..cec64f29a3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1001,6 +1001,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return GameMode.getByValue(getHandle().gameMode.getGameModeForPlayer().getId()); } + @Override + public GameMode getPreviousGameMode() { + EnumGamemode previousGameMode = getHandle().gameMode.getPreviousGameModeForPlayer(); + + return (previousGameMode == null) ? null : GameMode.getByValue(previousGameMode.getId()); + } + @Override public void giveExp(int exp) { getHandle().giveExperiencePoints(exp);