edit xp given from bottle of enchanting?

Discussion in 'Plugin Development' started by tshay23, Dec 11, 2013.

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

    tshay23

    Im trying to develop a plugin but in order for it to work right for me i need to be able to edit the value of experience given from bottles of enchanting. If you know how to do this, please let me know! Thanks!
     
  2. Offline

    ninja_ace202

  3. Offline

    tshay23

  4. Offline

    ninja_ace202

    Read through this article: http://wiki.bukkit.org/Event_API_Reference

    It'll show you how to utilize Bukkit's Event system.

    Once you've read all that is on that page and have a grasp of how events in bukkit work you'll want to setup a listener to listen for the ExpBottleEvent. When the ExpBottleEvent is triggered you will then use the ExpBottleEvent's setExperience method to set the amount of experience the bottle should give.
     
  5. Offline

    justcool393

    Code:java
    1.  
    2. // Put this in your Event Handler class. See ninja_ace's post if you don't know how.
    3. public void onExpBottle(ExpBottleEvent e) {
    4. e.setExperience(amount);
    5. // If you want a condition, you should do if (condition) e.setExperience(amount);
    6. // For amount, replace that with your amount variable. Magic values
    7. // can make code hard to parse through. ;)
    8. }
    9.  
     
Thread Status:
Not open for further replies.

Share This Page