Files
DeltaZern/paper-api/src/main/java/org/bukkit/GameMode.java
T
Aikar 2825ece820 Fix Spigot annotation mistakes
while some of these may of been true, they are extreme cases and cause
a ton of noise to plugin developers.

Use ApiStatus.Internal instead of Deprecated for actual internal API
that continues to have use (internally).

These do not help plugin developers if they bring moise noise than value.
2019-03-24 18:39:01 -04:00

74 lines
1.8 KiB
Java

package org.bukkit;
import com.google.common.collect.Maps;
import java.util.Map;
import org.bukkit.entity.HumanEntity;
import org.jetbrains.annotations.Nullable;
/**
* Represents the various type of game modes that {@link HumanEntity}s may
* have
*/
public enum GameMode {
/**
* Creative mode may fly, build instantly, become invulnerable and create
* free items.
*/
CREATIVE(1),
/**
* Survival mode is the "normal" gameplay type, with no special features.
*/
SURVIVAL(0),
/**
* Adventure mode cannot break blocks without the correct tools.
*/
ADVENTURE(2),
/**
* Spectator mode cannot interact with the world in anyway and is
* invisible to normal players. This grants the player the
* ability to no-clip through the world.
*/
SPECTATOR(3);
private final int value;
private static final Map<Integer, GameMode> BY_ID = Maps.newHashMap();
private GameMode(final int value) {
this.value = value;
}
/**
* Gets the mode value associated with this GameMode
*
* @return An integer value of this gamemode
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
public int getValue() {
return value;
}
/**
* Gets the GameMode represented by the specified value
*
* @param value Value to check
* @return Associative {@link GameMode} with the given value, or null if
* it doesn't exist
* @apiNote Internal Use Only
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@Nullable
public static GameMode getByValue(final int value) {
return BY_ID.get(value);
}
static {
for (GameMode mode : values()) {
BY_ID.put(mode.getValue(), mode);
}
}
}