Sample Plugin doesn't work!

Discussion in 'Plugin Development' started by Ninjasturm, Apr 10, 2011.

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

    Ninjasturm

    Hello Community,

    today i created my first plugin.
    I downloaded Eclipse ,the Bukkit API and the Generator from the tutorial in the wiki.
    I created my application with the Generator and linked the Bukkit API to my project.

    I get this error from Eclipse:
    The constructor JavaPlugin(PluginLoader, Server, PluginDescriptionFile, File, File, ClassLoader) is undefined

    I am a noob at programming with the Bukkit API.
    Next step I export the project to a jar file but CraftBukkit fires some errors:
    19:11:45 [SCHWERWIEGEND] Could not load plugins\Gildenmeister.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:105)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:158)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:106)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:63)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:215)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:202)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:142)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:257)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    Caused by: java.lang.ClassNotFoundException: com.bukkit.Ninjasturm.Gildenmeister
    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.java:97)
     
  2. Offline

    -JHB-

    had the same problem... (I might still have co-developer isnt online so i ask him if he fixed it)
    would be great for new commers if somebody would fix teh sample plugin....
     
  3. Offline

    Ninjasturm

    Can someone give me sample code for a plugin that works?
     
  4. Offline

    Carnes

    Just made a blank plugin. The only thing you have to do is change the location of the external bukkit/craftbukkit jars.
     

    Attached Files:

    FlareLine likes this.
  5. Offline

    Ninjasturm

    I used your code in BlankZip and Eclipse didn't fired errors again, but craftbukkit fired this erros:
    13:31:40 [SCHWERWIEGEND] Could not load plugins\Gildenmeister.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:105)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:158)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:106)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:63)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:215)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:202)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:142)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:257)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    Caused by: java.lang.ClassNotFoundException: com.bukkit.Ninjasturm.Gildenmeister
    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.java:97)
    ... 8 more

    Here is my plugin if you would like to test it on your server: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Dec 14, 2016
  6. Offline

    Ne0nx3r0

    I've had a lot of success using this example (which is also linked on the wiki tutorial):
    https://github.com/Bukkit/SamplePlugin/tree/master/src/main/java/com/dinnerbone/bukkit/sample

    That said, I think these are meant to be templates for a plugin, not ready to bake files. (though they probably build fine)

    What I've found to be more useful is to peruse the plugin releases section, or the plugin list for authors who post their source code, and read through that. I find them to be much more helpful than a blank template, since you can see how things are done practically.
     
  7. Offline

    Ninjasturm

    Okay thanks for the tips.

    I fixed the error with editing this in plugin.yml:
    main: com.bukkit.Ninjasturm.Gildenmeister.Gildenmeister

    I added the class at the end of the line.
     
Thread Status:
Not open for further replies.

Share This Page