Basic BUKKIT plugin Tutorial

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

  1. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks for this. Sometimes the reader reads it wrong so its best to write on 3 sepertate lines.
    Will update tutorial. :D
  2. Offline

    TerraPlay

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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!
  3. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hopefully soon as soon as i finalise the plugin for the tutorial. :)
  4. Offline

    TfT_02

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This is great! I will give this a try.
  5. Offline

    haiyyu

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  6. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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. :)
  7. Offline

    DoritosMan

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks
    This was very helpful
  8. Offline

    Hohahihehu

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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!
  9. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Glad you liked it and found it helpful! :)
  10. Offline

    MasterCtrl

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Dont worry... i cant spell that is all :(
    anyways thanks for the great tut :D
  11. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks for the feedback! :D
  12. Offline

    Kiruwagaka

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    which eclipse should i download?
  13. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  14. Offline

    x66dme66x

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    mac tutorial please. i tried following..but some things arent there.
  15. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The code will be the same for Macintosh.
    Just get the Mac Eclipse.
  16. Offline

    Torrent

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  17. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Doing it in a bit expect to see it up soon. :)
  18. Offline

    Schirf

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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!
  19. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks for the feedback! Good luck :)
  20. Offline

    SeeD419

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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 :/
  21. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  22. Offline

    SeeD419

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  23. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hmm make sure its case correct as it is case sensative.
  24. Offline

    SeeD419

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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...
  25. Offline

    Kilajawa

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    My plugin won't load at all. It does not even show in the command window....
  26. Offline

    xian

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    thanks! a very good tutorial.
  27. Offline

    Samkio

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Make sure the jar is in the plugin directory and the .yml is correct.

    Your welcome :D
  28. Offline

    Kilajawa

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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)
  29. Offline

    CaptainDDL

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Great tutorial, thanks! I program in C++ and PHP for a living...no prior experience with Java, and this tutorial was easy to follow.
  30. Offline

    Valrix

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks for the tutorial, this is actually my first Java creation, so yeah. Your tut popped my Java cherry :p

Share This Page