Solved Developing my first plugin... and i failt! [Help please]

Discussion in 'Plugin Development' started by bramhaag, Nov 26, 2013.

Thread Status:
Not open for further replies.
  1. **SOLVED**
    I made a big mistake in the plugin.yml file... First, i only typed the package name, without the main class. After that, i only typed the main class, without the package name... But now it's fix :)

    Plugin Link:
    http://dev.bukkit.org/bukkit-plugins/playerhider-bramhaag/
    Source-code and download v.1.0.0 for bukkit 1.6.4/spigot unsupported 1.7 build tomorrow availible!

    **ORGINAL POST**
    Dear bukkit members,
    I tried to create a plugin like MagicClock, but than with my own style.
    It's not finish yet, but I got a nasty error and I don't know how to fix it.

    --Server Log--
    17:35:20 [SEVERE] Could not load 'plugins\AdvancedMagicClock.jar' in folder 'plu
    gins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: nl.b
    ramhaag.AdvancedMagicClock
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:306)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:230)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.ja
    va:245)
    at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.jav
    a:118)
    at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java
    :409)
    at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:5
    83)
    Caused by: java.lang.ClassNotFoundException: nl.bramhaag.AdvancedMagicClock
    at java.net.URLClassLoader$1.run(Unknown Source)
    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.findClass0(PluginClassLoader
    .java:80)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:53)
    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:173)
    ... 6 more
    --End of Server Log--

    I have made my plugin with eclipse, ad I used 2 classes and 1 .yml file
    All the attached files are screenshots of the coding.
    Again, it is not finished yet. There isn't a config file ad stuff like that.
    I hope some of you can fix this problem.

    Cheerz,
    Bram

    P.S Sorry for the bad English, I'm from the Nederlands :)
     
  2. Offline

    Compressions

    bramhaag The "main" key is as follows:
    Code:
    com.your_package_path.main_class(case- sensitive)
     
  3. Compressions I don't know what that means, I'm completely noob in this
     
  4. Offline

    Compressions

  5. Compressions I'm sorry, but i'm VERY NOOB. I don't get it. Can you try to explane it to me?
     
  6. Offline

    Compressions

    bramhaag You need to go watch some YouTube videos on it. I won't explain it to you like you're a 3-year-old. I just won't.
     
    Mitsugaru and sgavster like this.
  7. Compressions i already did, but no succes. But thanks for your time.
     
  8. Offline

    sgavster

    bramhaag That is the main part of a Bukkit plugin, without knowing how to do the plugin.yml, you will get no where. As Compressions said, we will not explain to you like you are a 3 year old. You can go to the link he posted and that will explain everything.

    You could also look at this, this may help: https://github.com/sgavster/SimplyHub/
     
  9. sgavster I'm a noob at coding, but you need to start somewhere, right? The only thing i ask is if you guys know how to fix this error, and explain me how to do that.
     
  10. Offline

    Deleted user

    bramhaag
    It doesn't get any simpler than that link Compressions sent you.

    If you don't even understand what class names and paths are, then you should probably not be developing right now.
     
    sgavster likes this.
  11. Offline

    sgavster

    bramhaag He explained.
    You have some sort of package. For example mine is always:
    me.sgavster.PLUGIN_NAME.PLUGIN_NAME

    The second PLUGIN_NAME being my plugins name, but it's the main class.

    So say my plugin was Orange, it'd be like this

    me.sgavster.orange.Orange

    so, in the plugin.yml it would be:

    name: Orange
    main: me.sgavster.orange.Orange
    version: 1.0
    commands:

    In the plugin.yml, you can not put tabs, it MUST be spaces. And caps are everything. 1 capital wrong will mess up everything.
     
  12. zombiekiller753 everyone started as a Noob. And i take a closer look to the link after i wrote this. But i don't get how the link can fix my problem.

    sgavster Thank you very mutch, i try it tomorrow.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  13. Offline

    Deleted user

    bramhaag
    Yea, I know. I was a noob too.

    But I started with the exact same link that Compressions gave you, and it told me everything that I needed to know to fix the issue you're having.
     
    sgavster likes this.
  14. Offline

    sgavster

    bramhaag Use Google Chrome and translate? :p
     
  15. Offline

    Garris0n

    The place you need to start is Java, not Bukkit.
    http://docs.oracle.com/javase/tutorial/
     
  16. sgavster how crazy can the translation be?? I mean, all the coding stuff goes in Dutch. It's very weird
    garrison Okey
     
  17. Offline

    M0n0clink

    bramhaag Java is a case-sensitive language. One simple capital can affect the output. The error basically tells that the plugin cannot load because the main class cannot be found which basically means that the one you gave it was an unknown source which is why it said at java.lang.ClassLoader.loadClass(Unknown Source). Look closely in your plugin.yml. There must be something wrong with it. Also, trying to keep the naming of your packages the same way everytime.

    Example I would name my package :

    me.m0n0clink.exampleplugin.

    and my main class will be found in:

    me.m0n0clink.exampleplugin.main

    I try to keep mine the same and to avoid human errors like leaving a capital behind , I always keep it on lower case. Once again , to fix this issue , make sure that when you combine your package and the name of your main class , it matches with the one you added to the plugin.yml. As off what Garris0n said was totally true. Learning Java first is totally helpful but I know that you are in a rush to want to learn how to code bukkit plugins. However , no pain no gain , there are no shortcuts available. My advice is that you learn some of the things on how to make a bukkit plugin first , then switch to Java and when you are back to coding plugins , you would definitely understand better.
     
  18. M0n0clink Thanks! I made a big mistake in the plugin.yml file... First, i only typed the package name, without the main class. After that, i only typed the main class, without the package name... But now it's fix :)

    Plugin Link:
    http://dev.bukkit.org/bukkit-plugins/playerhider-bramhaag/
    The download and source are comming tomorrow i hope.
     
Thread Status:
Not open for further replies.

Share This Page