Add methods to get translation keys

Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
Jake Potrebic
2020-08-11 19:17:46 +02:00
parent a3e3ba54a0
commit f610d0b477
18 changed files with 186 additions and 30 deletions

View File

@@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
* Represents the various type of game modes that {@link HumanEntity}s may
* have
*/
public enum GameMode {
public enum GameMode implements net.kyori.adventure.translation.Translatable { // Paper - implement Translatable
/**
* Creative mode may fly, build instantly, become invulnerable and create
* free items.
@@ -35,9 +35,18 @@ public enum GameMode {
private final int value;
private static final Map<Integer, GameMode> BY_ID = Maps.newHashMap();
// Paper start - translation keys
private final String translationKey;
@Override
public @org.jetbrains.annotations.NotNull String translationKey() {
return this.translationKey;
}
// Paper end
private GameMode(final int value) {
this.value = value;
this.translationKey = "gameMode." + this.name().toLowerCase(java.util.Locale.ENGLISH); // Paper
}
/**