mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Bump Configurate
This commit is contained in:
1 parent
4a36172cdb
commit
96385ae889
8 files changed
+34
-35
No files matched your search
@@ -27,8 +27,8 @@ import java.lang.reflect.Type;
|
||||
import java.util.function.Predicate;
|
||||
import net.kyori.adventure.key.InvalidKeyException;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMappingException;
|
||||
import org.spongepowered.configurate.serialize.ScalarSerializer;
|
||||
import org.spongepowered.configurate.serialize.SerializationException;
|
||||
|
||||
public final class KeySerializer extends ScalarSerializer<Key> {
|
||||
public static final KeySerializer INSTANCE = new KeySerializer();
|
||||
@@ -38,15 +38,15 @@ public final class KeySerializer extends ScalarSerializer<Key> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key deserialize(final Type type, final Object obj) throws ObjectMappingException {
|
||||
public Key deserialize(final Type type, final Object obj) throws SerializationException {
|
||||
if (!(obj instanceof CharSequence)) {
|
||||
throw new ObjectMappingException("Invalid type presented to serializer: " + type);
|
||||
throw new SerializationException("Invalid type presented to serializer: " + type);
|
||||
}
|
||||
|
||||
try {
|
||||
return Key.key(obj.toString());
|
||||
} catch(final InvalidKeyException ex) {
|
||||
throw new ObjectMappingException(ex);
|
||||
throw new SerializationException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ import net.kyori.adventure.sound.Sound;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMappingException;
|
||||
import org.spongepowered.configurate.serialize.SerializationException;
|
||||
import org.spongepowered.configurate.serialize.TypeSerializer;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@@ -49,7 +49,7 @@ public final class SoundSerializer implements TypeSerializer<Sound> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Sound deserialize(@NonNull final Type type, @NonNull final ConfigurationNode value) throws ObjectMappingException {
|
||||
public @Nullable Sound deserialize(@NonNull final Type type, @NonNull final ConfigurationNode value) throws SerializationException {
|
||||
if (value.empty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -60,14 +60,14 @@ public final class SoundSerializer implements TypeSerializer<Sound> {
|
||||
final float pitch = value.node(PITCH).getFloat(1.0f);
|
||||
|
||||
if (name == null || source == null) {
|
||||
throw new ObjectMappingException("A name and source are required to deserialize a Sound");
|
||||
throw new SerializationException("A name and source are required to deserialize a Sound");
|
||||
}
|
||||
|
||||
return Sound.sound(name, source, volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@NonNull final Type type, @Nullable final Sound obj, @NonNull final ConfigurationNode value) throws ObjectMappingException {
|
||||
public void serialize(@NonNull final Type type, @Nullable final Sound obj, @NonNull final ConfigurationNode value) throws SerializationException {
|
||||
if (obj == null) {
|
||||
value.set(null);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user