Basic Question

Discussion in 'Plugin Development' started by ShewShew, Dec 13, 2016.

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

    ShewShew

    Hello Bukkit Dev Community! I'm quite new to Bukkit development, but I am fairly familiar with Java. I've watched a couple basic bukkit tutorials and I've seen the standard
    "public boolean onCommand(CommandSender, Command cmd, String label, String[] args)" line for creating an in-game command. My question is... why is the return type a boolean instead of void? Sorry for the ignorance and thanks in advance! :)
     
  2. The boolean type is used so that if it returns false, it will show the player the 'usage:' message for that command in the plugin.yml

    For example, if you had this:
    Code:
    testcommand:
      usage: Not valid! Try this: /<command> arg1
    
    Then it would say to the player 'Not valid! Try this: /<command> arg1' when it returns false.

    Hope this helped!
     
  3. Offline

    mythbusterma

    @ShewShew

    Don't watch tutorials. The videos are all worthless and won't teach you how to make good plugins.

    There is the official Bukkit tutorial available on the web, that should help you get started.
     
  4. Offline

    FabeGabeMC

    @ShewShew
    The best knowledge you will be able to get is from the JavaDocs. Though they are a bit deprecated, to say the least, they should still help you out with any questions on what each method does and what each field contains.
    http://jd.bukkit.org
     
  5. Offline

    Zombie_Striker

    Last edited: Dec 15, 2016
  6. Offline

    FabeGabeMC

    @Zombie_Striker
    Didn't want to get shot down by mods with "Spigot isn't supported in this forum"
     
  7. @FabeGabeMC It is though since Spigot are updating Bukkit. They just still don't support Bungee, offline, modded the usual
     
Thread Status:
Not open for further replies.

Share This Page