MCPcopy Create free account
hub / github.com/PaperMC/Paper / GameMode

Enum GameMode

paper-api/src/main/java/org/bukkit/GameMode.java:12–94  ·  view source on GitHub ↗

Represents the various type of game modes that HumanEntitys may have

Source from the content-addressed store, hash-verified

10 * have
11 */
12public enum GameMode implements net.kyori.adventure.translation.Translatable { // Paper - implement Translatable
13 /**
14 * Creative mode may fly, build instantly, become invulnerable and create
15 * free items.
16 */
17 CREATIVE(1),
18
19 /**
20 * Survival mode is the "normal" gameplay type, with no special features.
21 */
22 SURVIVAL(0),
23
24 /**
25 * Adventure mode cannot break blocks without the correct tools.
26 */
27 ADVENTURE(2),
28
29 /**
30 * Spectator mode cannot interact with the world in any way and is
31 * invisible to normal players. This grants the player the
32 * ability to no-clip through the world.
33 */
34 SPECTATOR(3);
35
36 private final int value;
37 private static final Map<Integer, GameMode> BY_ID = Maps.newHashMap();
38 // Paper start - translation keys
39 private final String translationKey;
40
41 @Override
42 public @org.jetbrains.annotations.NotNull String translationKey() {
43 return this.translationKey;
44 }
45 // Paper end
46
47 private GameMode(final int value) {
48 this.value = value;
49 this.translationKey = "gameMode." + this.name().toLowerCase(java.util.Locale.ENGLISH); // Paper
50 }
51
52 /**
53 * Gets the mode value associated with this GameMode
54 *
55 * @return An integer value of this gamemode
56 * @apiNote Internal Use Only
57 */
58 @org.jetbrains.annotations.ApiStatus.Internal // Paper
59 public int getValue() {
60 return value;
61 }
62
63 /**
64 * Gets the GameMode represented by the specified value
65 *
66 * @param value Value to check
67 * @return Associative {@link GameMode} with the given value, or null if
68 * it doesn't exist
69 * @apiNote Internal Use Only

Callers

nothing calls this directly

Calls 4

newHashMapMethod · 0.80
valuesMethod · 0.65
putMethod · 0.65
getValueMethod · 0.65

Tested by

no test coverage detected