Gradle isn't serching the right repository for plugins

I have this plugin and I’m trying to add it to my multi module gradle project. I want to add the plugin into one of my conventions, however I get this error:

> Could not determine the dependencies of null.
   > Could not resolve all task dependencies for configuration ':api:classpath'.
      > Could not find io.papermc.paperweight:paperweight-userdev:1.3.8.
        Searched in the following locations:
          - https://plugins.gradle.org/m2/io/papermc/paperweight/paperweight-userdev/1.3.8/paperweight-userdev-1.3.8.pom
        If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
        Required by:
            project :api > project :build-logic

I have the error for my other repository I have added, and no errors for the repository that the plugin is actually in. I’ve defined it something like this

dependencies {
    implementation("io.papermc.paperweight:paperweight-userdev:1.3.8")
}

repositories {
    mavenCentral()
    gradlePluginPortal()
    maven("https://papermc.io/repo/repository/maven-public/")
}

(Using kotling DSL, so if possible answers in kotlin would be nice)

It looks like you’re trying to depend on a plugin using the repositories and dependencies for the project code you’re building, not the buildscript. Dependencies of the build itself (plugins) are different than dependencies of the project being built.

For examples (including Kotlin DSL) of how to properly do this, look at Custom Plugin Repositories and Applying Plugins with Buildscript Block in the Using Plugins docs.