@Override
  public Duration deserialize(final @NotNull Type type, final @NotNull Object obj) throws SerializationException {
    if (obj instanceof CharSequence) {
      String value = obj.toString();
      if (!value.startsWith("P") && !value.startsWith("p")) {
        value = "P" + value;
      }

      try {
        return Duration.parse(value);
      } catch (final DateTimeParseException ex) {
        throw new SerializationException(ex);
      }
    }
    throw new SerializationException("Value was not of appropriate type");
  }
A serializer for the JDK {@link Duration} type.

<p>This will eventually be incorporated into upstream Configurate.</p>
serializer-configurate4/src/main/java/net/kyori/adventure/serializer/configurate4/DurationSerializer.java