Event Player

Discussion in 'Plugin Development' started by 22vortex22, Nov 22, 2013.

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

    22vortex22

    Hey guys. I have been working on this for a bit but I'm having a problem with this...

    Code:java
    1. @EventHandler(priority = EventPriority.MONITOR)
    2. public void onFoodLevelChange(FoodLevelChangeEvent e){
    3. if (e.getPlayer().hasPermission("EasyPvpKits.NoHunger")){
    4. e.setFoodLevel(20);
    5. }
    6. }


    and its giving me errors...
    Ik the error is right infront of me but i have tunnel view right now xD
    Heres the full code if you want http://pastebin.com/zByVVSWU
     
  2. Offline

    mazentheamazin

    22vortex22
    Wrong topic. but what is the error?
     
  3. Offline

    22vortex22


    The method getPlayer() is undefined for the type FoodLevelChangeEvent
     
  4. Offline

    mazentheamazin

    22vortex22
    Because it is :p. Heres the fixed event
    Code:java
    1. @EventHandler
    2. public void onFoodLevelChange(FoodLevelChangeEvent event){
    3. if (event.getEntity().hasPermission("EasyPvpKits.NoHunger")){
    4. event.setFoodLevel(20);
    5. }
    6. }
     
Thread Status:
Not open for further replies.

Share This Page