Fix Biome compatibility on 1.17 (#1895)

* Fix Biome compatibility on 1.17

* check if it's not 1.17.1
This commit is contained in:
Huynh Tien 2022-01-02 08:34:51 +07:00 committed by GitHub
parent b6a739db00
commit c9c9ea0389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import com.google.gson.reflect.TypeToken;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.Flag; import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.database.json.adapters.*; import world.bentobox.bentobox.database.json.adapters.*;
import world.bentobox.bentobox.versions.ServerCompatibility;
/** /**
@ -47,7 +48,7 @@ public class BentoboxTypeAdapterFactory implements TypeAdapterFactory {
if (Location.class.isAssignableFrom(rawType)) { if (Location.class.isAssignableFrom(rawType)) {
// Use our current location adapter for backward compatibility // Use our current location adapter for backward compatibility
return (TypeAdapter<T>) new LocationTypeAdapter(); return (TypeAdapter<T>) new LocationTypeAdapter();
} else if (Biome.class.isAssignableFrom(rawType)) { } else if (Biome.class.isAssignableFrom(rawType) && !ServerCompatibility.getInstance().isVersion(ServerCompatibility.ServerVersion.V1_17_1)) { // TODO: Any better way ?
return (TypeAdapter<T>) new BiomeTypeAdapter(); return (TypeAdapter<T>) new BiomeTypeAdapter();
} else if (Enum.class.isAssignableFrom(rawType)) { } else if (Enum.class.isAssignableFrom(rawType)) {
return new EnumTypeAdapter(rawType); return new EnumTypeAdapter(rawType);