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>
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.
It's PlayerInteract for players, and EntityInteract for entities. Your problem is your player listener method is not named correctly.
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