The MagmaBlock class does something similar to what you want your banana peel block to do, so you should look at that. Hint: onEntityWalk() function.
By the way, on this part of the forum you should only post questions related to the ForgeGradle system.