What doed i wrong?

Discussion in 'Plugin Development' started by mathiasrocker, Nov 4, 2012.

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

    mathiasrocker

    Im doing something wrong but the code says nothin :(
    my onEnable method:
    Code:
      Config = getConfig();
            Config.addDefault("UpdateChecker", true);
            Config.options().copyDefaults(true);
            ConfigFile = new File(getDataFolder(), "config.yml");
            if(!ConfigFile.exists()){
                ConfigFile.mkdir();
            }
            saveConfig();
            reloadConfig();
            getCommand("SECRET").setExecutor(new SECRETCommand(this));
            getCommand("SECRETUpdateChecker").setExecutor(new SECRETUpdateChecker(this));
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvents(pl, this);
            System.out.println("[AdminStick] V 1.3.2 Is Enabled");
            if(UCenabled){
                UpdateChecker checker = new UpdateChecker(this, "http://dev.bukkit.org/server-mods/SECRET-v1-0-new/files.rss");
                if (checker.updateNeeded()){
                    System.out.println("A new version for SECRET is available: V" + checker.getVersion());
                    System.out.println("Get it from: " + checker.getLink());
                    System.out.println("Direct Link: " + checker.getJarLink());
                }
            }
    why i texted secret in some place's is: I don't want you to know my Plugin name.

    my plugin.yml:
    Code:
    main: me.mathias.AdminStick.AdminStick
    version: 1.3.2
    author: [mathiasrocker]
    name: AdminStick
     
    commands:
        SECRET:
            usage: /<command>
            description: Give's You The SECRET
            aliases:
            - as
            permission: SECRET.Command
            permission-message: You Have Not Permission To Use SECRET!
        SECRETUpdateChecker:
            usage: /<command>
            description: Toggle's the UpdateChecker to true/false.
            aliases:
            - asUpdateChecker
            - asUC
            permission: SECRET.ChechForUpdate.enabled.Change
            permission-message: You Have Not Permission To Use AdminStick!
    permissions:
        SECRET.Command:
            description: Allows You To Use The Command SECRET.
            deafult: op
        SECRET.Use:
            description: Allows You To Use The SECRET.
            deafult: op
        SECRET.CheckForUpdate:
            description: Show's the player when it's a new update.
            deafult: op
        SECRET.CheckForUpdate.enabled.Change:
            description: Toggle's the UpdateChecker. enabled = true/false.
            deafult: op
    My error log:
    [SEVERE] Could not load 'plugins\SECRETk.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: File cannot be null
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:152)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:229)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:205)
    at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:51)
    at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
    at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:400)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:818)
    Caused by: java.lang.IllegalArgumentException: File cannot be null
    at org.apache.commons.lang.Validate.notNull(Validate.java:203)
    at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:170)
    at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:117)
    at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:111)
    at me.mathias.SECRET.SECRET.<init>(SECRET.java:16)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:148)
    ... 9 more

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

    Njol

    You must not use getConfig() until after onEnable() is called by Bukkit, i.e. you have to put all code that relies on the config into onEnable() or methods that are called later that that.
     
  3. Offline

    mathiasrocker

    can you give me a example code?
     
  4. Offline

    Njol

    I can't give you example code as it's your code that has to be changed. take a look at line 16 of your main class and remove and getConfig() calls from it.
     
  5. Offline

    mathiasrocker

    i did not know what you mean. Can someone else help me?
     
Thread Status:
Not open for further replies.

Share This Page