mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-03-12 06:39:18 +01:00
Fix compatibility with CraftBukkit
Still recommend Spigot, for what it's worth
This commit is contained in:
parent
1a434e9ea2
commit
22c2a4abcc
@ -50,6 +50,7 @@ public class BukkitCloner implements Cloner {
|
||||
} catch (RuntimeException ignored) { }
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static void fromConverter(Supplier<Class<?>> getClass, EquivalentConverter converter) {
|
||||
try {
|
||||
Class<?> nmsClass = getClass.get();
|
||||
@ -80,9 +81,12 @@ public class BukkitCloner implements Cloner {
|
||||
fromManual(MinecraftReflection::getNonNullListClass, source -> nonNullListCloner().clone(source));
|
||||
fromWrapper(MinecraftReflection::getNBTBaseClass, NbtFactory::fromNMS);
|
||||
fromWrapper(MinecraftReflection::getIChatBaseComponentClass, WrappedChatComponent::fromHandle);
|
||||
fromManual(ComponentConverter::getBaseComponentArrayClass, source ->
|
||||
ComponentConverter.clone((BaseComponent[]) source));
|
||||
fromWrapper(WrappedVillagerData::getNmsClass, WrappedVillagerData::fromHandle);
|
||||
|
||||
try {
|
||||
fromManual(ComponentConverter::getBaseComponentArrayClass, source ->
|
||||
ComponentConverter.clone((BaseComponent[]) source));
|
||||
} catch (Throwable ignored) { }
|
||||
}
|
||||
|
||||
private Function<Object, Object> findCloner(Class<?> type) {
|
||||
|
Loading…
Reference in New Issue
Block a user