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

@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents the various difficulty levels that are available.
*/
public enum Difficulty {
public enum Difficulty implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
/**
* Players regain health over time, hostile mobs don't spawn, the hunger
* bar does not deplete.
@@ -51,6 +51,12 @@ public enum Difficulty {
return value;
}
// Paper start
@Override
public @org.jetbrains.annotations.NotNull String translationKey() {
return "options.difficulty." + this.name().toLowerCase(java.util.Locale.ENGLISH);
}
// Paper end
/**
* Gets the Difficulty represented by the specified value
*