Paper Plugin Guide
File mode0

Java basics

Inheritance, interfaces and annotations

extends, implements, @Override and why your plugin extends JavaPlugin.

Beginner1 min read

This page is still being written.

What it will cover

  • Inheritance with extends: Entity > LivingEntity > Zombie as a real-world hierarchy diagram from the Paper API
  • Overriding methods and @Override; calling super
  • Abstract classes
  • Interfaces: a promise of methods; implements; Listener is an interface with no methods (a marker)
  • Polymorphism: a variable of type Entity holding a Zombie; instanceof with pattern variables
  • Annotations: @Override, @EventHandler, @Deprecated, @Nullable/@NotNull; what they mean to the compiler and to Paper
  • Why your main class extends JavaPlugin and your listener implements Listener (diagram)
  • Runnable examples with a small mob hierarchy; a Paper example with notes