Could not load plugin (File cannot be null)

Discussion in 'Plugin Development' started by SteppingHat, Jun 19, 2012.

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

    SteppingHat

    Here is the error I am receiving when I load up the plugin I made:
    Code:
    15:38:25 [SEVERE] Could not load 'plugins\tempteleport.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: File cannot be null
    I'm assuming it's saying that one of the files is empty but they are all filled with code.
    TTP.java
    config.yml
    plugin.yml

    I have no idea what to do. I am also hesitant to put my code up here for people to use and copy so if you need it to find the bug, I will PM it to you.

    Thanks in advance!

    ~SteppingHat
     
  2. Offline

    CorrieKay

    is there anything more to that stacktrace?

    if not, i... think your plugin.yml is null, or doesnt point to the correct main class.
     
  3. Offline

    Njol

  4. Offline

    CorrieKay

  5. Offline

    SteppingHat

    It's got something to do with the config. When I removed anything that required/loaded the config, the plugin loaded fine.

    Code:
    package com.gmail.steppinghat;
     
    import java.util.logging.Logger;
     
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class TempTeleport extends JavaPlugin {
       
        public static TempTeleport plugin;
        public final Logger logger = Logger.getLogger("Minecraft");
        Logger log = Logger.getLogger("Minecraft");
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " has been disabled!");
        }
       
        public static int CONF_time;
       
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            log.info("--------TEMPTELEPORT by SteppingHat--------");
            this.logger.info(pdfFile.getName() + " v" + pdfFile.getVersion() + " has been enabled!");
            log.info("-------------------------------------------");
            this.getConfig().options().copyDefaults(true);
            this.saveConfig();
            CONF_time = getConfig().getInt("time");
        }
    
    There's the code.
     
  6. Offline

    Tempelchat

    This error happens already at loading. Does java has enough rights to create files/folders in your bukkit directory?

    PS: You should not get the Minecraft-Logger for logging. There is a getLogger() method you could use. I also does the plugin prefixing for you automatically.
     
  7. Offline

    Njol

    ferrybig and CorrieKay like this.
Thread Status:
Not open for further replies.

Share This Page