Disable lvlup and set max xp

Discussion in 'Spigot Plugin Development' started by Nighterance, Apr 29, 2017.

  1. Hello guys, I want to make following 2 things. 1) disable automatic levelup. Whenever player reachest maximum ammount of xp, his xp bar is full but he does not get promoted to next level.

    2) for some players set max xp to get, for example if i can get 20/20xp i want my friend to be able to get 40/40 xp
     
  2. You can trigger those things with the "PlayerExpChangeEvent" event.
     

  3. But it only triggers if player xp changes not level. How would i be able to dit, maybe you are just smarter than me and I didnt see way how to do it.
     
  4. to check if the level has changed there's a "PlayerLevelChangeEvent" event :)
     
  5. Yep, found it out and it worked. But I didnt find option to extend the xp needed for levelup after canceling event. So Player gets lvl1, instantly he loses all xp and lvl goes back to 0, he gets 100$ and then he will gain again, but this time he has to get more xp
     
  6. You may have to store that data then after a level reset so you call that from a file or somewhere to check that again