init errors

Discussion in 'Plugin Development' started by Buckley, Mar 5, 2011.

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

    Buckley

    So I am writing A plugin... And I get this error on bukkit build 493. How do I fix it?
    [​IMG]
     
  2. Offline

    Plague

    I think your plugin.yml could be wrong
     
  3. Offline

    Buckley

    This is my Plugin.yml I used a template to get it.

    Code:
    name: TrueAuth
    main: com.bukkit.Cosban.TrueAuth.TrueAuth
    version: 0.1
    In the image, it mentions a NoSushMethodException for init(), do I need an init function? I thought we just needed an onEnable() for it to set everything up.

    This is my main class.
    Code:
    package com.bukkit.Cosban.TrueAuth;
    
    import java.io.File;
    import java.io.IOException;
    import java.util.HashMap;
    
    import org.bukkit.Server;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
     * TrueAuth for Bukkit
     *
     * @author Cosban
     */
    public class TrueAuth extends JavaPlugin {
        private final TrueAuthPlayerListener playerListener = new TrueAuthPlayerListener(this);
        private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
        private final OnlineStatus status = new OnlineStatus();
        public TrueAuth(PluginLoader pluginLoader, Server instance,
                PluginDescriptionFile desc, File folder, File plugin,
                ClassLoader cLoader) throws IOException {
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
            // NOTE: Event registration should be done in onEnable not here as all events are unregistered when a plugin is disabled
        }
    
        public void onEnable() {
            try{
                status.determineStatus();
            }
            catch(Throwable exception)
            {
                System.out.println("[TrueAuth] Unable to determine online status");
            }
            // Register our events
            PluginDescriptionFile pdfFile = this.getDescription();
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
    
            // EXAMPLE: Custom code, here we just output some info so we can check all is well
    
            System.out.println( "["+pdfFile.getName()+"]" + " version " + pdfFile.getVersion() + " is enabled!" );
        }
        public void onDisable() {
            // NOTE: All registered events are automatically unregistered when a plugin is disabled
    
            // EXAMPLE: Custom code, here we just output some info so we can check all is well
            PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( "["+pdfFile.getName()+"]"+" Disabled!");
        }
        public boolean isDebugging(final Player player) {
            if (debugees.containsKey(player)) {
                return debugees.get(player);
            } else {
                return false;
            }
        }
    
        public void setDebugging(final Player player, final boolean value) {
            debugees.put(player, value);
        }
    }
    
    
     
  4. Offline

    Crash

  5. Offline

    Buckley

    Ok, I changed the namespace and removed the constructor. I get this error now: [​IMG]
    Any Ideas?
     
  6. Offline

    Plague

    Have you really removed the constructor?
     
  7. Offline

    Gandalf

    Please post your sourcecode, it is much better than us asking you if you have done so and so.
     
  8. Offline

    Buckley

    ok, this is my Source code.
    Code:
    package com.gmail.cosban55.Cosban.TrueAuth;
    
    import java.util.HashMap;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
     * TrueAuth for Bukkit
     *
     * @author Cosban
     */
    public class TrueAuth extends JavaPlugin {
        private final TrueAuthPlayerListener playerListener = new TrueAuthPlayerListener(this);
        private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
        private final OnlineStatus status = new OnlineStatus();
        
        public void onEnable() {
            try{
                status.determineStatus();
            }
            catch(Throwable exception)
            {
                System.out.println("[TrueAuth] Unable to determine online status");
            }
            PluginDescriptionFile pdfFile = this.getDescription();
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
            System.out.println( "["+pdfFile.getName()+"]" + " version " + pdfFile.getVersion() + " is enabled!" );
        }
    
        public void onDisable() {
            // NOTE: All registered events are automatically unregistered when a plugin is disabled
    
            // EXAMPLE: Custom code, here we just output some info so we can check all is well
            PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( "["+pdfFile.getName()+"]"+" Disabled!");
        }
    
        public boolean isDebugging(final Player player) {
            if (debugees.containsKey(player)) {
                return debugees.get(player);
            } else {
                return false;
            }
        }
    
        public void setDebugging(final Player player, final boolean value) {
            debugees.put(player, value);
        }
    }
     
  9. Offline

    Gandalf

    As in your entire project folder, I think it is a configuration issue.

    ZIP it up, upload it, and post it here.
     
  10. Offline

    Buckley

    The bukkit API is not in this, I have it located outside the project, but I still have it referenced as a library.
     

    Attached Files:

  11. Offline

    Gandalf

    I was able to compile a working version of this, <Edit by Moderator: Redacted mediafire url>

    How are you exporting it, what is the name of your package?

    Try it with that, and see if it works for you.
     
    Last edited by a moderator: Dec 14, 2016
  12. Offline

    Buckley

    I believe it was caused by compressing the jar file. I actually got something I can work with when I didn't do that. Thanks!!
     
Thread Status:
Not open for further replies.

Share This Page