Load a plugin

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

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

    Stazer

    Hi guys,
    i have got a problem.
    I writed a test bukkit plugin with the following code.

    Code:
    package Test ;
    
    // Main class
    public class Main extends org.bukkit.plugin.java.JavaPlugin
    {
        // Constructor
        public Main ( org.bukkit.plugin.PluginLoader pluginLoader , org.bukkit.Server instance ,
                      org.bukkit.plugin.PluginDescriptionFile desc , java.io.File folder , java.io.File plugin , ClassLoader cLoader )
        {
        }
        
        // onEnable method
        @Override
        public void onEnable ( )
        {
            // Print information
            System.out.println( "loaded!" ) ;
        }
        
        // onDisable method
        @Override
        public void onDisable ( )
        {
            // Print information
            System.out.println( "unloaded!" ) ;
        }
    }
    The plugin.yml

    Code:
    name: Test
    main: Test.Main
    version: 1.0
    Server Errors

    Code:
    [SEVERE] Could not load plugins\Test.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:80)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:130)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:95)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:59)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.ClassNotFoundException: Test/Main
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:72)
        ... 8 more
    
    I copied the plugin.yml in the .jar file.
    Why does not load the server my plugin?

    Stazer
     
  2. Offline

    Cheesier

    1. Remove the WHOLE constructor
    2. I think the plugin.yml needs to be compiled with the jar file, just drag the plugin.yml file to the project in eclipse
    3. i think the plugin.yml is wrong written, but cant tell from this, What is your package name ?
     
  3. Offline

    Stazer

    My package name is Test.

    Stazer

    Edit : I deleted the constructor and it works!

    Thank you!

    Stazer
     
Thread Status:
Not open for further replies.

Share This Page