Why doesn't it work?

Discussion in 'Plugin Development' started by Mango, Nov 2, 2011.

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

    Mango

    I'm making a plugin to stop players and mobs from trampling crops. It compiles and enables fine, but I can still trample crops. My source files:
    InvincibleCrops.java - http://pastebin.com/7LbfyQVe
    InvincibleCropsPlayerListener.java - http://pastebin.com/jHgQNrDP
    InvincibleCropsEntityListener.java - http://pastebin.com/eMmiBk4u
    What did I do wrong? Sorry if I made an especially dumb mistake.

    Compiled Jar: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 12, 2016
  2. Offline

    Nitnelave

    I'm not sure you're listening for the right events... Look in the java docs for the event fired when crops drop due to trampling. It may be block physics, or block fade, or something like that. To test it, you should output something to the console when the event you're listening for fires.
     
  3. Offline

    Mango

    Maybe it's fade. I'll try it. Anyone else confirm?
     
  4. Offline

    Nitnelave

    Just had a look in the doc, fade seems the best candidate.
     
  5. Offline

    nisovin

    It's PlayerInteract for players, and EntityInteract for entities. Your problem is your player listener method is not named correctly.
     
  6. Offline

    Mango

    Wow what a noob mistake. I'll fix it up and try again.
     
  7. Offline

    Nitnelave

    In the future, to avoid that, make sure to add @Override before your method. If it isn't named properly, or if it doesn't have the right arguments, the compiler will say "This does not override anything, you dumb coder!" , and you'll know you made a mistake ;)
     
Thread Status:
Not open for further replies.

Share This Page