Bukkit插件抛出错误

时间:2017-10-01 08:32:26

标签: bukkit

所以我写了一个Bukkit插件,在控制台中抛出错误但是有效 COnsole日志:



 [10:28:19 INFO]: [INTGlobalPlugin] Enabling INTGlobalPlugin v1.0
[10:28:19 ERROR]: Error occurred while enabling INTGlobalPlugin v1.0 (Is it                     up to date?)
java.lang.NullPointerException: null
        at me.intglobal.plugin.Main.onEnable(Main.java:20) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:329) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:401) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:361) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:323) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload(CraftServer.java:723) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.Bukkit.reload(Bukkit.java:534) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:622) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1326) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1186) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(SourceFile:37) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(SourceFile:9) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_144]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_144]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:695) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:366) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:650) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:554) [CrraftBukkit.jar:git-Bukkit-bb4ae3b]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_144]




我怎么能说这个?

3 个答案:

答案 0 :(得分:2)

不要将它放在src /文件夹中,而是放在项目文件夹中。

答案 1 :(得分:0)

空指针异常意味着您正在尝试使用一些null(无)的变量。此问题出现在主文件的第20行。也许您正在尝试使用记录器,但是您忘了设置它?

答案 2 :(得分:0)

你有一个NullPointerException,这意味着你在代码中创建的任何变量都没有任何东西可以容纳。如果你想解决这个问题,可以初始化它或者只是在变量中加入一些东西。