Paper Plugin Guide
File mode0

Java basics

Lambdas, method references and streams

Short inline functions you will see everywhere in commands, tasks and menus.

Beginner1 min read

This page is still being written.

What it will cover

  • Functional interfaces in plain words (Runnable, Consumer, Predicate, Function, Supplier)
  • Lambda syntax step by step from an anonymous class to x -> x
  • Method references (Player::getName, this::onClick)
  • Capturing variables (effectively final)
  • Streams: filter, map, toList, anyMatch, count, sorted, limit, forEach; when a plain loop is clearer
  • removeIf, forEach on collections, Map.computeIfAbsent
  • Paper preview: scheduler tasks, event.renderer, Brigadier executes(ctx -> ...) shown with notes
  • Runnable examples: filter online players by rank, top scores, name suggestions starting with typed text