Best way to learn how to make plugins?

Discussion in 'Plugin Development' started by jeroenhero123, Oct 15, 2014.

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

    Skionz

    Funergy likes this.
  2. Offline

    xMrPoi

    I hate when people leave a single bracket to its own line. In my opinion, it's just uneccesary and it wastes space.

    Oh god using
    Code:
    if(x==10)
    {
       x=0;
    }
    Instead of
    Code:
    if(x==10)
       x=0;
     
  3. Offline

    teej107

    I prefer using that way. Skionz I don't find it confusing at all. Each set of nested brackets has its own column. Easy for me to tell where the code block ends.

    EDIT: Unless the webpage removes all indentation from code. :p
     
  4. Offline

    FerusGrim

    It's funny - It doesn't remove the indentation with normal [/code] tags. Just [/syntax] tags.
     
    teej107 likes this.
  5. Offline

    teej107

    FerusGrim Really?
    Code:
    public void testIndent()
    {
        if(true)
        {
            //Do this
        }
    }
    EDIT: I say that makes the regular code tag A LOT better.
     
    FerusGrim likes this.
  6. Offline

    AdamQpzm

    teej107 likes this.
  7. Offline

    FerusGrim

  8. Offline

    AdamQpzm

    FerusGrim Meh, it looks better in my option.

    PHP:
    public void lockThread() {
        if(
    true) {
            
    // Nothing happens. And then it keeps happening.
        
    }
    }
    over
    Code:
    public void lockThread() {
        if(true) {
            // Nothing happens. And then it keeps happening.
        }
    }
     
  9. Offline

    FerusGrim

    AdamQpzm
    I guess that does look nice...
     
    AdamQpzm likes this.
  10. Offline

    parat26

    To be honest, I am not 'the expert' here, but since I finally finished the base for my minigame engine, I can truly say books helped more than anything else. Of course, I watched lots of YouTube Videos, and Java Tutorials but these worked as secondary practice because you have the opportunity to compare your coding style with others and see what mistakes they make.

    Solution: Books & Documentation.
     
    FerusGrim and AdamQpzm like this.
  11. Offline

    FerusGrim

    I think, at this point, the original question and goal of this topic has thoroughly answered, and any further responses would be kicking a dead horse, as it were.
     
    Totom3, AdamQpzm and Funergy like this.
  12. Offline

    Funergy

    FerusGrim I've looked at some YT videos but also some documentation on the Bukkit wiki. I've done some researches and looked at other plugins on github how they did it, and then I've tried it. but the most that helped me is the community on the bukkit development section. it helped me so much(as long they don't spoonfeed).
     
    FerusGrim likes this.
  13. Offline

    teej107

    And that doesn't get messed up by editing your post I assume?
    PHP:
    public void somethingHere()
    {
        if(
    true)
        {
            
    //DO THAT
        
    }
    }
    EDIT: Found my new favorite code tag.
     
    FerusGrim likes this.
  14. Offline

    mythbusterma

    teej107 AdamQpzm FerusGrim Skionz

    Just a note, that particular code bracketing (last post) is called "C-style" and is prefered when coding in C++ or C. The other ones in this thread are more traditional to Java, and whichever one you use is personal preference.
     
  15. Offline

    FerusGrim

  16. Offline

    Skionz

  17. Offline

    RingOfStorms

    Did you not read the posts before you saying BCBroz is one of the worst. It really is, don't post it :(. And also, I don't think I'll ever take anything seriously from someone who capitalizes every single word in their sentences... please learn how to write before you attempt to program.

    You can always replace tabs with spaces when pasting code into the forums. Copy your snippet into notepad++ and then replace all tabs with four spaces. The syntax tag removes tabs but it retains spaces.


    And that C-Style or whatever needs to burn away and be forgotten. No reason to increase your line count by double just for one character. And almost every IDE nowadays highlights the corresponding bracket or code block when coding so doing it to make it easier to see if kind of a mute point.

     
  18. Offline

    FerusGrim


    I have my IDE set to do this, already.

    What we were talking about was, when editing your post, and quoting a post with code in it, [/syntax] tags will lose the indentation, while [/code] tags will retain them.
     
  19. Offline

    RingOfStorms

    As I said, if you replace the tabs with spaces, the code will not lose indentation, even with syntax tag.
     
  20. Offline

    FerusGrim

    Try it for yourself. xD You're wrong.

    Even when I write code into here manually (Which I usually do), it loses its indentation with syntax tags.

    Code:java
    1. public void testingIndentation() {
    2. // testing!!!!
    3. }


    Code:
    public void testingIndentation() {
        // testing!!!!
    }
    EDIT: Just edited this. They both had four spaces.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  21. Offline

    RingOfStorms

    Ah well I just tried and I guess you're right. Weird because it works in the preview just fine. Not sure why it does that.

    Show Spoiler

    Picture of original code:
    [​IMG]

    Just copy pasted to the tags:
    Code:
    @Override
    public void onDisable () {
    getServer().getScheduler().cancelTasks(this);
    }
    
    Code:java
    1.  
    2. @Override
    3. public void onDisable () {
    4. getServer().getScheduler().cancelTasks(this);
    5. }
    6.  


    Tabs replaced with four spaces pasted to the tags:
    Code:
        @Override
        public void onDisable () {
            getServer().getScheduler().cancelTasks(this);
        }
    
    Code:java
    1.  
    2. @Override
    3. public void onDisable () {
    4. getServer().getScheduler().cancelTasks(this);
    5. }
    6.  


     
  22. Offline

    FerusGrim

    RingOfStorms
    No idea. It's definitely weird. And unfortunate, because I like the [/syntax] tags the most. :(
     
  23. Offline

    AdamQpzm

    mythbusterma I've heard it called allman style. I know a few people who are a fan of it, but I myself am not. Don't see what the big fuss is :p
     
  24. Offline

    mythbusterma

    AdamQpzm

    Preliminary research indicates that is the most common name for it, and I've heard it called "C-Style" mostly because that is opposed to "Java-Style." Also, something similar is encouraged by GNU.
     
    AdamQpzm likes this.
  25. Offline

    jeroenhero123

    Thanks for all your comments! ;)
    I'm back from my little holiday...

    I think that I'll go to the library to get some books about Java, and I'll watch the pogostick tutorials!
     
  26. Offline

    fireblast709

    Allman4life. I still find it more readable than the crappy Java standard :3.
     
    teej107 likes this.
  27. Offline

    ebear


    If you were still looking, here is an alright place to learn the basics. The best way to learn though, in my opinion, and I am learning as we speak, is to take what any tutorial does and expand on it. Try to make it better. See what you can do.

    You get better the more you code. Keep going. Start a project or two of your own and see where they take you (even if they're small).

    A great place to look if you're looking to see how to do something is the Bukkit JavaDoc.

    If you're confused on something, look it up on Google. Chances are, someone else was confused, and they've probably made a post on Bukkit or StackOverflow about it. If there are no posts, make one. People here are pretty helpful (most of the time).

    Well, I hope this helped. Best of luck to you.
     
Thread Status:
Not open for further replies.

Share This Page