Could someone help me with my plugin?

Discussion in 'Archived: Plugin Requests' started by Myklebost, Aug 5, 2011.

  1. Offline

    Myklebost

    I don't know what's wrong with the plugin but it is something wrong.
    This is This is the code:

    Code:
    package Mykle;
    
    import java.util.logging.Logger;
    
    import org.bukkit.command.CommandSender;
    import org.bukkit.command.Command;
    import org.bukkit.plugin.java.JavaPlugin;
    
    
    public class MyPlugin extends JavaPlugin {
        Logger log = Logger.getLogger("Minecraft");
    public void onEnable() {
        log.info("MyPlugin is Enabled.");
    
    }
    
        public void onDisable(){
            log.info("MyPlugin is Disabled.");
        }
    
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            if(cmd.getName().equalsIgnoreCase("MyPlugin")){
    
                return true;
            }
            return false;
        }
    }
    
    This is the error i get:
    Code:
    151 recipes
    16 achievements
    15:46:32 [INFO] Starting minecraft server version Beta 1.7.2
    15:46:32 [INFO] Loading properties
    15:46:32 [INFO] Starting Minecraft server on localhost:25565
    15:46:32 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-904-
    g9277096-b953jnks (MC: 1.7.2)
    15:46:32 [SEVERE] Could not load 'plugins\MyPlugin.jar' in folder 'plugins':
    
    java.lang.ClassNotFoundException: Mykle.MyPlugin
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:36)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:24)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:168)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:199)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:122)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:118)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:89)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigur
    ationManager.java:51)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:132)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    15:46:32 [INFO] Preparing level "world"
    15:46:32 [INFO] Preparing start region for level 0 (Seed: 2703611272930931585)
    15:46:33 [INFO] Preparing start region for level 1 (Seed: 8046779386260908135)
    15:46:33 [INFO] Preparing spawn area: 48%
    15:46:33 [INFO] Done (0,139s)! For help, type "help" or "?"
    >
    Please Help Me!
     
  2. Offline

    zhuowei

    Maybe you forgot to add the .class files in your plugin .jar file. Could you please attach the .jar file of your plugin?
     
  3. Offline

    Myklebost

    Ok, I have zipped it so just unzip it. Here it is:
     

    Attached Files:

  4. Offline

    Mamba

    ur package should look similar to this:
    me.Mykle.MyPlugin

    and that should contain your classes... u should also name ur main class MyPlugin if thats the name of ur .jar

    don't forget to edit this line in the plugin.yml
    main: me.Mykle.MyPlugin.MyPlugin
     
  5. Offline

    Myklebost

    I still got the same error. But thanks anyway :)
     
  6. Offline

    zhuowei

    The jar file that you attached loads for me, but to get the command to register, you must declare it in the plugin.yml. Here is a sample plugin.yml with commands defined.
     
  7. Offline

    skeletonofchaos

    Yeah its the plugin.yml to me it looks like the main class location is out of place... Wait why is the class named my plugin but the class file it's found in named AntiOperator? I'd bet that's the error.
     
  8. Offline

    Myklebost

    I get the same error on all of my plugins -.- maby it isn't something with the code?
     
  9. Offline

    ichingpow

    You aren't setting up your packages right or/and aren't using the plugin.yml correctly. Also: is this a block placement notifier?
     
  10. Offline

    Myklebost

    how should the plugin.yml be used? This is how i use it:
    Code:
    name: Test
    version: 0.1
    main: me.myklebost.test.Test
    authors: [Myklebost]
    The package name is me.myklebost.test
     
  11. Offline

    Mamba

    If that's ur yml it means that the name of your main class has to be Test...

    If I remember correctly it was named AntiOperator or something like that...

    main: me.myklebost.test.Test <-- name of main class
     
  12. Offline

    Myklebost

    Yeah, That was just an example i made a new plugin but it had exactly the same error.

    Ok so i did a tutorial and did all the same as he did. I downloaded hes .jar file. and it worked. Then i tryed my file. The same error. Maby it is when i am exporting it into the .jar it goes wrong?

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

Share This Page