为什么我的插件无法加载到我的Minecraft spigot服务器上?

时间:2019-10-17 23:03:27

标签: java intellij-idea plugins minecraft

所以大约一周前,我决定想学习编码Minecraft插件的代码,所以我尝试遵循本指南:

我将测试插件加载到PC上的spigot 1.12服务器中,出现了很多错误:

[15:58:22错误]:无法在文件夹“插件”中加载“ plugins \ TestPluginA3-1.0-SNAPSHOT.jar” org.bukkit.plugin.InvalidPluginException:找不到主类`com.gmail.boweneveritt.TestPluginMain'         在org.bukkit.plugin.java.PluginClassLoader。(PluginClassLoader.java:66)〜[latesspigot.jar:git-Spigot-596221b-9a1fc1e]         在org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129)〜[latesspigot.jar:git-Spigot-596221b-9a1fc1e]         在org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:326)〜[latesspigot.jar:git-Spigot-596221b-9a1fc1e]         在org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248)[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:298)[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205)[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:544)[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在java.lang.Thread.run(未知来源)[?: 1.8.0_191] 引起原因:java.lang.ClassNotFoundException:com.gmail.boweneveritt.TestPluginMain         在java.net.URLClassLoader.findClass(未知来源)〜[?:1.8.0_191]         在org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101)〜[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86)〜[latestspigot.jar:git-Spigot-596221b-9a1fc1e]         在java.lang.ClassLoader.loadClass(未知来源)〜[?:1.8.0_191]         在java.lang.ClassLoader.loadClass(未知来源)〜[?:1.8.0_191]         在java.lang.Class.forName0(本机方法)〜[?:1.8.0_191]         在java.lang.Class.forName(未知来源)〜[?:1.8.0_191]         在org.bukkit.plugin.java.PluginClassLoader。(PluginClassLoader.java:64)〜[latesspigot.jar:git-Spigot-596221b-9a1fc1e]         ...还有7个

我的库文件是:JDK 10,Craft Bukkit 12和Spigot 1.12

我做错了什么?

2 个答案:

答案 0 :(得分:0)

Cannot find main class 

这意味着您没有主班。编写一个类,其名称如下:

public class Main extends JavaPlugin {

    public void onEnable() {
    }

    public void onDisable() {
    }


    }

答案 1 :(得分:0)

如果您在 src 文件中有一个名为 plugin.yml 的文件,请添加:

package.package.package.MainClassHere

基本上,您需要为 plugin.yml 提供主类的目录。