Basic BUKKIT plugin Tutorial

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

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


    I think these are the lines you're talking about:
    pm.registerEvent(Event.Type.PLAYER_COMMAND, this.playerListener, Event.Priority.Normal, this);
    pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Event.Priority.Normal, this);
  2. Offline


    Thanks, works,

    You know, after just 25-35% through the tutorial, I can already tell programming plugins in Bukkit takes more patience and code to make then Hey0, I hope this changes,

    I love the numbers here...What font is this?

    Repeated in 1337 speak cause i love the numbers:

    Y0u kn0w, 4f73r ju57 25-35% 7hr0u6h 7h3 7u80r141, 1 c4n 41r34dy 7311 pr06r4mm1n6 p1u61n5 1n Bukk17 74k35 m0r3 p4713nc3 4nd c0d3 70 m4k3 7h3n H3y0, 1 h0p3 7h15 ch4ng3s,

    1 10v3 7h3 numb3r5 h3r3...Wh47 f0n7 15 7h15?

    EDIT: Finished the tutorial, Plugin worked like a charm, Thanks!
  3. Offline


    I can't get it to work, this error shows up on a craftbukkit build 241 with only essentials and this plugin installed.
    SEVERE: Could not load plugins/basic.jar in plugins: null
    	at org.bukkit.plugin.SimplePluginManager.loadPlugin(
    	at org.bukkit.plugin.SimplePluginManager.loadPlugins(
    	at org.bukkit.craftbukkit.CraftServer.loadPlugins(
    	at net.minecraft.server.MinecraftServer.e(
    	at net.minecraft.server.MinecraftServer.c(
    	at net.minecraft.server.MinecraftServer.d(
    Caused by: java.lang.ClassNotFoundException: com.bukkit.samkio.Basic.Basic
    	at Method)
    	at java.lang.ClassLoader.loadClass(
    	at java.lang.ClassLoader.loadClass(
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(
    	... 8 more
    I also saw a forum topic asking to change the namespace from com.bukkit.colecf.Basic (but more general) to something else, so I first tried colecf.Basic but that caused more problems in addition to this.
  4. Offline


    Thanks btw, this helped bootstrap me into plugin development. :3
  5. Offline


    Yes if you change the package name you will have to change the yml file accordingly.
    Remeber it is case sensative. :)
  6. Offline


    If you make another vid, please don't copy and paste as much. I have to type stuff out to remember it and with you copying and pasting I got behind fast.
  7. Offline


    See intermediate plugin.
  8. Offline


    Oh, I didn't see that one. Thanks.
  9. Offline


    Hey there. First of all I would like to thank you for your wonderful tutorial as it has taught me a fair bit and has strengthened my will and determination regarding the coding of Bukkit plugins.

    Now the only issue I am having is to catching an event when any user places a block and broadcasting it to the server admins. I also can't seem to use getOnlinePlayers().

    Any help regarding these issues would be greatly appreciated.

    Thanks in advance.

  10. Offline


    That will broadcast a message to the whole server.
  11. Offline


    Ok so im looking at this with a good understanding of java and im wondering where i can find the list of events like player deaths etc because i want to make a bounty hunter plugin

    Found a list of events on the wiki like 5 mins after i posted but now i have another question its there a way to derive the killer in Entity Death so that i can award players for winning PvP fights?
  12. Offline


    EntiyDeath is not currently implemented i believe.
    Try The entitydamaged events to create an on Death hook.
  13. Offline


    Sigh that makes my job alot harder and how would i go about making hooks in eclipse i usually hard code in notepad straight to a compiler ;P
  14. Offline


    highz has made a death hook. I would recommend talking to him.
    Also it is good to learn eclipse as it makes things so much easier :p
  15. Offline


    Could you explain hashmaps a little more? From what I understand they're necessary to keep your server from lagging really badly from a plugin. I know arrays, but hashmaps (especially the ArrayList<Block> part) confuse me.
  16. Offline


    Not sure where you got everything you copy and pasted. I manually typed everything you copy and pasted. New to eclipse and java so I have no idea whats going on. I have been able to follow the tutorial though and am about half done.
  17. Offline


    Watch this video

    I think (I'm a newbie on bukkit too) the general idea is because hash maps are a bidimencional containers you can have a better way to search for a player, for instance:
    Here you can get the player and a ArrayList of the type "block" associated to him.

    Please correct me if I'm wrong =)
  18. Offline


    I messaged highz and got no response any alternitives?
  19. Offline


    Now teach us how to make a plugin
  20. Offline


    I watched the video and it answered a lot of questions, but it didn't answer the Arraylist<Block> question, because that was a general java tutorial.
  21. Offline



    The New Boston
    I started learning java from this guy, took me 1week to learn how java works, and like you I only know a little of lua, vb and c.
    After that I made a raffle program, watched samkios videos, and implemented it to bukkit...
    SO go for it, it's not that hard to make an easy plugin if you have the will [​IMG]
  22. Offline


    statement blocks say " //compiled code
    throw new RuntimeException("Compiled Code");" in source code
  23. Offline


    Thx for this video, nice tutorial.

    But i meet some problem in the code, can you help me please?

    I've got an error on:

    "if (debugees.containsKey(player)) {" ---> debugees ( debugees cannot be resolved )
    "if (enabled(player)) {" ---> enabled ( The methode enabled(player) is undefined for the type Basic )

    When exported in .JAR and tested in the server, i have an error at toggleVision when i try "/basic" xD

    I have watch your video so manytime and think have missed nothing but i cant fix thes errors...

    Edit: I have read that on oracle: ( )

    void enable()
    Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
  24. Offline

    Lee Hayward

    Great video tutorial, I'm already planning out some useful plugins for my server. Thanks, wouldn't have a clue without your help :)
  25. Offline


    I am having tons of errors when loading the plugin with the server.
    Samio could you please tell us which bukkit version to use? So that it works with the sources you attached in your first post? Or maybe upload a archive including bukkit lib + your sources? I am new to this whole plugin development thing and I can't just find a template (or basic plugin) that just loads without errors. Everywhere I see the library without a template or a template without the used library. See: you tell us to use the newest build which changes every few hours - so it doesn't really work with your code except when your code would also change every few hours.

    Thanks in advance.
  26. Offline


  27. Offline


    First let me start by saying thanks for the tutorial, with out it I would be even more lost then I am now. I do have a problem however and I know this was mentioned before and the person must of solved his problem but I can't figure it out. My problem is i'm getting an error on super(pluginLoader, instance, desc, folder, plugin, cLoader); It keeps telling my that "The constructor JavaPlugin(PluginLoader, Server, PluginDescriptionFile, File, File, ClassLoader) is undefined"

    here's my code:
    package com.bukkit.zinth.basic;
    import java.util.ArrayList;
    import java.util.HashMap;
    import org.bukkit.Server;
    import org.bukkit.block.Block;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.PluginManager;
    public class Basic extends JavaPlugin{
        public Basic(PluginLoader pluginLoader, Server instance,
        PluginDescriptionFile desc, File folder, File plugin,
        ClassLoader cLoader){
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
        public void onDisable() {
            // TODO Auto-generated method stub
        public void onEnable() {
            // TODO Auto-generated method stub
    I have checked it several times for spelling and syntax errors but I can't find any. I am very new to programing and have only done "HelloWorld" and a quick number adder in java before. I have taken a class on C# programing but it was a couple of years ago and I only remember the basics. If you could help me figure this out I would greatly appreciate it.
  28. Offline


  29. Offline


    Thank you Samkio, I think I also found another thing I was doing wrong was using CraftBukkit and not just Bukkit as the reference source. I hope that and the removal of the constructor will let me remake your Basic plugin I'm learning a lot [​IMG].
  30. Offline


    Forgive me if I'm being stupid. Is there a list of hooks available?
Thread Status:
Not open for further replies.

Share This Page