Solved Prevent event happening.

Discussion in 'Plugin Development' started by PreFixLT, Apr 30, 2013.

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


    Hello, I need some help, I want to prevent xp gaining event:

    public void onPlayerXpChange(PlayerExpChangeEvent e)
    TPlayer tPlayer = Terasology.getTPlayer(e.getPlayer());


    I want to do custom levels and so I worked with sourcepawn language there are "return Plugin_Handled;" but I think there aren't such things or maybe is?
  2. Offline


  3. Offline


    The method setCancelled(boolean) is undefined for the type PlayerExpChangeEvent
  4. Offline


    It's not an event event you can cancel. You will either have to do your XP calculations in the event set set the amount to your custom value. Or set the amount of XP they gain to 0 to stop the event having any effect.
    1. e.setAmount(0);// essentially cancels the event
    2. // Or
    3. int customValue = ...// Do a calculation
    4. e.setAmount(customValue);// Sets the custom value
  5. Offline


    Thanks for you, but I solved it, found some solutions in other threads :O
Thread Status:
Not open for further replies.

Share This Page