Basic BUKKIT plugin Tutorial

Discussion in 'Resources' started by Samkio, Jan 20, 2011.

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

    TerraPlay

    No problem! Again thanks for this tutorial, this helped me to get started with programming plugins =)
    Btw, i don't want to put you under pressure, but when do you think you will release the next tutorial?

    Keep up the good work!
     
  2. Offline

    Samkio

    Hopefully soon as soon as i finalise the plugin for the tutorial. :)
     
  3. Offline

    TfT_02

    This is great! I will give this a try.
     
  4. Offline

    haiyyu

    Hi.
    I started programming in Java some weeks ago.
    I'm administrator of a Minecraft-Server and I'm currently programming a plugin for it.
    But there's one problem:
    When I copy this code into my Plugin.java-File I get an error at this line (it's in the constructor):
    Code:
    super(pluginLoader, instance, desc, plugin, plugin, cLoader);
    This is the error-message:
    Code:
    The constructor JavaPlugin(PluginLoader, Server, PluginDescriptionFile, File, ClassLoader) is undefined
    I think something has changed in the Plugin-API so this doesn't work anymore. It says that I should add another File-argument so that the constructor looks like this:
    Code:
    public D3Whitelist(PluginLoader, Server, PluginDescriptionFile, File, File, ClassLoader)
    But what is this File-object good for?

    Sorry, my English isn't that good but I hope you understand what I'm asking.

    ~haiyyu
     
  5. Offline

    Samkio

    The source you link to is the sample plugin on the wiki and is not related to the basic plugin.
    That tutorial is outdated and the new was is below.
    Replace with this.
    Code:
    public D3Whitelist(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader)
      {
        super(pluginLoader, instance, desc, folder, plugin, cLoader);
      }
    Hope that solves your problem. :)
     
  6. Offline

    DoritosMan

    Thanks
    This was very helpful
     
  7. Offline

    Hohahihehu

    Thanks a lot for this tutorial, I would have had to try to cannibalize half the plugins on the forum and gone partially insane without it!
     
  8. Offline

    Samkio

    Glad you liked it and found it helpful! :)
     
  9. Offline

    MasterCtrl

    Dont worry... i cant spell that is all :(
    anyways thanks for the great tut :D
     
  10. Offline

    Samkio

    Thanks for the feedback! :D
     
  11. Offline

    Kiruwagaka

    which eclipse should i download?
     
  12. Offline

    Samkio

  13. Offline

    x66dme66x

    mac tutorial please. i tried following..but some things arent there.
     
  14. Offline

    Samkio

    The code will be the same for Macintosh.
    Just get the Mac Eclipse.
     
  15. Offline

    Torrent

    Can't wait for the next tut :p
    I'll make sure I don't upload to the channel at the same time like we did with the reviews xD
     
  16. Offline

    Samkio

    Doing it in a bit expect to see it up soon. :)
     
  17. Offline

    Schirf

    I have not written Java code in a few years, but after watching the tutorial... I think I'll write a plugin this weekend... Thanks!
     
  18. Offline

    Samkio

    Thanks for the feedback! Good luck :)
     
  19. Offline

    SeeD419

    Thanks a lot for the tutorial.

    Great way to get my foot in the door of the world of Java.

    Edit: Probably just something dumb I did but I get this :(

    Jan 30, 2011 9:35:11 PM org.bukkit.plugin.SimplePluginManager loadPlugins
    SEVERE: Could not load plugins\Basic.jar in plugins: name is not defined
    org.bukkit.plugin.InvalidDescriptionException: name is not defined
    at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:114)
    at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:29)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:68)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:117)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:82)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:43)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:153)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:140)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:104)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:181)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)

    Any idea? It's my first plugin :/
     
  20. Offline

    Samkio

    This normally occurs with an iccorect yml file.
    Place it in the .jar
    Also make sure the yml file has new lines.
    ie
    Code:
    name: Name
    main: com.bukkit.samkio.Package.Name
    version: 1.00
     
  21. Offline

    SeeD419

    Thanks Samkio. I'm going to try this now.

    Hmm...Same error :( This is mine:

    Name: Basic
    main: com.bukkit.seed419.basic.Basic
    Version: 0.3
     
  22. Offline

    Samkio

    Hmm make sure its case correct as it is case sensative.
     
  23. Offline

    SeeD419

    It is :(

    Idk what to do. I've tried like every case combination possible, but it's com.bukkit.seed419.basic.Basic in eclipse.

    Actually, I'm getting a different error now...hold on let me double check everything...
     
  24. Offline

    Kilajawa

    My plugin won't load at all. It does not even show in the command window....
     
  25. Offline

    xian

    thanks! a very good tutorial.
     
  26. Offline

    Samkio

    Make sure the jar is in the plugin directory and the .yml is correct.

    Your welcome :D
     
  27. Offline

    Kilajawa

    Alright i did it all and the plugins name is obviously Kila and I can't figure out what I did wrong. I did what you said to do but this error came up :(



    SEVERE: Could not load plugins\Kila.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:78)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:117)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:82)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:42)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:156)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:143)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:104)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:186)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Caused by: java.lang.ClassNotFoundException: com.bukkit.Owner-PC_Owner.kila.kila

    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:30)
    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:72)
     
  28. Offline

    CaptainDDL

    Great tutorial, thanks! I program in C++ and PHP for a living...no prior experience with Java, and this tutorial was easy to follow.
     
  29. Offline

    Valrix

    Thanks for the tutorial, this is actually my first Java creation, so yeah. Your tut popped my Java cherry :p
     
  30. Offline

    LukeZaz

    Hi, i'm new here - i was at the HMOD forums before bukkit came, And i've made a few small plugins for HMOD before so i'm not new to Eclipse, just Bukkit, I tried to follow your tutorial but due to the fact you copy-pasted i never saw code off to the side on the pm.registerEvent parts, I got most of the areguments but i cant figure out what Argument 4 is supposed to be (It asks for four arguments, in your video only 2 1/2 showed on the first pm.registerEvent and 3 shows on the second) so i can't figure out the rest.
     
Thread Status:
Not open for further replies.

Share This Page