restoring exp on respawn

Discussion in 'Plugin Development' started by RuthlessRage, Apr 21, 2015.

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

    RuthlessRage

    i'm having problems restoring a players exp after they respawn. i saved their exp to a hashmap and i know its setup right because i used debug messages and it tells me the correct amount of exp the player had before they died when they respawn. its just not actually setting the players level though -_-
     
    Last edited: Apr 23, 2015
  2. Offline

    pie_flavor

    @RuthlessRage Try setting it to 0 and then using giveExpLevels().
     
  3. Offline

    RuthlessRage

    @pie_flavor id doesn't work and I also tried making the player teleport to another location on respawn instead of giving them exp and it didn't work; whats wrong with this bukkit api?!
     
  4. Offline

    maxecito

    @RuthlessRage
    Did you register the Events in the class which implements JavaPlugin?
     
  5. Offline

    Konato_K

  6. Offline

    RuthlessRage

    @maxecito If i can see the test messages it should be obvious that it's registered

    @Konato_K where is that suppost to go under the player respawn event?
     
  7. Offline

    nverdier

  8. Offline

    Konato_K

  9. Offline

    RuthlessRage

    @Konato_K so where does this method go cause whererver I'm putting it i get errors

    and why doesn't p.setLevel(plugin.exp.get(uuid)); work because i have it in other methods and it does -__-
     
  10. Offline

    Konato_K

  11. Offline

    RuthlessRage

    @Konato_K ok ive im getting error cause the setkeeplevel isnt defined as variable
     
    Last edited: Apr 23, 2015
  12. Offline

    Konato_K

    @RuthlessRage A player will laways be an instance of a player

    Your syntax is really wrong...
     
  13. Offline

    RuthlessRage

    @Konato_K that's just some bull code cause tomany people steal my copyrighted code so i must make examples. And i still dont know where im suppost to add public void setKeepLevel(boolean keepLevel);
     
  14. Offline

    timtower Ninja on the waves Moderator

    @RuthlessRage Could you show your license then? Small pieces of code are very hard to put a copyright on, and setKeepLevel is a function in your example, you can't put a function in a function...
     
  15. Offline

    Konato_K

  16. Offline

    RuthlessRage

  17. Offline

    sgavster

    Do you have @EventHandler?...
     
  18. Offline

    Zombie_Striker

    The event gets fired before the player is re spawned (All events get fired before what its listening to gets processed).
    Add a delayed task of maybe 1.5 seconds.
     
    RuthlessRage likes this.
  19. Offline

    Konato_K

    @Zombie_Striker Why would you do that when you can modify the experience on death? There is a reason why a method exists there.
     
    sgavster likes this.
  20. Offline

    Msrules123

    @RuthlessRage

    You should really learn Java before attempting to use the Bukkit API (because Minecraft and Bukkit are coded in Java), it's really obvious that you don't know how to use the language. Then, when you learn some basic knowledge, what @Konato_K gave you will easily solve the problem that you are having.

    And if you insist on not learning it, then you'll forever be stuck. Almost all users will not spoon feed.
     
  21. Offline

    mythbusterma

    @RuthlessRage

    You're not going to get help here by being stingy with your code. Also, trust me, nobody is going to steal your code, nobody wants it. And your lack of software copyright understanding is laughable.

    Read what Konato posted, this thread was solved back at post #5, you put the code in a separate event handler. And following Msrules's advice wouldn't hurt.
     
  22. Offline

    RuthlessRage

  23. Offline

    Msrules123

    @RuthlessRage your code won't even work... As I said before, learn Java before using the Bukkit API
     
  24. Offline

    RuthlessRage

    @Msrules123 where do i put the code that konato showed me, im gonna put it in the death listener but where do i put it? under the event handler where? do i have to change any of the arguments? and i have a bach degree in computer science if you know anything about it, computer science isnt only based of java... Technology is evolving and everyone is moving towards python/c++/Ruby/C# and Php languages which you obviously know nothing about
     
    Last edited: Apr 25, 2015
  25. Offline

    teej107

    @RuthlessRage You can put the code anywhere. Code is very versatile.
     
  26. Offline

    RuthlessRage

    @teej107 i dont understand why people are replying if they arent helping with anything. Ive asked this 5 times already and im asing again, where exactly do i put konatos code?
     
  27. Offline

    Konato_K

    @RuthlessRage Because the question you're asking is basic understanding of the language, the javadoc I sent it's for the PlayerDeathEvent class, therefore the setKeepLevel method is a method from it, you need to call it in an instance of PlayerDeathEvent
     
  28. Offline

    RuthlessRage

    @Konato_K im getting this when i put it in death class

    void is an invalid type for the variable setKeepLevel

    @mythbusterma idk where your getting you information from. How are you going to tell me i don't have a degree, i have my associates and bach so get your facts right. If i know nothing about those languages then how do i know the name??? Those languages have nothing to do with java, all of you on here a clueless about programming. You think because someone doesnt understand something with bukkit api that they should learn java... the hell is wrong with you. You don't know what your talking about and its obvious you dont have a degree because your saying java is the base for all other languages, java is a language python is a language and so is ruby etc. They are separate languages because they all function in their own ways, if you had your degree you would know that java is pretty much outdated and python is taking its place due to the new technology. stop giving people false information "C" is another language what the hell are you talking about c-style, all the information you just goggled is outdated maybe if you went to school and studied you would know that python is the most used language.

    i stillneed help where od i put this

    EDIT by Timtower: merged posts
     
    Last edited: Apr 25, 2015
  29. Offline

    SuperOriginal

    I'm sorry to inform you that that is not an issue with the Bukki API
     
  30. Offline

    RuthlessRage

    @SuperOriginal who are you informing? who said that was an issue with the bukkit api??? stop replying if you dont know a fix. player.setlevel(25) should of worked but because of the bukkit api it doesnt.
     
Thread Status:
Not open for further replies.

Share This Page