#1361: Add more translation keys

By: Miles Holder <mwholder2005@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2024-03-17 10:26:55 +11:00
parent d76a8e373b
commit 434aec3832
5 changed files with 30 additions and 0 deletions

View file

@ -148,6 +148,11 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
return !handle.isCompatibleWith(ench.getHandle());
}
@Override
public String getTranslationKey() {
return handle.getDescriptionId();
}
@Override
public boolean equals(Object other) {
if (this == other) {

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.inventory.trim;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.contents.TranslatableContents;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.craftbukkit.CraftRegistry;
@ -36,4 +37,10 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable<net.minecraft
public NamespacedKey getKey() {
return key;
}
@NotNull
@Override
public String getTranslationKey() {
return ((TranslatableContents) handle.description().getContents()).getKey();
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.inventory.trim;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.contents.TranslatableContents;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.craftbukkit.CraftRegistry;
@ -36,4 +37,10 @@ public class CraftTrimPattern implements TrimPattern, Handleable<net.minecraft.w
public NamespacedKey getKey() {
return key;
}
@NotNull
@Override
public String getTranslationKey() {
return ((TranslatableContents) handle.description().getContents()).getKey();
}
}

View file

@ -108,6 +108,12 @@ public class CraftPotionEffectType extends PotionEffectType implements Handleabl
return Color.fromRGB(handle.getColor());
}
@NotNull
@Override
public String getTranslationKey() {
return handle.getDescriptionId();
}
@Override
public boolean equals(Object other) {
if (this == other) {

View file

@ -375,6 +375,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}
@Override
public String getTranslationKey(final Attribute attribute) {
return CraftAttribute.bukkitToMinecraft(attribute).getDescriptionId();
}
@Override
public FeatureFlag getFeatureFlag(NamespacedKey namespacedKey) {
Preconditions.checkArgument(namespacedKey != null, "NamespaceKey cannot be null");