Adding another command?

Discussion in 'Plugin Development' started by TimmoTastic, May 2, 2016.

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

    TimmoTastic

    I have a plugin I'm working on but I'm not really sure how to add another command after my first??? Can somebody help please????
    If you are wondering my first command is /hello an what it does is it says to the player: Hello! Thanks for playing on the server! how do I add another command????? Thank you! :)
     
  2. Offline

    CeramicTitan

  3. Offline

    Pattrick

    Simple! just do not include your public boolean! (do not include this in your next command!)
    Code:
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    
    Instead, use the second (if statement) line of the command
    Code:
    An example of the if statement would be:
    if (command.getName().equalsIgnoreCase("hello")) {
        sender.sendMessage("hello! ");
    if (command.getName().equalsIgnoreCase("goodbye")) {
        sender.sendMessage("goodbye! ");
    Note: Don't just copy and paste this! It is the worst thing you could do if you want to learn bukkit. Write it yourself and mess around with it!
     
  4. Offline

    WolfMage1

    Do else if otherwise you're just making unnecessary checks.
     
  5. Offline

    Lordloss

    For quite complex commands its a good idea to have seperate classes for each command. @Pattrick i would say spoonfeeding with disclaimer is still spoonfeeding :p
     
    mine-care likes this.
  6. Offline

    mine-care

    My trail of thought is:
    Someone who works with bukkit must know Java further than just how to spell the name.
    Java basics come with if statements as the very first lesson after the basic syntax.
    So i think someone who works with bukkit must already know :p
     
  7. Offline

    Davesan

    Yeah, this question is pure java. Your question is not really clear by the way. You want to add another command besides "/hello", or make something like "/hello asd" would make something different.. or add root command (like /hello" runtime, or simply add a way how the arguments are handled. These questions are different, but one point is shared in them, all of the is around base java and base bukkit, both well-documented and have tons of tutorials on it. You should check some tutorials, either/both videos and written ones.
    May this video would help you with adding basic commands:
     
  8. Offline

    XxTimexX

    @Davesan
    Maybe not the BCBroz videos...
     
    WinX64 and mine-care like this.
  9. Offline

    mine-care

    @Davesan No no no no no!!!
    Not TheBcBroz! Its the best way not to learn bukkit but distort the view you have in your head about it. Prefer the videos by PogoStickDev instead.
     
    WinX64 likes this.
  10. Offline

    SP3NC3RXD

    I 100% agree with you. He has tutorials on how to do just about everything. He even has a few series on making minigames too.

    Click here for a quick link to PogoStick's channel

    Highly suggested for anyone who is new like TimmoTastic
     
Thread Status:
Not open for further replies.

Share This Page