Solved Java Then Bukkit API?

Discussion in 'Plugin Development' started by Sean0402, Aug 26, 2014.

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


    Learnt, You british?
  2. No, I'm Catalan :3
  3. Offline


    XXLuigiMario It is possible to learn through experience, so you have learned something (or should have) by using Bukkit. (And no, I do not claim that Bukkit is a good way to learn Java, before anyone tries to claim I do.)

    British English > American English :3
    PandazNWafflez and McMhz like this.
  4. Offline


    It makes our lives and yours so much easier if you take your time and learn Java. I jumped in without knowing Java. It only gets harder if you keep going in that direction. I can recommend you some tutorials.

    For Java
    Official Tutorial:

    For Bukkit
    Text: Take a look at the forums, it is basically a HUGE knowledge base

    I hope this helps!
    octoshrimpy likes this.
  5. What Luigi is saying... Is he is by no means, educated in java.
    What theguynextdoor is saying... In order to make anything out of bukkit api... You need to know java.

    You don't need to be completely educated. But in order to make something other than a soup of red underlines and misplaced curly brackets... You need to know something.

    I often hear the phrase... "Trying to code with bukkit before you've learnt java is like trying to run before you've learned to walk".
    But the concept I think theguynextdoor is trying to get across is... You can't be running unless you've got some knowledge in how to walk. Otherwise, how did you get going? You can't just put a bunch of bukkit into a program without any java conventions and expect it to run....
    Try and teach yourself to run... And you will have learned how to walk along to way.
    Try to teach yourself to code bukkit... And you will have learned java along the way.

    Try not to think of it as... You can't reach the higher level unless you build the lower one first...
    Think of it as... If you manage to make it to that higher level... Then you know for da** sure that you've built the lower one. Whether you tried to or not. You forced yourself to build it just by reaching the top.
    XXLuigiMario likes this.
  6. It's funny since I used to watch TheBCBroz's tutorials, but then I moved to PogoStick29Dev's ones.
  7. Offline


    Oh, by the way. I started off without knowing Java. I never truly understood my code until I did learn it. You would definitely benefit from learning the language.
  8. Offline


    I started without knowing java and with only a bit of knowledge of how code works. I would not recommend that to anyone.
  9. Offline


    I normally have one large comment somewhere on the internet a day... I guess this will be today's one.

    The question you're asking here has a very straight-forward answer, which is yes. You should learn Java before the Bukkit API. The example I commonly use is related to math, which is you have to learn basic math before breaching into geometry. This makes common sense and I can say everybody can agree with this, if you do not know basic math your math teacher will not teach you geometry before having this prior knowledge. Now this applies here, a teacher will not teach you an API without knowing Java and its language core (goes for any API). Sure, you can go online, take a look, and try to do it without knowing Java. You will attempt to, however chances are you will fail, or end up learning Java along-side it (note: this usually does end up limiting your knowledge on Java therefor ends up making you a worse programmer). The Bukkit API limits OOP and is generally not object-oriented, due to this people who go to learn Bukkit first usually don't understand object-orientation, lean to static, and generally end up writing worse code. Now saying this there are exceptions, however the chances aren't that great that you'll actually be one of those exceptions. I personally recommend that you take the time to learn the language and its core, then move on to an API when you understand the fundamental subjects of Java.

    EDIT: Forgot to mention that usually people who apply to those exceptions suggest learning Java first and regret not doing the same.
    xYourFreindx and hintss like this.
  10. Offline


    Pick me!

    hintss likes this.
  11. Offline


    ooooh, that's where the snapshots have been hiding! thank you! (fixed post)
  12. Offline


    es359, Aengo, PogoStick29 and 2 others like this.
  13. Offline


    Sorry, rather not. Rather give me a tutorial which teaches proper practices, like not using the Minecraft logger.
    0566, Aengo, hintss and 2 others like this.
  14. I personally believe that you cannot write legit Bukkit plugins without knowing the basic principles of Java. The first problem that arises for a rookie, is security and memory leaks. After that, you need a basic knowledge of OOP to enable extensibility and maintainability of your classes. While a plugin gets bigger, you need more Interfaces and Abstracts to seperate pieces of code so that way you can debug better, and locate these NullPointerExceptions way easier.

    In addition on having a basic knowledge, remember that Bukkit is an API. It is not a programming language, it is written in Java.

    ...and here comes these plugins with one one class ;(
    hintss likes this.
  15. Offline


    Word. As a beginner myself, I've ran into a wall before, just for people to say "you know [insert complicated something] but not [insert easier version or something]?" knowing Java so you can tap into the Bukkit API is a much better method.

    offtopic: Must just be me, I've noticed that even my thinking runs object-oriented , to maximize potential. It was only a matter of putting it down in code. I never understood how people manage with a single class. It gets crowded, harder to fix, and just overall looks not-as-nice. :S
    hintss likes this.
  16. Offline


    When did I use the Minecraft logger? Also, how is using a logger made for Minecraft a bad practice?
    hintss likes this.
  17. Offline


    fireblast709 I can't use javadocs, doesn't have search. doxygen has a search box + diagrams of object inheritence. It's amazing.
  18. Offline


    PogoStick29 because you are supposed to use the specific javaPlugin logger instead of a generic logger for minecraft that cannot be traced to source as easily.
    hintss likes this.
  19. Offline


    Logging for plugins should always use:
    getLogger() | from within the JavaPlugin extended class.

    Should you need to log directly to the server (Which you shouldn't, because it doesn't output what plugin it's coming from), you would use:
    getServer().getLogger() | from within the JavaPlugin extended class.
  20. Offline


    First episode of your plugin tutorial, Bukkit.getServer().getLogger(). Seems FerusGrim and Necrodoom beat me to the explanation.
    hintss likes this.
  21. Offline


    It's not, but there are better options. bukkit has its own logger that outputs to console a bit easier (or something)
    Tip #4: Get your own logger!
    Did you know that Bukkit gives each plugin their own logger to use for alerting the console?

    Doing what most people do..
    Logger logger = Logger.getLogger("Minecraft");
    Will force you to prefix every message you send so that server admins know where it's coming from. Instead of doing that, just use the logger provided to you like so:
    this.getLogger().log(Level.INFO,"Hello World!");
    Bukkit will automatically prefix your message with your plugin's name, and admins will never again have to find what is sending that message.

    --EDIT-- took time to get my source and double check that I was right, fireblast709 and FerusGrim and Necrodoom beat me to it.
  22. Offline


    Of course, PogoStick29, I haven't looked at your videos, so I couldn't possibly give real critique.

    What I would really like to see you, do, though, is simply own up to this mistake. Shit happens, no one's perfect. The best thing you could do (that we would all appreciate!) is if you made a simple annotation in your video, explaining the proper way to log via the BukkitAPI.

    Stopping the spread of bad practice is always great! :)
  23. Offline


    I'm american and use learned as well as learnt. they're both words, so why fuel the flame? the argument is bad enough. let's concentrate on giving help, instead of critiquing each other please. <3
    FerusGrim likes this.
  24. Offline


    or instead of .log(Level.INFO just do .info(
  25. Offline


    1. @Override
    2. public void onEnable(){
    3. this.getLogger().info("this is a log message"):
    4. }
    like that?

    so I could also do this.getLogger().warn, and this.getLogger().severe, and such?
  26. Offline


    octoshrimpy likes this.
  27. Offline


    ZachBora octoshrimpy

    Yes, this is also a good way to do it (and yes, you can use .severe(), .warning(), etc).

    .log() is mostly used in the case of a logging method.

    1. public void toLog(Level lvl, String msg) {
    2. getLogger().log(lvl, msg);
    3. }

    EDIT: To be called as,
    1. public void someMethod() {
    2. ...
    3. plugin.toLog(Level.SEVERE, "You literally broke the planet");
    4. ...
    5. }
    octoshrimpy likes this.
  28. Offline


    Yes..... "<4"
  29. @pogostick29dev Lol I've used all your tutorials to help make my plugins. I've got very far with your tutorials. I know have a custom coded hub server with most server made by me now.. From your help of your videos learning the Bukkit API.
    0566 and PogoStick29 like this.
  30. Offline


Thread Status:
Not open for further replies.

Share This Page