I Need Help with my Plugin

Discussion in 'Spigot Plugin Development' started by TechWiz, May 31, 2015.

  1. Ok I am making a plugin so that when you kill an Entity you recieve £0.50.
    I am a beginner so please dont hate xD

    Hope you can help :)

    http://pastebin.com/AcwC7NXJ
     
  2. Did you have a question? I see numerous places in your code that would throw a NullPointerExceptio, for reasons which should be obvious.
     
  3. I just did what Eclipse told me to do when there was an underline....
     
  4. It says this in Console:

    [10:05:05] [Server thread/ERROR]: Could not load 'plugins\PennyPerKill.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.TechWiz.PennyPerKill.PennyPerKill'
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:291) [spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:528) [spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
    Caused by: java.lang.ClassNotFoundException: me.TechWiz.PennyPerKill.PennyPerKill
    at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_45]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
    at java.lang.Class.forName0(Native Method) ~[?:1.8.0_45]
    at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_45]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.8.6.jar:git-Spigot-6a6b839-b0e81a4]
    ... 7 more
     
  5. But do you know why eclipse told you to do that?

    As for the error. Make sure the class name in the plugin.yml matches the main class name. Also make sure the class exports into the jar.
     
  6. Also, don't use uppercases in package names
     
  7. would that be the problem?
     
  8. The PennyPerKill file is still in java syntax, how to I change to .class ?
     
  9. Whatever eclipse says? I am really confused right now as it is my first plugin
     
  10. First Java kuch kuch
     
  11. Java to .class, what? .java is what you work with and .class is the what it becomes when compiled.
    Do you understand Java, as it is a fundamental part of plugins...
    http://docs.oracle.com/javase/tutorial/index.html

    That may answer all of your questions.
     
    • Agree Agree x 1
  12. You obviously don't know Java -- at all. I highly recommend that you first learn Java, then you can move onto plugins. @nikmanG linked a great resource for learning Java; I suggest you completely read it.
     
  13. do I need to download JDK 8?
     
  14. Yes I know that .class is when its compiled, but the main class is not being compiled and it stays in the java syntax