Problem with WeatherChangeEvent

Discussion in 'Plugin Development' started by Skyost, Aug 28, 2013.

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

    Skyost

    Hi,
    I am trying to cancel the WeatherChangeEvent but I have an error :
    Code:
    Cannot make a static reference to the non-static method setCancelled(boolean) from the type WeatherChangeEvent
    This is my code :
    Code:java
    1. @EventHandler
    2. public void onWeatherChange(WeatherChangeEvent e) {
    3. WeatherChangeEvent.setCancelled(true);
    4. }


    How can I do this ?
    Thanks ;)
     
  2. Skyost
    The error tells you exactly what the problem is.

    Answer to your question, use the variable you defined in the constructor, in your case, 'e'.
    Code:
    e.setCancelled(true);
     
  3. Offline

    Skyost

    Oh yes, I am so stupid xD
    Thanks !
     
Thread Status:
Not open for further replies.

Share This Page