Getting a wierd NPE.

Discussion in 'Plugin Development' started by iTristan, Mar 15, 2013.

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

    iTristan

    I am trying to update the TelePads plugin to support the new CraftBukkit Builds and to allow BungeeCord TelePads.

    However I get the following NPE :

    Code:
    java.lang.NullPointerException
            at me.wizzledonker.plugins.telepads.Telepads.reloadprops(Telepads.java:195)
            at me.wizzledonker.plugins.telepads.Telepads.onEnable(Telepads.java:60)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
            at org.bukkit.craftbukkit.v1_5_R1.CraftServer.loadPlugin(CraftServer.java:282)
            at org.bukkit.craftbukkit.v1_5_R1.CraftServer.enablePlugins(CraftServer.java:264)
            at org.bukkit.craftbukkit.v1_5_R1.CraftServer.reload(CraftServer.java:596)
            at org.bukkit.Bukkit.reload(Bukkit.java:184)
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186)
            at org.bukkit.craftbukkit.v1_5_R1.CraftServer.dispatchCommand(CraftServer.java:514)
            at net.minecraft.server.v1_5_R1.PlayerConnection.handleCommand(PlayerConnection.java:967)
            at net.minecraft.server.v1_5_R1.PlayerConnection.chat(PlayerConnection.java:885)
            at net.minecraft.server.v1_5_R1.PlayerConnection.a(PlayerConnection.java:840)
            at net.minecraft.server.v1_5_R1.Packet3Chat.handle(Packet3Chat.java:44)
            at net.minecraft.server.v1_5_R1.NetworkManager.b(NetworkManager.java:292)
            at net.minecraft.server.v1_5_R1.PlayerConnection.d(PlayerConnection.java:113)
            at net.minecraft.server.v1_5_R1.ServerConnection.b(SourceFile:35)
            at net.minecraft.server.v1_5_R1.DedicatedServerConnection.b(SourceFile:30)
            at net.minecraft.server.v1_5_R1.MinecraftServer.r(MinecraftServer.java:580)
            at net.minecraft.server.v1_5_R1.DedicatedServer.r(DedicatedServer.java:225)
            at net.minecraft.server.v1_5_R1.MinecraftServer.q(MinecraftServer.java:476)
            at net.minecraft.server.v1_5_R1.MinecraftServer.run(MinecraftServer.java:409)
            at net.minecraft.server.v1_5_R1.ThreadServerApplication.run(SourceFile:573)
    Here is the concerned code :

    Code:
    Location locationTemp = null;
            // TODO: Make this getList... a proper while statement rather than something that doesn't work.
            List<String> names = new ArrayList<String>((padConfig.getConfigurationSection("pads").getKeys(false)));
            if (names.isEmpty()) {
                System.out.println(this + ": No pads were loaded!");
                return;
            }
            telepads.clear();
            for (String nextit : names) {
                if (!padConfig.contains("pads." + nextit)) {
                    System.out.println(this + ": Finished re-scanning pads");
                    return;
                }
                locationTemp = new Location(null, padConfig.getInt("pads." + nextit + ".X"),
                        padConfig.getInt("pads." + nextit + ".Y"),
                        padConfig.getInt("pads." + nextit + ".Z"));
                telepads.put(locationTemp, nextit);
            }
    Line 195 :
    Code:
    List<String> names = new ArrayList<String>((padConfig.getConfigurationSection("pads").getKeys(false)));
    Could anyone help me?
     
  2. Offline

    minoneer

    1. are you sure padConfig is not null?
    2. are you sure section "pads" exists in your config? (might be a typo or sth.)

    try to add some debug messages/checks (i.e. print padConfig, the config section, etc.)
     
  3. Offline

    Barinade

    at me.wizzledonker.plugins.telepads.Telepads.onEnable(Telepads.java:60)
     
  4. where did you defined padConfig?
     
Thread Status:
Not open for further replies.

Share This Page