Multiple IF

Discussion in 'Plugin Development' started by Anrza, Jul 10, 2014.

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

    Anrza

    I wonder if it's possible to make it so that if one of multiple IF-conditions is true, the following method can still be triggered.
    Example:
    Code:
    if (event.getPlayer().getItemInHand().getType().equals(Material.STICK)){
                    event.getPlayer().setHealth(0)
    So that I can set multiple materials that will set their health to 0.
    Is it or is it not possible?
     
  2. Offline

    mazentheamazin

    Anrza
    Yes, &&. Please learn Java before going into the Bukkit API.
     
  3. Offline

    Anrza


    Sorry, cba. Thanks for answer anyway.
     
  4. Offline

    EviiL

    Look into Else If statements if you need an answer fast... but I will reinforce what mazentheamazin has already said, Its best you learn java before playing with Bukkit.
     
  5. Offline

    Anrza

    Sorry, that checks if both conditions are met. I want to check if either condition is met.
    And, oh, I really cba learning java from scratch. I started, I learned a bit and I got tired of it.
     
  6. Offline

    mazentheamazin

    Anrza
    'cant be asked' is a really negative attitude when doing something that can ruin your potential career as a programmer; there are already so many posts and discussions over how using an API before learning the language can hurt your career as a programmer. I cannot see anything that you as a person or a programmer can get from this, if you do please; inform me.

    EDIT: || will return true if one of the statements in the said if statement are true.

    What you're doing is the equivalent of learning advanced calculus before learning how to multiply numbers.
     
  7. Offline

    Anrza


    Yes, I know it's a negative attitude towards it, and thank you for the advice, and I'm very aware of the importance of a good foundation when studying/learning something. I've had this problem when studying languages and occasionally with maths.
    But all I want is plugins that work the way I want them to, not to get a career as a programmer. Yes, I've heard the "don't just copy and paste" before, and I don't just copy and paste. When I see something that I might need in the future, I make sure I understand it, but I am not interested in watching boring from-scratch tutorials or reading about it, as I learn far better by doing it my own way.
     
  8. Offline

    mazentheamazin

    Anrza
    Well, put it this way... Go to yourself when you were 5 and ask him what he wants to be when he grows up, he'll say like a fireman or similar; some of those children become lawyers when they grow up when they don't expect it since they learned the benefits of the field and/or have found the field fun. My point is that currently you're putting yourself in this closed-mind of programming due to working with an API that make what may seem as very complicated to be done in one simple method, which can destroy your POTENTIAL career as a programmer. You may not need it, but it'll be nice to know that you have the ability to do so easily; that's why you really don't need majority of the information you get at school, but you're given it anyways. Programming doesn't just teach you how to program but opens your mind up to different and more complicated concepts, which are quite beneficial in almost any field. Since you're already doing it, why not do it the right way?
     
  9. Offline

    Necrodoom

    Anrza thats the still the effective equivalent of trying to do advanced calculus before knowing basic math. You may not be planning to become a mathematician, but that doesn't mean you cant learn the foundations before progressing.

    Further more, this is a section for plugin development, not for basic Java questions.
     
  10. Offline

    Anrza

    mazentheamazin Ok, I totally get your point. You are right. But I have a shitload of other stuff I'm trying to learn. So this small spare time interest that I probably wont ever have a use for other than playing alone on my own computer doesn't feel important enough to me. Thanks for trying to convince me, but you didn't succeed. I will look on basic java forums in the future.
     
Thread Status:
Not open for further replies.

Share This Page