0

I've been trying to import spigot/bukkit for minecraft plugins. When trying to create the main class, I entered

public class Main extends JavaPlugin{

}

With an error under JavaPlugin, since their is no import. The tutorial im following told me to click the fix that will import it for me, but the fix simply does not show up when I attempt to resolve it, and if I manually import it, it gives the error: "the import org.bukkit.plugin cannot be resolved." I've tried restarting the project, deleting and reinstalling, and everything in between. Please let me know if you need more information on how I've added spigot to the build path, or anything else I can help with.

Drand
  • 9
  • 4

1 Answers1

0

Since the 1.17, it seems to have some changes with jar. Now, if you start server, it will create the bundler/versions folder, with a given jar that -for me- should fix your issue.

Also, you can use more preferable way to import project, such as maven or gradle. They can help you to easier share the project, and make it faster to run (you can also automatically run it with github actions for example.

  • To use spigot with maven, use this:
<repositories>
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.18.2-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
</dependencies>

(Documentation)

  • To use spigot with gradle, use this:
repositories {
  maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
  maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}

dependencies {
  compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
}

(Documentation)

Elikill58
  • 4,050
  • 24
  • 23
  • 45