1. Shprqness

    Shprqness Member

    8a3
    MVP
    Messages:
    94
    Firstly this is just me showing you guys some cool things you can do with the BukkitAPI, you will need general knowledge of java, 20 Likes and i will do a plugin tutorial.

    If you are creating a plugin for a minecraft server its good to have, lets say custom messages for commands, example, /hypixel = hypixel ip, here is the code (do not copy and paste, try and learn it):


    Step1 Create a class in your project

    Step2 add implements CommandExecutor

    Step3 Enter The Command Variable, mine is hypixel, you enter a String variable like this -
    Code:
    public static String hypixel = "Hypixel";
    Step4 Now you have your command ready you can create the actual constructor like this -

    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    
    return true;
    }
    Now we have our constructor setup, we can add our if statements, the comments are to tell you what every thing does - (comments are when i do `//text` in the code)

    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(sender instanceof Player){       //means if user is a player
            if(cmd.getName().equalsIgnoreCase(hypixel)){       //where i put hypixel you put your command you made in the variable before
    }
    }
    return true;
    }

    Now that we have our whole command contructor setup we can determine what happens on click.


    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(sender instanceof Player){     
            if(cmd.getName().equalsIgnoreCase(hypixel)){
                //i am going to determine sender as p as its easier       
                Player p = (Player) sender;
                p.sendMessage(ChatColor.RED + "hypixel.net"); //sends user message, chatcolor is the color of message
    
     
    
    }
    }
    return true;
    }






    Thats just a really simple way to send messages, if you have any questions dm me


    New tutorial comes out if you guys say you really want it
     
    #1
    Last edited: Jan 13, 2019
  2. Dance

    Dance Well-Known Member

    Dance_Dog
    MVP+
    LimboFish
    Guild Master
    Messages:
    4,853
    The code is rather difficult to read. Try putting each excerpt into a code block.
     
    #2
    • Agree Agree x 2
  3. Shprqness

    Shprqness Member

    8a3
    MVP
    Messages:
    94
    i will rewrite it now
     
    #3
    • Like Like x 1
  4. Dance

    Dance Well-Known Member

    Dance_Dog
    MVP+
    LimboFish
    Guild Master
    Messages:
    4,853
    Also I believe it’s “Override”, not “OverRide”. Haven’t touched Java in quite a while so I could be wrong.
     
    #4
  5. Shprqness

    Shprqness Member

    8a3
    MVP
    Messages:
    94
    yea when i did override it tagged the forums member with the name OverRide lol
     
    #5
    • Funny Funny x 1
  6. Simon_TI

    Simon_TI New Member

    JVMTI
    MVP
    Messages:
    9
    You should probably fix your code, the formatting looks really bad.
     
    #6
  7. Shprqness

    Shprqness Member

    8a3
    MVP
    Messages:
    94
    its because i wrote it on the forums so i was using spaces because tabs dont work lol
     
    #7

Share This Page