|
|
@ -22,6 +22,7 @@ package net.william278.husksync.util;
|
|
|
|
import org.bukkit.*;
|
|
|
|
import org.bukkit.*;
|
|
|
|
import org.bukkit.attribute.Attribute;
|
|
|
|
import org.bukkit.attribute.Attribute;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
|
|
|
|
import org.bukkit.potion.PotionEffectType;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +49,11 @@ public final class BukkitKeyedAdapter {
|
|
|
|
return getRegistryValue(Registry.ATTRIBUTE, key);
|
|
|
|
return getRegistryValue(Registry.ATTRIBUTE, key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
|
|
|
public static PotionEffectType matchEffectType(@NotNull String key) {
|
|
|
|
|
|
|
|
return PotionEffectType.getByName(key); // No registry for this in 1.17 API
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static <T extends Keyed> T getRegistryValue(@NotNull Registry<T> registry, @NotNull String keyString) {
|
|
|
|
private static <T extends Keyed> T getRegistryValue(@NotNull Registry<T> registry, @NotNull String keyString) {
|
|
|
|
final NamespacedKey key = NamespacedKey.fromString(keyString);
|
|
|
|
final NamespacedKey key = NamespacedKey.fromString(keyString);
|
|
|
|
return key != null ? registry.get(key) : null;
|
|
|
|
return key != null ? registry.get(key) : null;
|
|
|
|