How do I get started with spigot development

Discussion in 'Spigot Help' started by Ibraheemkhazbak, Mar 22, 2020.

  1. Hello, so i have seen youtubers making tutorial videos on spigot. but i feel like that's not the source i should learn from, so I tried reading the javadocs (i have no exprience with docs) and when i could understand what everything means it still doesn't feel right like for example.

    Code (Java):
    getCommand("hello").setExecutor(new CommandHello());
    to make a new command and then you have to type

    Code (YAML):
    : Description
    : /<command>
    in plugin.yml

    and then in CommandHello class you need to type

    Code (Java):
    public class CommandHello implements CommandExecutor{
        public boolean onCommand(CommandSender sender, Command command,String label,String[] args){

    this is not assembled like this in the docs what i understand from docs is if you already know what to do
    and does the wiki page give me all the information
    if not:
    how do i start?
    #1 Ibraheemkhazbak, Mar 22, 2020
    Last edited by a moderator: Mar 23, 2020
  2. Next time you post code, use [code=Java] [/code] . Other than this, what you mentioned is correct. But to better understand, the Java docs usually show the methods and how an object is constructed. Something like
    Location loc = new Location(world, x, y, z). The java docs are supposed to be your best friend while you are coding. The Java docs show mainly a brief explanation of the method and how the object is supposed to be constructed.

    Now, to start off, your code should have your main class, the main class should contain your onEnable and onDisable methods. These will fire when your plugin is enabled/disabled. Inside the onEnable() should contain:
    - Event registration (PluginManager#registerEvents)
    - Command registration (Command#setExecutor, only if your command is in another class)
    - Any variable setting that is required to be used from the start, an example would be an instance variable of your main class.

    Now, plugin.yml should contain
    - Main class, defined with main: (package name).(class name)
    - Plugin Name, refrain from using spaces
    - Plugin Version, can be anything like 1.0-RELEASE
    - Plugin Author, defined with author: (name)
    - Commands
    - Permissions (if you want to assign a default permission level, then you should register, if not, there shouldn't be a need to)

  3. I'd recommend checking out this thread.
    Sometimes watching YouTube tutorials is a good thing if you want a guide on how to start, but you can also implement your own code in those tutorials to learn a bit as you go along.
  4. I am not sure which object you mean. They show you what a class/interface is supposed to do, what the methods do and what the parameters of the methods mean. They can also describe packages.
    Often, you do not need to declare JavaPlugin#onDisable().
    Again, not every plugin uses commands or listeners.
    These all are also not necessary.

    To the author of the thread:
    It seems like you are not able to write code by yourself. The reason is probably that you did not learn Java properly. But you need to know the Java basics (including OOP) to write a plugin.
  5. I know enough about java and i know oop but i dont know how to read the docs. does this ability come by practicing or is it actually that stressful to get 1 information from it?
    like for example:
    when you try to make a new event listener how do you know you are supposed to implement Listener
    and put @EventHandler before an event handler and also you should type what kind of event happened in the paramiter. i dont think the docs say that (Correct me if i am wrong).
  6. There's a lot of good documentation on the original Bukkit Dev Wiki that Spigot hasn't recreated, since it's already there. I think it'd be a good idea for the Spigot wiki to link to this older wiki, since it describes a lot of important concepts for plugin development.
  7. is craftbukkit the same as spigot or what because i am so confused because if that's true
    then i am just making a bukkit plugin and i would need the bukkit api right?

    Edit: i did some research and i think spigot is just craftbukkit but with better performance thanks for helping!
    #7 Ibraheemkhazbak, Mar 23, 2020
    Last edited: Mar 23, 2020
  8. CraftBukkit is a Minecraft server and the implementation of the API called Bukkit. Spigot is a fork of CraftBukkit. That means that Spigot is CraftBukkit with some modifications. If you make a plugin using the Bukkit API, your plugin will most likely work on CraftBukkit (which you should not use nowadays as there is: ), Spigot and Paper (which is a fork of Spigot).