2012-05-01 07:33:31 [SEVERE] Error occurred while enabling Gravity v1.1.1 (Is it up to date?)

Discussion in 'Plugin Development' started by ziah, May 1, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ziah

    I'm getting this error when i start my server
    Show Spoiler

    2012-05-01 07:33:31 [SEVERE] Error occurred while enabling Gravity v1.1.1 (Is it up to date?)
    java.lang.NullPointerException
    at com.oneofthesevenbillion.ziah.Gravity.Gravity.onEnable(Gravity.java:37)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:215)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:336)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:250)
    at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:232)
    at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:371)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:358)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:187)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)


    Here's the source code http://pastebin.com/6WTUBY31

    Here's the plugin.yml
    Show Spoiler

    name: Gravity
    main: com.oneofthesevenbillion.ziah.Gravity.Gravity
    version: 1.1.1
    description: Makes it so blocks will fall unless they are supported by something touching the ground
    author: ziah5
    depend: [WorldEdit]
    permissions:
    gravity.disable:
    description: Allows you to use the disable gravity command
    default: op
    gravity.enable:
    description: Allows you to use the enable gravity command
    default: op
    gravity.*:
    description: Gives you all gravity permissions
    default: op
    commands:
    gravity:
    description: Main gravity command
    aliases: g
    usage: Type /<command> help for help
     
  2. Offline

    Kierrow

    In line 37 you assign a variable something that comes from server.getPluginManager()...
    That "server" is defined in line 32 and is also assigned there. That is a no-go.

    When using Bukkit, the first Bukkit-related assignments (like in line 32, getServer()) can
    be made within the onEnable() method for the first time.
    So assign the "server" variable there and you should be good.

    ( Like this: )
    Code:
            Logger log;
            Server server;
            File pFolder = new File("plugins" + File.separator + "Gravity");
            SQLite sqlite;
            Plugin WorldEdit;
            public void onEnable() {
                    server = getServer();
                    PluginManager pluginManager = server.getPluginManager();
                    // ...
            }
    
    ALSO, how do you plan on applying sand-like behavior to other blocks??

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  3. Offline

    ziah

    Thanks I'll try that.
     
  4. You don't need to store the server instance somewhere, you can just use Bukkit.getServer() anywhere.
     
  5. Offline

    nicholasntp

    True.
     
Thread Status:
Not open for further replies.

Share This Page