Intermediate BUKKIT plugin Tutorial

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

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

    Samkio

    <font color="rgb(51, 102, 255)">Intermediate BUKKIT plugin Tutorial</font>

    This tutorial is the pre-sucessor of Basic BUKKIT plugin tutorial found here.

    In this tutorial i will teach you how to make directories,datafiles,properties files and general Java stuff. In the tutorial we make an economy plugin. :)

    Video:

    MoneyBukkit
    LoadSettings
    PluginProperties

    Text:
    First up links:
    Latest BUKKIT: http://ci.bukkit.org/job/dev-Bukkit/
    Eclipse: http://www.eclipse.org/
    Java SE: http://www.oracle.com/technetwork/java/javase/downloads/index.html

    Source (Fully Annotated):
    <Edit by Moderator: Redacted mediafire url>

    <font color="rgb(0, 0, 255)">Feel free to PM me any questions you have </font>:)
     
    Last edited by a moderator: Dec 15, 2016
    Overfiend likes this.
  2. Offline

    Torrent

    About time ;) haha.
     
  3. Offline

    DoritosMan

    Thanks for this
    It is very helpful
     
  4. Offline

    Bauer

    This is a great tutorial.

    Very helpful.
     
  5. Offline

    HugoLandreville

    Thank you very much for this tutorial. Pacing and explanation are just right for people who are learning. Don’t change it if you ever do more tutorial. And I hope you do.

    And as a proposition [​IMG] I would like a tutorial on creating a recipe with 2 objects creating a new one. It could be 3 items that already exist in minecraft to skip creating a picture or model for the new items. Something like (water bucket + lava bucket = obsidian block).

    But thanks anyway for this great tutorial.
     
  6. Offline

    Samkio

    Not sure if that that is possible at the moment will look into it.
    Howerer i will be doing another tutorial which i hope to implement Sql and php to send stats to a website for instance.
     
  7. Offline

    blaatz0r

    Could you add some links in this topic to the video, where a certain section begins? Like so:

    Code:
    [url=http://www.youtube.com/watch?v=nsdWqpsVhHc&t=6m0s]LoadSettings[/url]
    Btw, you don't have to check the existence of a file before calling File.createNewFile():
    Good work!
     
  8. Offline

    highz

    This one is soooooo much better than the first one.
    Now you are typing everything so anybody can follow it!
     
  9. Offline

    Samkio

    I will do this! :)
    I didn't know you didnt have to check! Thanks :D

    Thanks glad you found it helpful! :)
     
  10. Offline

    Torrent

    It is better that you type the majority of the code.
    Makes it easier for people to follow ;)
     
  11. Offline

    Samkio

    Thanks :D
    Takes longer but i hope it is beneficial to viewers.
     
  12. Offline

    drampelt

    I get this error when I try to run it:
    Code:
    Feb 1, 2011 11:09:37 AM org.bukkit.plugin.SimplePluginManager loadPlugins
    SEVERE: Could not load plugins/MyEcon.jar in plugins: null
    org.bukkit.plugin.InvalidPluginException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java: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:40)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:154)
        at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:141)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:102)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:179)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Caused by: java.lang.ClassNotFoundException: com.bukkit.DanielR.MyEcon
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:30)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:72)
        ... 8 more
    
     
  13. Offline

    CaptainDDL

    This tutorial was great! I learned tons. Now I feel I can wade through the JavaDocs and make me something of my own, thanks!
     
  14. Offline

    Samkio

    Glad you found it helpful :D
     
  15. Offline

    nickthemenace

    Thanks for this (and the basic one), very useful!
     
  16. Offline

    Colecf

    Do you have any tips on next steps? I know there's the javadocs, but I find those not that useful with the lack of in-code use examples. (not neccicarily a full example program) are the javadcs my only option?
     
  17. Offline

    Samkio

    @Colecf
    Java docs are a good source.
    But also try other plugins source code. To learn how they have done things. :)
     
  18. Offline

    Colecf

    I'm following along making a cuboid plugin instead of a economy plugin, but when I get to the player listener file, Eclipse gives me errors on the sidebar saying that my main file cannot be resolved into a type. This is on the declaration of the plugin variable (first line inside the playerlistener class on your source code) and wereever it's called. I'm looking at my main file and I can't see how it's different from yours!
     
  19. Offline

    Samkio

    @Colecf normally due to spelling/captilisation differences.
    Make sure the variables are the same.
     
  20. Offline

    Colecf

    I copied and pasted the main file name and it still doesn't work :( Were's the declaration for the main file class? Is it the constructor?
     
  21. Im sorry i'm new at programing, this tutorial seems great so far, it's helping me alot, but I havent started yet because I want to make sure: I cant seem to be able to download Java SDK on mac... will this still work?
     
  22. Offline

    Samkio

    @fofogogo23 Java is the same on all platforms thats what makes Java, Java. :)
    I do not work with MAC but i think there is an OS X version or a Mac alternative somewhere.
     
  23. Oh ok :) Thanks, but anyways I give up, I can make the economy plugin in your tutorial fine... since I copy exactly what you do xD Without copying you I'd be lost, so I give up trying to program plugins xD But thanks anyways, great tutorial. I actually learned alot of stuff. I just wouldnt be able to do something epic :)
     
  24. Offline

    Colecf

    Ah, found my problem. Somehow I made my playerlistener class file in the wrong project, and so it imported the wrong package. :p
     
  25. Offline

    cordeval

    Noob guidance request-
    I am looking for advice from experienced bukkit plugin folks on what programming related details I should pay particularly close attention to in the tutorials as I joust my windmill: a new mob.

    In other words, please provide advice on the keywords, classes, issues, and steps I need to look for in the tutorials that will later tie into my goal of creating a new mob (or re-purposing an existing mob)
    [Yes, if I re-purpose an existing mob I'll hack a way to get the benefit it provides. Squid for example: I'd use bukkit plugin EssentialEco sign trading to let players get ink sacs]

    Assume:
    1) I know there ain't no such thing as a free lunch (not asking you to make a plugin for me and I've searched but not found what I am looking for in existing bukkit plugins)
    2) I recognize I am a naive-to-what-it-will-take noob, but like many noobs, like to think I might get it to work (demonstrating just how naive I am)
    3) I will begin by going through the tutorials and other links mentors might provide
    4) I will actually try to listen to advice and follow along with examples
    5) I'll try to figure out things myself before asking whomever does provide me advice.
    6) I'm not a complete noob, I admin a small scale SMP for my private LAN at home (four of us in the family), am comfortable enough with the CLI (linux based MineOS is a beautiful thing), and can suss out at the more simple parts of what goes on in various bukkit plugins I run on my SMP (Essentials, Fly-Ridge-Fly, VoxelPort, VoxelSnipe, Tombstone, DynMap).

    Thanks
     
  26. Offline

    Samkio

    @cordeval
    Creating new mobs/blocks/textures etc would require both a sever side modification and a client side modification.
    With someone with no experience I do not recommend trying it.
     
  27. Offline

    Malkierian

    Ah, someone finally confirms what I've been thinking! So, how would I go about adding obsidian tools to servers? (BTW, I know this isn't really possible with the plugin interface. The API just isn't there for importing custom items. I've tried already :D) I've gone through the process of adding the items (ingot, tools, sword) to the client (and tested them in single-player. They pretty much work, except for the desired increase in speed (they also don't show any names...)). But when I try to add them in a server (same code changes, same files) it gives me "Error: null" when I try to do /item etc... Any suggestions?
     
  28. Offline

    Samkio

    @Malkierian
    Is is as simple as the item not being on the database.
    or
    /item command not working?
     
  29. Offline

    Malkierian

    It seems to be that they're not in the database, because TooManyItems doesn't even show them but I don't know what database you're referring to... TooManyItems shows that it's there in the client (though it doesn't give them names), but the server acts as if I hadn't added anything to the Items list.
     
  30. Offline

    compwhizii

    Code:
    public MoneyBukkit(PluginLoader pluginLoader, Server instance,
                PluginDescriptionFile desc, File folder, File plugin,
                ClassLoader cLoader) {
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
        }
    I'm sure you know that's deprecated, but here's the fixed version on my host: http://file.compwhizii.net/BukkitIntermediateSrc.zip
     
Thread Status:
Not open for further replies.

Share This Page