Solved Problem with when attacker get 100XP Then SendMessage

Discussion in 'Plugin Development' started by 22Flamey, Aug 21, 2016.

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

    22Flamey

    Hey,i did when u hit entity u got xp per hit,and i did when u got maxLevel(100xp)you got message.the problem is i get the message every hit
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    i want to do when u got MaxLevel(100xp)its send you the message
     
  2. @22Flamey
    What you are checking now is if it is less than or equal to your number, you probably want to check if it is greater than or equal to it.
     
  3. Offline

    22Flamey

    i want to do when u got maxLevel its send to you message

    can u help me fix my code?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 21, 2016
  4. @22Flamey
    Just change "<=" to "=>", and you should be fine.

    Also, this is rather simple, you might want to have a look at some java tutorials.
     
  5. Offline

    22Flamey

    if i do that i got red line(problem)
    upload_2016-8-21_23-49-51.png
     
  6. Offline

    Zombie_Striker

    @22Flamey
    The placement of the greater than/ less than sign is important. It must be before the equal sign.

    Seriously, learn Java before working on bukkit. Knowing java will help with issues like this (both in preventing them from happening, and teaching you how you would solve these problems.) You can find tutorials at the following link. Pick one, learn Java, and then come back to bukkit.
    https://bukkit.org/threads/plugin-dev-sticky-learning-java-where-to-learn.395662/
     
  7. Offline

    22Flamey

    @AlvinB

    if i do that i got red line(problem)
    [​IMG]
     
  8. Offline

    Zombie_Striker

    @22Flamey @AlvinB
    He was wrong with the example. The equal sign must come after the greater than sign.
     
    DuaneTheDev_ likes this.
  9. Offline

    22Flamey

    @Zombie_Striker

    so how its suppost to be?
    Code:
    this? if(attacker.getExpToLevel() <= maxLevel);
    or this? if(attacker.getExpToLevel() >= maxLevel); 
    they both dosent work
     
    Last edited: Aug 21, 2016
  10. Offline

    Zombie_Striker

    @22Flamey
    if(attacker.getExpToLevel() >= maxLevel);
     
  11. Offline

    22Flamey

    @Zombie_Striker


    its still dosent work
    its keep send me the message every hit

    @Zombie_Striker i try and it keeping send me message every hit

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

    Zombie_Striker

    @22Flamey
    Is maxLevel equal to the XP needed to get to the next level, or equal to the level? The method "getExpToLevel" is the amount of XP needed in order to move to the next level. If you want to get the XP level a player has, use .getLevel()
     
  13. Offline

    22Flamey

    @Zombie_Striker

    its still dosent work ):
    its still send me message every hit

    xpe.JPG
     
  14. Offline

    sniddunc

    Remove the semi-colon after the last if statement shown in that image.
     
    Last edited: Aug 21, 2016
  15. Offline

    22Flamey

    @sniddunc

    its not possible
    when u do that its says there is a problem(red line)
     
  16. @22Flamey
    You should remove the semicolon, and wrap the statement below in curly brackets.
     
  17. Offline

    Lordloss

    You must be trolling...
    Please follow Zombies advice and learn the basics of java, and while youre at it also the english language. You cannot use bukkit without java.
     
    Zombie_Striker and ipodtouch0218 like this.
  18. Offline

    22Flamey

Thread Status:
Not open for further replies.

Share This Page