Add methods to get translation keys
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
@@ -136,7 +136,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* An enum of all material IDs accepted by the official server and client
|
||||
*/
|
||||
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
|
||||
public enum Material implements Keyed, Translatable {
|
||||
public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper
|
||||
//<editor-fold desc="Materials" defaultstate="collapsed">
|
||||
AIR(9648, 0),
|
||||
STONE(22948),
|
||||
@@ -4834,6 +4834,17 @@ public enum Material implements Keyed, Translatable {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
// Paper start - add Translatable
|
||||
@Override
|
||||
public @NotNull String translationKey() {
|
||||
if (this.isItem()) {
|
||||
return java.util.Objects.requireNonNull(this.asItemType()).translationKey();
|
||||
} else {
|
||||
return java.util.Objects.requireNonNull(this.asBlockType()).translationKey();
|
||||
}
|
||||
}
|
||||
// Paper end - add Translatable
|
||||
|
||||
/**
|
||||
* Do not use for any reason.
|
||||
*
|
||||
@@ -5583,9 +5594,11 @@ public enum Material implements Keyed, Translatable {
|
||||
* material
|
||||
* @see #getBlockTranslationKey()
|
||||
* @see #getItemTranslationKey()
|
||||
* @deprecated use {@link #translationKey()}
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
public String getTranslationKey() {
|
||||
if (this.isItem()) {
|
||||
return asItemType().getTranslationKey();
|
||||
|
||||
Reference in New Issue
Block a user