I need help with plugins programming

Discussion in 'Plugin Development' started by BillyW, Apr 13, 2015.

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

    BillyW

    Hello
    I am new to programming and know almost nothing ..
    I'm starting to program a plugin and I need help
    I was wondering how to hp player appears instead of exp. example: hp is 20 then the number 20 appear in exp and if he takes damage the number will also change accordingly.
    and I wonder how I change the base hp server. I want to leave base 100 hp
    Thank you.
    I apologize for my bad English.
    If someone speak Portuguese I ask that responds in Portuguese to help me = D
     
  2. Offline

    MgMaor

    To change the max hp - player.setMaxHealth(100);
    To update EXP bar - use events EntityRegainHealthEvent and EntityDamageEvent and do player.setLevel(x) so it will update the exp bar.
     
  3. Invisible

    nverdier

    @BillyW I suggest you learn Java before making Bukkit plugins and using the Bukkit API. Read about that here.
     
  4. @BillyW Like @nverdier said, I also suggest that you learn Java. If you try to learn Bukkit before Java, 'all hell will break loose', so to say (I would know, I made the same mistake). You won't know what your typing. A lot of people that head straight into Bukkit without the knowledge of Java get errors, and then post here, even if the solution is right in their face. And even when we supply the answer, they don't get it, because they don't know Java. The Bukkit API is coded entirely in Java. Just like a lot of languages, you can't speak it without learning first. I suggest clicking Naya's link, or look up some tutorial websites on Google. (I must advise you, do not try and learn from any YouTube tutorials, *cough* TheBCBroz *cough*, they teach bad ways of doing things and won't explain why they're typing things.)
     
    nverdier likes this.
  5. Offline

    SirMonkeyFood

    I concur, good sirs. Learning Java through Bukkit keeps your interest, and shows more applications than just coding some equations or text adventures. However, I'd definitely recommend learning the basics. As for @BillyW , read up on using bukkit schedulers. Schedule an event to every so often check for a player's health. Then set their xp at that level. To change their base health, give a player a health boost enchantment on join, for a really long amount of time, which minecraft will automatically turn into infinity.
     
    Last edited: Apr 14, 2015
  6. Invisible

    nverdier

    @SirMonkeyFood First thing to do is learn Java. After all, Bukkit plugins are written in it. And then you can learn the Bukkit API, which is just a tool when writing code in Java for Bukkit servers.
     
  7. Offline

    SirMonkeyFood

    @nverdier Yeah, he should, but there's no reason why he can't learn both at the same time. You definitely need a basic understanding of what you're doing, but you can learn as you go.
     
  8. Invisible

    nverdier

    No.
     
    CodePlaysMinecraft likes this.
  9. Offline

    Skionz

    This is a terrible idea. People who learn Java from Bukkit don't understand simple OOP principles, programming logic, and I can assure you that their code will be littered with redundancies. If they are bored of simple programs why not do something Minecraft related? The OP could write a simple server spam bot using Swing.
     
    CodePlaysMinecraft and nverdier like this.
  10. Offline

    SirMonkeyFood

    You could be right. This pretty accurately describes anyone who just hops on youtube, watches a quick video, and then can't understand what they're doing. I'm talking about learning java alongside bukkit. You cut off the part where I said to learn the basics first. Everyone makes stupid mistakes when they first start off, but you'll get there. I have a few friends who jumped into bukkit, and learned Java with it, and are now pretty great coders. Ask them what they're doing and they could explain it. Everyone learns differently, I guess.

    @nverdier
    I guess we differ in opinion. This is an opinion on how to best learn after all.
     
    Last edited by a moderator: Apr 14, 2015
  11. Invisible

    nverdier

    @SirMonkeyFood There is no opinion. You just don't understand. Would you tell somebody to learn to bike at the same time as learning to walk?
     
  12. Offline

    SirMonkeyFood

    @nverdier Apples and Oranges. Bukkit can be a window into Java. Would you tell someone who's just learning to read learn to write at the same time? Both work off the same principles.
     
  13. Invisible

    nverdier

    @SirMonkeyFood Not at all. When you write a Bukkit plugin, you are writing Java code. And you just happen to be using an external library called "Bukkit". But you still have to know Java to use the API.
     
    Last edited by a moderator: Apr 14, 2015
  14. Offline

    SirMonkeyFood

    Exactly. You don't need to know EVERYTHING to make plugins though. Pick up on the main scheme of things and run from there.
    EDIT: Like I said earlier, learn as you go.
     
  15. Invisible

    nverdier

    No no no no no no no no :mad: You must learn Java and then the Bukkit API.
     
    Konato_K and CodePlaysMinecraft like this.
  16. Offline

    SirMonkeyFood

    :eek: Whatever you say.
     
  17. Offline

    teej107

    @SirMonkeyFood Yes, Bukkit can keep the interest of people, but it is better to know Java first rather than learning two things at once. Basic Java knowledge is all you need to start learning the Bukkit API. Bukkit is just an API, Java is the language. You wouldn't write a book in a language you don't know so don't do it with code. Yes, you could do small learning exercises with Bukkit but I wouldn't recommend it. Bukkit does a lot of things for you and I've seen some people make mistakes assuming Bukkit would do the work like they think it would when in reality, their problem is the fact that they don't know how Java (or how OOP) works.
     
    Last edited: Apr 15, 2015
  18. Offline

    nj2miami

    I see no problem learning Java while using Bukkit as your guide. The problem is when you start asking general questions that would be naturally answered if you knew Java. It is very common to see what you may think as a "Bukkit" question that is simply just the incomprehension of Java.
     
    SirMonkeyFood, nverdier and teej107 like this.
  19. Offline

    SirMonkeyFood

    I feel like we just commandeered BillyW's thread.
     
  20. Offline

    teej107

    @SirMonkeyFood Manifest Destiny

    Actually we were giving our thoughts on what he should do.
     
    SirMonkeyFood and nverdier like this.
  21. Offline

    SirMonkeyFood

    [​IMG]
    *finds the perfect meme*
     
    Konato_K and teej107 like this.
  22. Offline

    meguy26

    This has become quite the heated debate...

    Personally I only learned java because of minecraft, and bukkit, but I can say that was a horrible decision. My early code was absolutely disastrous, and im only beginning to use inheritance and other OOP stuff, so I agree with @nverdier LEARN JAVA FIRST!!! However, if you feel the only way to learn java is to code bukkit, be prepared for massive errors, terrifying stack traces and criticism on the forums :)
     
    nverdier likes this.
Thread Status:
Not open for further replies.

Share This Page