Events

In case you don't want to check every tick for a new Pattern sent from a client, there is an event that you can use called BUFFER_UPDATE. Here's an example:
PatternBufferEvents.BUFFER_UPDATE.register(buffer -> {
if (buffer.getItem(Item.getId(Items.APPLE)) != null) {
System.out.println("Hey Apple!");
}
});