Help me fix constructor error

Discussion in 'Plugin Development' started by matte3560, Apr 12, 2011.

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

    matte3560

    I'm trying to get into making plugins for bukkit, but I'm having some initial troubles. I've used the Bukkit base plugin generator (v2.2), but eclipse gives me an error. I tried exporting it anyway, but it produces an error in the server console.

    Code:
    The constructor JavaPlugin(PluginLoader, Server, PluginDescriptionFile, File, File, ClassLoader) is undefined
    
    The error comes from line 25 in this code: http://pastebin.com/u0qxVKR9

    I'm not really sure how to tackle this, so any help would be greatly appreciated!
     
  2. Offline

    ssell

    @matte3560

    If you are going to use a constructor it can not take any parameters.

    The code you are using is outdated and the second time in two days I have seen errors being posted resulting from it. Where are you guys getting it from?
     
  3. Offline

    matte3560

  4. Offline

    MrChick

    @matte3560 then you should have seen the link to the updated tutorial right in that post.
     
  5. Offline

    ssell

    Ah. The general structure of a new plugin looks like this:

    Code:
    public class YourPlugin
        extends JavaPlugin
    {
        private static final Logger log = Logger.getLogger( "Minecraft" );
    
        public void onEnable( )
        {
            //Register for events here. Example:
            getServer( ).getPluginManager( ).registerEvent(
                    Event.Type.BLOCK_DAMAGE, yourBlockListener,
                    Event.Priority.Normal, this );
    
            log.info( "YourPlugin is enabled!" );
        }
    
        public void onDisable( )
        {
    
        }
    
        public boolean onCommand( CommandSender sender, Command command, String label, String[] args )
        {
            //Listen for commands here. Such as:
            String[] split = args;
            String commandName = command.getName().toLowerCase();
    
            if ( sender instanceof Player )
            {
                Player player = ( Player )sender;
    
                // /theCommand
                if( commandName.equals( "thecommand" ) )
                {
                    //Process the command
    
                    return true;
                }
    
                return false;
            }
        }
    }
    
     
  6. Offline

    matte3560

Thread Status:
Not open for further replies.

Share This Page