Before dispatching a mouse event to the RS client, the bot client checks if any registered BotMouseListener is blocking it.
To achieve what you want, create a new MouseListener class by implementing the BotMouseListener interface. This interface will implement the method
blockInput(Point point)
Which will let you specify whether a mouse event at the specified point should be dispatched to the RS client or not.
Much like consuming the event, except it will still trigger all the subsequent MouseListeners (Unless you consume all events as well)
So if you have a button at Rectangle x, you will simply need to return true at blockInput if the given Point is within that rectangle.