Best way to learn Java.

Discussion in 'Plugin Development' started by calebbfmv, Jul 26, 2012.

?

What is the best way to learn programing?

  1. Videos, and reading?

    29.2%
  2. Diving and learning as you do it?

    58.3%
  3. Something else? Post it!

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

    calebbfmv

    It has come to me attention that I SUCK at Java, I thought I knew what I was doing but I really did not. I need to ask you guys, what is the best way to learn Java? Whether it be NewBoston, or JavaVideoTut or just reading a bunch of boring pages, whatever would help me the most. But if one of you guys would be willing to help me learn coding, i.e when I need help, not giving me the code but kind of nudging me in the right direction, that would be awesome! I really would like to code way better in Java, and if anyone out there can help me get better, I would love to know who.

    Thanks for reading all my stupid posts,

    Caleb F.
     
  2. Offline

    ZeusAllMighty11

    One does not simply 'suck' at java

    I learned basica parts of Java from examples, Bucky , and just other projects
     
    iTechRemix, hawkfalcon and WarmakerT like this.
  3. Offline

    calebbfmv

    Man, it seems like I do, every time I need help with something the people who help me say, "Do you know the basics of Java?" I thought I did, but I don't as well I need to.
     
  4. Offline

    ZeusAllMighty11

    People say that to me too... I don't know everything, obviously. I know the basics. I don't appreciate when people say 'Learn java'... ;P A bit rude to be honest. So I know whatcha mean. But it always helps to read over, check bucky's tuts because sometimes I miss stuff and you might too
     
    Niknea likes this.
  5. Offline

    calebbfmv

    OK, but it is this ONE plugin that I am making that is driving me INSANE!
    I think I know how to do it, but I am not sure.
     
  6. Offline

    BrittonR

    Just modify the actual Craftbukkit code to get a hang of java.
     
  7. Offline

    calebbfmv

    I have, but I am stuck on one thing for my first plugin release if anyone could help, with skype would be perfect, I would greatly appreciate it
     
  8. Offline

    evilmidget38

    That seems like a very difficult way to learn Java.

    calebbfmv The best way in my opinion to learn java, is to start by doing a textbook. Just start with something simple. Once you feel you have a basic-moderate understanding of OOP(Constructors, pointers, objects, inheritance, etc) you can consider doing some basic plugin tutorials. I think developing plugins can be a good way to learn java, as it's something that's very easy to become motivated about, and the api is actually fairly simple to use. Also, don't be afraid to ask questions in #bukkitdev, however, I will warn you now - if you don't understand basic OOP then you will receive minimal help, and mostly people telling you to go learn java.

    A good Java Textbook(It was free so I put it onto Google Docs).

    Dinnerbone's plugin tutorials.
     
  9. Offline

    calebbfmv

    I under stand basic OOP ( I think) but, I don't think what I am doing is simple, well it is, but not to me.
     
  10. Offline

    evilmidget38

    Just post your problems here, so people can try and help you.
     
  11. Offline

    calebbfmv

    OK here it goes, I think I suck but maybe not:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    Player player = (Player) sender;
    Permission perms = <----- Basic OOP?
    if (cmd.getName().equalsIgnoreCase("admin")) {
    perms.playerInGroup((Player) sender, "Admin"); <--- playerInGroup is underlined? Change it?
    {
    //Lists all on line admins

    }
    return false;}
    return false;}}
     
  12. Offline

    ZeusAllMighty11

    perms.playerInGroup() is not a relative method to Bukkit API. It's native, and I'm not sure if you 'CopyPastad' that, but unless you are implementing some type of permissions system, that's not going to work for you. If you are trying to get a user from a group, implement the permissions system (if you have not already), and look at their API (which they hopefully have) to see how to get a group.
     
  13. Offline

    Ne0nx3r0

    Haven't tested this outside of notepad, but here's a general rewrite for you:
    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
    {
    //To disable running commands from console
    if(!(cs instanceof Player))
    {
    plugin.getLogger().log(Level.INFO,"You cannot run this command from the console.");
    return false;
    }
     
    Player pSender = (Player) sender;
     
    if(cmd.getName().equalsIgnoreCase("admins"))
    {
    String sAdminListString = "";
    foreach(Player p : Bukkit.getOnlinePlayers())
    {
    if(p.isOP())//<- or whatever check you would use,
    {
    sAdminListString += ", "+p.getName();
    }
    }
     
    pSender.sendMessage("Available admins: "+sAdminListString.substring(2));//Notice we are removing the first comma and space
     
    return true;//was a valid command
    }
     
    return false;//this plugin doesn't think this was a valid command
    }
    
    As Zeus said the perms object you are using might refer to something with vault or another permissions plugin, but it's not native to Bukkit so it's difficult to say what you want there.

    I'm not sure what your goal was, but that should give you a decent overview of how to iterate players, etc.
     
  14. Offline

    Icyene

    I started with something I was greatly interested at the time, macroing in RuneScape. There used to be this illegitmate (=P) API made by some developers that you could use, and they had a community much like Bukkit. The fact is that no matter how much I sucked at Java, I would always come back, because I wanted to make a macro! So after around 2 months of stopping and starting, I actually released my work, and it was appreciated.

    In this scenario Bukkit could be the equivalent of that community, provided you love Minecraft enough to battle through exceptions that seem to be coming out of nowhere. One book that I found was really helpful was Java 2 in 21 Days. Sure, it was outdated, and now there is a Java 6 in 21 days, and Java 7 in 21 days, but if you need a quick way to do something and an explanation for how, I would suggest you get that book. It is written in a very reader-friendly way, and the content is very good. From AWT to virtual chatrooms and online trivia, this book has it all. At the end of each chapter, they have a little (cheesy) Q & A section. The book also comes with a CD containing the JDK, and all the code samples. Unlike other books that I've seen, this one actually has full, working code samples, so you don't have to worry about initializing variables and so on.

    Alternatively, you could spend some time browsing through the resources section of Bukkit, as they have some nifty code there that you will definitely learn something from, and perhaps will even give you an idea for a plugin.

    Hope that helped!
     
  15. Offline

    calebbfmv

    My goal was to list all online admins when you do /Admin I am referencing PEX right now for my test server, but vault would be better
     
  16. Offline

    SnowGears

    I would recommend buying ( or checking out at a local library ) Head First Java. I used it in school to learn and it teaches you all the essentials to java without being too dull like most other books. Within a few weeks you will be able to make your own simple games like battleship and tic tac toe with graphics. Then you can try your hand at bukkit development once you feel you have mastered the skills in the book. The best way to learn java is not sit reading the book cramming new things into your head. Try them out. Write simple programs using what you have learned to see if you can do it. Try and try again and then once you get it, move onto the next topic. You will see that the skills start to build on each other and soon enough you will be writing plugins with ease. Hope this helps.

    EDIT: Another GREAT thing to practice with is gridworld. It is the program tested on the AP Comp Sci test and working with the methods it uses and implementing new mods to it greatly helped me when it came to using the methods of Bukkit. I would definitely check it out and look up a few tutorials on how to make simple things in gridworld. Happy coding.
     
  17. Offline

    calebbfmv

    Thanks but I have been taking Java for a month now, and I am still newish to bukkit.
     
  18. Offline

    SnowGears

    Ya I would definitely practice more with java and the basics before you jump into something as deep as Bukkit. Try to write a few simple games like tic tac toe or snake. Problem solving is 80 percent of coding. You have to accomplish a goal, and to do that often times you need to be creative with how you accomplish it in the most efficient way possible.
     
  19. Offline

    calebbfmv

    I have :) But now I move on to bukkit. I need some help I have gotten this far....
     
  20. Offline

    Sagacious_Zed Bukkit Docs

  21. Offline

    calebbfmv

    I have been! I just cannot seem to get this it is right there but I can't reach it....
     
  22. Offline

    Ne0nx3r0

    Those are fun; like Sudoku puzzles you solve with code. <3
     
  23. Offline

    d33k40

    just give to the group Admins a permision, so when u check player, if they have that permision that player is admin.
     
  24. Offline

    SnRolls

    I prefer to go to a proffesional course wich is expensive but worth it, i know the basics perfectly.
     
  25. Offline

    calebbfmv

    Hmmmm
     
  26. Offline

    d33k40

    Here in spain is about 300€, not expensive here i think.
     
  27. Offline

    Firefly

    Honestly, I learned everything I know from coding silly little plugins after reading through the Bukkit Plugin Tutorial.
     
  28. Offline

    calebbfmv

    Yeah, that helped me a lot! But this is more than what they are saying in the Plugin tutorial.
     
  29. Offline

    Firefly

    That's why I un-explicitly said start small. No need to start making plugin that requires another plugin as a dependency. To list all the admins online, just do a simple isOp() check for now until you figure out how to hook into other plugins.
     
  30. Offline

    calebbfmv

    :mad:ARE YOU KIDDING ME! ALL THIS WORK!!!!!

    isOp(); doesn't work? Define a variable?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
Thread Status:
Not open for further replies.

Share This Page