Paper Plugin Guide
File mode0

Reference

API map: which class does what

The Paper API sorted into plain-English categories, with the classes you will use most.

BeginnerReference

The Paper API is huge, and nobody remembers all of it. This page sorts the 200 classes you will use most into 17 plain-English categories, so you can answer "which class does that?" in seconds and jump to the chapter that teaches it.

How to use this page

  1. Start from what you want to do

    Look through the "I want to..." table below. It points to a category and to the classes that usually do the job.

  2. Open the category

    Each category has a table with one row per class: what it is for, a handful of its most useful members, and the chapter that explains it step by step.

  3. Use the class name in your code

    Copy the class name, type it in IntelliJ, and press Alt+Enter to add the import line. Then press Ctrl+Q on any name to read its documentation.

  4. Still lost? Search the whole guide

    Press / or Ctrl+K on any page of this site and type a class name or an idea such as "boss bar".

How names in the API are built

Every class in Java lives in a package. A package is a folder path written with dots, and it keeps classes with the same name apart. The full name of a class is its package, a dot, and the class name. The tables below show the short name in bold and the full name underneath, because the full name is exactly what goes into your import line.

How to read a full class name The full name org.bukkit.entity.Player has two parts: the package org.bukkit.entity, which is like a folder, and the class name Player. The same text becomes your import line. org.bukkit.entity .Player The package a folder path that groups classes The class the name you type in code import org.bukkit.entity.Player;
A full class name is a package plus a class name, and it is also your import line

The first part of the package also tells you where a class comes from. That helps when you search online for help.

Where the names in the Paper API come from Four families of packages feed your plugin: org.bukkit for the classic game API, io.papermc.paper for Paper additions, net.kyori.adventure for text, and com.mojang.brigadier for commands. Your import lines pull from all of them. The classic game API org.bukkit.* Player, World, Block, Material, ItemStack, events, scheduler Paper additions io.papermc.paper.* Data components, registries, lifecycle, region schedulers Text library (Adventure) net.kyori.adventure.* Component, MiniMessage, Title, BossBar, Sound Command library (Brigadier) com.mojang.brigadier.* Literal and argument builders, command context Your plugin import ...;
Four families of packages feed the plugins you write
  • org.bukkit is the original game API. Paper is built on top of it, so older tutorials use it a lot. Player, World, Material and ItemStack live here.
  • io.papermc.paper (and the older com.destroystokyo.paper) holds what Paper added: data components, registries, lifecycle events and the region schedulers.
  • net.kyori.adventure is the text library built into Paper. Chat, titles, boss bars and item names all use it.
  • com.mojang.brigadier is Mojang's command library. Modern Paper commands are built with it.

In the member columns, a name that ends with () is a method: an action you can ask the thing to do. A name written in ALL_CAPITALS is a constant: a ready-made value stored in the class, like GameMode.CREATIVE. Some rows are an interface, which is a list of abilities that other classes promise to have, so the class you actually get may have a different name.

I want to...

I want to...Look inStart with
Send a colored chat messageText and colorsComponent, MiniMessage
Show a title, action bar or boss barText and colorsTitle, BossBar
Run code when something happensEventsPlayerJoinEvent, BlockBreakEvent
Stop something from happeningEventsCancellable, EventPriority
Make a command like /healCommandsBasicCommand, Commands
Teleport a player or change a blockWorld and blocksLocation, Block
Spawn a zombie or find mobs nearbyEntities and mobsWorld, EntityType, LivingEntity
Give an item a name or loreItemsItemStack, ItemMeta
Open a chest-style menuInventoriesInventory, InventoryClickEvent
Do something every second, or laterSchedulingBukkitScheduler, BukkitRunnable
Run slow work without causing lagSchedulingAsyncScheduler
Save a number on a player or an itemSaving dataPersistentDataContainer
Read settings from config.ymlSaving dataFileConfiguration
Check what a player may doPermissionsPermissible, PermissionDefault
Show a sidebar with scoresScoreboardsScoreboard, Objective
Play sounds, particles and potion effectsEffects, sounds and particlesParticle, PotionEffect
Add a crafting recipeRecipesShapedRecipe
Talk to another pluginServer and pluginPluginManager, ServicesManager
Look up a vanilla item, biome or enchantment by nameRegistries and keysRegistry, Key
Aim a ray and see what it hitsUtilitiesRayTraceResult, Vector

The categories

Each link jumps to one category. The number is how many classes it lists.

  • Server and plugin (12): The server object, your plugin's main class and the tools that start everything up.
  • Players and senders (7): Everything that is a person, or acts like one.
  • Text and colors (19): Adventure, the text library built into Paper. All chat, titles and names use it.
  • Commands (18): Creating commands and reading what players type.
  • Events (25): The things that happen in the game, and the pieces for listening to them.
  • World and blocks (16): Places, positions and blocks.
  • Entities and mobs (18): Everything that moves or stands in the world besides blocks.
  • Items (17): The things players hold, wear and craft with.
  • Inventories (9): Chests, player inventories and menus.
  • Scheduling (8): Running code later, repeatedly, or off the main thread.
  • Saving data (8): Config files, saved values and data stuck on items, entities and players.
  • Permissions (4): Who is allowed to do what.
  • Scoreboards (8): Sidebars, teams and score numbers.
  • Effects, sounds and particles (10): Things players see and hear.
  • Recipes (6): Custom crafting, smelting and more.
  • Registries and keys (7): The lists of everything Minecraft knows, and the keys that name them.
  • Utilities (8): Small helper types for math, rays and text matching.

Server and plugin

The server object, your plugin's main class and the tools that start everything up.

ClassWhat it is forHandy membersLearn more
Bukkit
org.bukkit
A static shortcut to the running server, for when you have no plugin object at hand.getServer() gets the Server object
getPlayer() finds an online player by name
getOnlinePlayers() lists everyone online
getWorld() finds a world by name
broadcast() sends a message to everyone
The main class and plugin lifecycle
Server
org.bukkit
The running server itself: its players, worlds, plugins and settings.getOnlinePlayers() everyone online right now
getPlayerExact() finds one online player by exact name
getWorld() finds a world by name
getPluginManager() gets the plugin manager
getScheduler() gets the scheduler
getConsoleSender() the console, as a command sender
The main class and plugin lifecycle
JavaPlugin
org.bukkit.plugin.java
The class your main class extends. Paper creates one object of it when your plugin loads.onEnable() runs when your plugin starts
onDisable() runs when your plugin stops
onLoad() runs before the worlds load
getLogger() writes to the console
saveDefaultConfig() copies config.yml out of the jar
getConfig() reads config.yml
getDataFolder() your plugin's folder in plugins/
The main class and plugin lifecycle
Plugin
org.bukkit.plugin
The interface JavaPlugin implements. Many methods ask for one when they need to know who is calling.getName() the plugin's name
isEnabled() true while it runs
getDataFolder() the folder for its files
getServer() the server it runs on
getPluginMeta() the details from plugin.yml
The main class and plugin lifecycle
PluginManager
org.bukkit.plugin
Registers listeners, fires events and looks up other plugins.registerEvents() starts a listener
callEvent() fires an event
getPlugin() finds a plugin by name
isPluginEnabled() checks that another plugin is running
getPlugins() lists all loaded plugins
Working with other plugins
PluginMeta
io.papermc.paper.plugin.configuration
Everything plugin.yml or paper-plugin.yml says about a plugin.getName() the plugin's name
getVersion() its version text
getAuthors() who wrote it
getDescription() its one-line description
getMainClass() the main class name
plugin.yml explained
ServicesManager
org.bukkit.plugin
A shared notice board where plugins offer services to each other.register() offers a service
load() gets the best provider of a service
getRegistration() gets a provider with its details
Working with other plugins
PluginBootstrap
io.papermc.paper.plugin.bootstrap
Code that runs before the server finishes loading, used by paper-plugin.yml plugins.bootstrap() runs very early with a BootstrapContext
createPlugin() lets you build your main class yourself
Paper plugins: paper-plugin.yml, bootstrapper and loader
BootstrapContext
io.papermc.paper.plugin.bootstrap
What a bootstrapper receives: the plugin's details and early access to the server.getPluginMeta() the plugin's details
getDataDirectory() the plugin's data folder as a Path
getLifecycleManager() registers early handlers
getLogger() a logger that works this early
Paper plugins: paper-plugin.yml, bootstrapper and loader
PluginLoader
io.papermc.paper.plugin.loader
Code that runs before your plugin class loads, to add libraries.classloader() adds libraries to the plugin's classpathPaper plugins: paper-plugin.yml, bootstrapper and loader
LifecycleEventManager
io.papermc.paper.plugin.lifecycle.event
Lets you hear about startup steps, such as the moment commands may be registered.registerEventHandler() runs your code at a lifecycle stepCommands, part 2: Brigadier command trees
ComponentLogger
net.kyori.adventure.text.logger.slf4j
A logger that prints Adventure text with colors to the console.info() logs a normal message
warn() logs a warning
error() logs an error
debug() logs a debug message
The main class and plugin lifecycle

Players and senders

Everything that is a person, or acts like one.

ClassWhat it is forHandy membersLearn more
Player
org.bukkit.entity
One online player. The class you will use more than any other.getName() the player's name
getUniqueId() the player's UUID, an id that never changes even if they rename
sendMessage() sends a chat message
teleport() moves the player
getInventory() the player's inventory
setGameMode() changes game mode
kick() removes them from the server
Working with players
OfflinePlayer
org.bukkit
A player who may or may not be online right now, found by name or UUID.getName() the last known name
getUniqueId() the permanent UUID
isOnline() true when they are connected
getPlayer() the online Player, or null
hasPlayedBefore() true if they joined at least once
getFirstPlayed() when they first joined
Working with players
HumanEntity
org.bukkit.entity
The shared parent of players and other human-shaped entities.getInventory() the inventory
getGameMode() the game mode
openInventory() shows an inventory
closeInventory() closes the open one
getItemOnCursor() the item on the mouse cursor
Inventories
CommandSender
org.bukkit.command
Anything that can run a command: a player, the console or a command block.sendMessage() sends text
sendRichMessage() sends MiniMessage text
getName() the sender's name
hasPermission() checks a permission
isOp() true for operators
Commands, part 1: simple commands
Audience
net.kyori.adventure.audience
Anything that can receive messages, titles and sounds. Players, the server and worlds are all audiences.sendMessage() sends chat text
sendActionBar() shows text above the hotbar
showTitle() shows a title
playSound() plays a sound
showBossBar() shows a boss bar
Titles, action bars, boss bars and sounds
GameMode
org.bukkit
The four game modes.SURVIVAL normal play
CREATIVE build with unlimited items
ADVENTURE cannot break blocks freely
SPECTATOR fly through everything
Working with players
Statistic
org.bukkit
Counters Minecraft keeps for each player, like blocks mined or time played.PLAY_ONE_MINUTE ticks played
DEATHS times died
MOB_KILLS mobs killed
JUMP times jumped
WALK_ONE_CM distance walked
Working with players

Text and colors

Adventure, the text library built into Paper. All chat, titles and names use it.

ClassWhat it is forHandy membersLearn more
Component
net.kyori.adventure.text
One piece of formatted text. Components never change: every edit gives you a new one.text() makes plain text
empty() text with nothing in it
newline() a line break
join() glues many components together
append() adds another component after this one
color() sets the color
decorate() turns on bold, italic and so on
Text and colors with Adventure
TextComponent
net.kyori.adventure.text
A component that holds literal text, the kind Component.text makes.content() the text inside
children() the components added after it
style() the formatting
color() the color
Text and colors with Adventure
TextColor
net.kyori.adventure.text.format
Any color, including exact hex colors.color() makes a color from numbers
fromHexString() reads "#ff8800"
asHexString() writes the color as hex
value() the color as one number
Text and colors with Adventure
NamedTextColor
net.kyori.adventure.text.format
The 16 classic Minecraft colors as ready-made constants.RED red
GREEN green
GOLD gold
AQUA aqua
GRAY gray
WHITE white
Text and colors with Adventure
Style
net.kyori.adventure.text.format
A bundle of color, decorations, click and hover that you can reuse on many components.style() builds a style
color() gets the color
decoration() checks one decoration
hoverEvent() gets the hover
clickEvent() gets the click
Text and colors with Adventure
TextDecoration
net.kyori.adventure.text.format
The text effects: bold, italic and friends.BOLD bold text
ITALIC italic text
UNDERLINED underlined text
STRIKETHROUGH struck-through text
OBFUSCATED scrambled "magic" text
Text and colors with Adventure
MiniMessage
net.kyori.adventure.text.minimessage
Turns text with tags like <green> into components, and back.miniMessage() gets the shared MiniMessage
deserialize() reads MiniMessage text into a component
serialize() writes a component as MiniMessage
escapeTags() makes tag characters safe
stripTags() removes all tags
MiniMessage: easy formatted text
Placeholder
net.kyori.adventure.text.minimessage.tag.resolver
Fills in a named hole like <name> inside MiniMessage text.component() inserts a component
unparsed() inserts plain text that is never read as tags
parsed() inserts text that is read as MiniMessage
styling() inserts a style
MiniMessage: easy formatted text
TagResolver
net.kyori.adventure.text.minimessage.tag.resolver
A set of tags MiniMessage understands. You pass resolvers when you deserialize.resolver() combines several placeholders
standard() all the built-in tags
empty() no tags at all
MiniMessage: easy formatted text
ClickEvent
net.kyori.adventure.text.event
What happens when a player clicks text in chat.runCommand() runs a command
suggestCommand() puts a command in the chat box
openUrl() opens a link
copyToClipboard() copies text
changePage() turns a book page
Text and colors with Adventure
HoverEvent
net.kyori.adventure.text.event
What a player sees when pointing at text.showText() shows a tooltip of text
showItem() shows an item tooltip
showEntity() shows an entity tooltip
Text and colors with Adventure
PlainTextComponentSerializer
net.kyori.adventure.text.serializer.plain
Turns a component into plain text with no colors.plainText() gets the shared serializer
serialize() component to plain String
deserialize() plain String to component
Text and colors with Adventure
LegacyComponentSerializer
net.kyori.adventure.text.serializer.legacy
Converts old-style color codes like &a and section signs.legacyAmpersand() reads and writes & codes
legacySection() reads and writes the section sign
deserialize() String to component
serialize() component to String
Text and colors with Adventure
GsonComponentSerializer
net.kyori.adventure.text.serializer.gson
Converts components to and from the JSON Minecraft uses internally.gson() gets the shared serializer
serialize() component to JSON
deserialize() JSON to component
Text and colors with Adventure
JoinConfiguration
net.kyori.adventure.text
Settings for Component.join: what goes between the pieces.separator() puts one component between the pieces
commas() separates with commas
newlines() puts each piece on its own line
builder() builds a custom setup
Text and colors with Adventure
Title
net.kyori.adventure.title
A title and subtitle shown in the middle of the screen.title() makes a title from two components
times() makes the fade and stay timings
subtitle() gets the second line
Titles, action bars, boss bars and sounds
BossBar
net.kyori.adventure.bossbar
The bar at the top of the screen.bossBar() makes a bar
name() sets the text
progress() sets how full it is from 0 to 1
color() sets the color
addViewer() shows it to a player
Titles, action bars, boss bars and sounds
Sound
net.kyori.adventure.sound
A sound described with a key, a source, a volume and a pitch.sound() makes a sound
name() the sound's key
volume() how loud
pitch() how high
source() which volume slider controls it
Titles, action bars, boss bars and sounds
ChatRenderer
io.papermc.paper.chat
Decides how one chat message looks to each viewer.render() builds the final chat line
viewerUnaware() a simple renderer that ignores the viewer
Project: Chat formatter and filter

Commands

Creating commands and reading what players type.

ClassWhat it is forHandy membersLearn more
Commands
io.papermc.paper.command.brigadier
The tools for building and registering Brigadier commands.literal() starts a command word
argument() adds a typed argument
register() adds your command to the server
Commands, part 2: Brigadier command trees
CommandSourceStack
io.papermc.paper.command.brigadier
Who ran a Brigadier command and where.getSender() the sender that ran it
getLocation() where it was run
getExecutor() who it was run as
Commands, part 2: Brigadier command trees
BasicCommand
io.papermc.paper.command.brigadier
The simplest modern command: one class with an execute method.execute() runs the command
suggest() gives tab completions
canUse() decides who may use it
permission() the permission needed
Commands, part 1: simple commands
ArgumentTypes
io.papermc.paper.command.brigadier.argument
Paper's ready-made argument types for Brigadier.player() one online player
players() several players
world() a world
finePosition() exact coordinates
component() formatted text
Commands, part 2: Brigadier command trees
PlayerSelectorArgumentResolver
io.papermc.paper.command.brigadier.argument.resolvers.selector
The object a players argument gives you. You resolve it to get the actual players.resolve() turns the selector into a list of playersCommands, part 2: Brigadier command trees
LifecycleEvents
io.papermc.paper.plugin.lifecycle.event.types
The list of startup moments you can hook into.COMMANDS the moment to register commands
TAGS the moment to change block and item tags
Commands, part 2: Brigadier command trees
ReloadableRegistrarEvent
io.papermc.paper.plugin.lifecycle.event.registrar
The event you receive at the COMMANDS step. It hands you the registrar.registrar() the object you register commands withCommands, part 2: Brigadier command trees
LiteralArgumentBuilder
com.mojang.brigadier.builder
Builds a fixed command word such as heal.literal() starts a new word
then() adds a child word or argument
executes() sets the code to run
requires() sets who may use it
Commands, part 2: Brigadier command trees
RequiredArgumentBuilder
com.mojang.brigadier.builder
Builds an argument a player must type, such as a number or a name.argument() starts a new argument
suggests() adds tab completions
then() adds a child
executes() sets the code to run
Commands, part 2: Brigadier command trees
CommandContext
com.mojang.brigadier.context
What your command code receives: the sender and the typed arguments.getSource() who ran the command
getArgument() reads an argument by name
Commands, part 2: Brigadier command trees
Command
com.mojang.brigadier
The interface your executes code fulfills, plus the usual return value.SINGLE_SUCCESS the number 1, meaning it worked
run() the method that runs your code
Commands, part 2: Brigadier command trees
StringArgumentType
com.mojang.brigadier.arguments
Argument types for words and text.word() one word
string() a word or quoted text
greedyString() all the rest of the line
getString() reads the value
Commands, part 2: Brigadier command trees
IntegerArgumentType
com.mojang.brigadier.arguments
Argument type for whole numbers, with optional limits.integer() a whole number, optionally with a minimum and maximum
getInteger() reads the value
Commands, part 2: Brigadier command trees
SuggestionsBuilder
com.mojang.brigadier.suggestion
Collects tab-completion suggestions.suggest() adds one suggestion
getRemaining() the text typed so far
build() finishes the list
Commands, part 2: Brigadier command trees
CommandExecutor
org.bukkit.command
The classic interface for commands listed in plugin.yml.onCommand() runs when someone uses the commandCommands, part 3: the classic plugin.yml way
TabCompleter
org.bukkit.command
The classic interface for tab completion.onTabComplete() returns the suggestionsCommands, part 3: the classic plugin.yml way
PluginCommand
org.bukkit.command
A command declared in plugin.yml, as an object.setExecutor() attaches your code
setTabCompleter() attaches completions
setPermission() sets the permission
getName() the command's name
Commands, part 3: the classic plugin.yml way
ConsoleCommandSender
org.bukkit.command
The server console as a command sender.sendMessage() prints a message
getName() returns CONSOLE
hasPermission() true for every permission
Commands, part 1: simple commands

Events

The things that happen in the game, and the pieces for listening to them.

ClassWhat it is forHandy membersLearn more
Event
org.bukkit.event
The parent of every event.getEventName() the event's class name
isAsynchronous() true if it is fired off the main thread
callEvent() fires the event to all listeners
Events and listeners
Listener
org.bukkit.event
A label that marks a class as holding event handlers. It has no methods.no methods, just implement itEvents and listeners
EventHandler
org.bukkit.event
The annotation you put on a handler method.priority() when to run compared to other plugins
ignoreCancelled() skip events another plugin already canceled
Events and listeners
EventPriority
org.bukkit.event
The order handlers run in.LOWEST first
LOW early
NORMAL the default
HIGH late
HIGHEST last to change things
MONITOR last of all, only to watch
Event priorities and canceling
Cancellable
org.bukkit.event
Marks events you can cancel to stop the action.isCancelled() true if someone already stopped it
setCancelled() stops it or lets it happen
Event priorities and canceling
HandlerList
org.bukkit.event
The list of handlers an event keeps. Needed when you write your own event.unregisterAll() removes every handler a plugin or listener added
getRegisteredListeners() lists the registered handlers
getHandlerLists() all the lists of all events
Making your own events
PlayerJoinEvent
org.bukkit.event.player
A player has just joined.getPlayer() who joined
joinMessage() the message everyone sees, or null to hide it
Events and listeners
PlayerQuitEvent
org.bukkit.event.player
A player is leaving.getPlayer() who left
quitMessage() the message everyone sees
getReason() why they left
Events and listeners
PlayerInteractEvent
org.bukkit.event.player
A player clicked the air or a block.getPlayer() who clicked
getAction() which kind of click
getClickedBlock() the block they clicked
getItem() the item in their hand
getHand() which hand
Events and listeners
PlayerInteractEntityEvent
org.bukkit.event.player
A player right-clicked an entity.getPlayer() who clicked
getRightClicked() the entity they clicked
getHand() which hand
Entities and mobs
PlayerMoveEvent
org.bukkit.event.player
A player moved or turned. It fires very often, so keep the code short.getPlayer() who moved
getFrom() where they were
getTo() where they are going
hasChangedBlock() true if they entered a new block
Events and listeners
PlayerRespawnEvent
org.bukkit.event.player
A player is about to respawn.getPlayer() who died
getRespawnLocation() where they will appear
setRespawnLocation() chooses a different spot
Events and listeners
PlayerDropItemEvent
org.bukkit.event.player
A player threw an item out.getPlayer() who dropped it
getItemDrop() the dropped item entity
Events and listeners
PlayerItemConsumeEvent
org.bukkit.event.player
A player is about to eat or drink something.getPlayer() who is eating
getItem() the food or potion
setItem() changes what they consume
Events and listeners
AsyncChatEvent
io.papermc.paper.event.player
A player sent a chat message. It fires off the main thread.getPlayer() who chatted
message() the message as a component
renderer() how the line is shown
viewers() who will see it
Project: Chat formatter and filter
BlockBreakEvent
org.bukkit.event.block
A player is breaking a block.getPlayer() who breaks it
getBlock() which block
setDropItems() turns the drops off or on
setExpToDrop() sets the experience dropped
Events and listeners
BlockPlaceEvent
org.bukkit.event.block
A player placed a block.getPlayer() who placed it
getBlock() the new block
getBlockPlaced() the same new block
getItemInHand() the item used
Events and listeners
EntityDamageEvent
org.bukkit.event.entity
Something is about to take damage.getEntity() who is hurt
getDamage() how much damage
setDamage() changes the damage
getCause() what caused it
Events and listeners
EntityDamageByEntityEvent
org.bukkit.event.entity
Damage that one entity caused to another.getDamager() who hit
getEntity() who was hit
getDamage() how much damage
Events and listeners
EntityDeathEvent
org.bukkit.event.entity
A living thing died.getEntity() what died
getDrops() the items it drops
setDroppedExp() sets the experience dropped
Events and listeners
PlayerDeathEvent
org.bukkit.event.entity
A player died.deathMessage() the death message
getDrops() the items dropped
setKeepInventory() keeps the items
getEntity() the player who died
Events and listeners
EntityExplodeEvent
org.bukkit.event.entity
An entity such as a creeper is exploding.blockList() the blocks that will break
getEntity() what exploded
setYield() sets what fraction of the blocks drop items
Events and listeners
InventoryClickEvent
org.bukkit.event.inventory
A player clicked a slot in an open inventory.getWhoClicked() the player
getSlot() which slot
getCurrentItem() the clicked item
getClick() the kind of click
getClickedInventory() which inventory was clicked
Building GUI menus
InventoryCloseEvent
org.bukkit.event.inventory
A player closed an inventory.getPlayer() who closed it
getInventory() which inventory
Building GUI menus
PaperServerListPingEvent
com.destroystokyo.paper.event.server
The server list asked for your server's status.motd() the message of the day
setMaxPlayers() the shown player limit
getNumPlayers() the shown player count
Events and listeners

World and blocks

Places, positions and blocks.

ClassWhat it is forHandy membersLearn more
World
org.bukkit
One world, like the overworld or the nether.getName() the world's name
getBlockAt() gets the block at a position
getSpawnLocation() the spawn point
getTime() the time of day
spawnEntity() creates a mob or entity
getPlayers() players in this world
strikeLightning() hits a spot with lightning
Worlds, locations and movement
Location
org.bukkit
A point in a world: x, y, z and the direction you face.getWorld() the world
getX() the x coordinate
getBlock() the block here
add() moves the point
distance() distance to another location
clone() makes a copy
Worlds, locations and movement
Chunk
org.bukkit
A 16 by 16 column of the world that the server loads in one piece.getX() chunk x number
getZ() chunk z number
isLoaded() true if it is loaded
getWorld() the world it is in
Worlds, locations and movement
Block
org.bukkit.block
One block in the world.getType() the material
setType() changes the material
getLocation() where it is
getRelative() the neighbor in some direction
getState() a snapshot with extra details
getBlockData() its current settings
Blocks and block data
BlockState
org.bukkit.block
A snapshot of a block, including things like chest contents.update() writes your changes back to the world
getBlock() the block it came from
getType() the material at that moment
Blocks and block data
BlockFace
org.bukkit.block
A direction: north, up, down and so on.NORTH toward negative z
EAST toward positive x
UP above
DOWN below
getOppositeFace() the other way
Blocks and block data
BlockData
org.bukkit.block.data
The settings of a block, such as which way a door faces.getMaterial() the block type
clone() makes a copy
matches() compares two settings
getAsString() writes it as text
Blocks and block data
Directional
org.bukkit.block.data
Block data for blocks that face a direction, like furnaces and stairs.getFacing() the direction
setFacing() turns the block
getFaces() the directions allowed
Blocks and block data
Ageable
org.bukkit.block.data
Block data for crops that grow in stages.getAge() the growth stage
setAge() sets the stage
getMaximumAge() the last stage
Blocks and block data
Container
org.bukkit.block
A block that holds items, like a chest or barrel.getInventory() the contents
getSnapshotInventory() a copy you can edit before update
Blocks and block data
Sign
org.bukkit.block
A sign block, with text you can read and change.getSide() gets the front or back side
setWaxed() locks the sign
isWaxed() true if it is locked
Blocks and block data
BlockType
org.bukkit.block
The type of a block as an object, the block twin of ItemType.getKey() its key
createBlockData() makes default block data
hasItemType() true if it can be an item
Registries, keys and data components
Biome
org.bukkit.block
The climate and look of a spot in the world, like plains or desert.PLAINS the plains biome
DESERT the desert biome
FOREST the forest biome
getKey() the biome's key
Worlds, locations and movement
WorldBorder
org.bukkit
The edge of a world.setSize() sets the width
setCenter() sets the middle
getSize() the current width
isInside() true if a location is inside
Worlds, locations and movement
WorldCreator
org.bukkit
Recipe for creating a new world.name() starts a creator for that name
createWorld() makes the world
environment() nether, end or normal
seed() sets the seed
Worlds, locations and movement
Position
io.papermc.paper.math
A plain position that is not tied to a world.block() makes a block position
fine() makes an exact position
x() the x coordinate
Worlds, locations and movement

Entities and mobs

Everything that moves or stands in the world besides blocks.

ClassWhat it is forHandy membersLearn more
Entity
org.bukkit.entity
The parent of everything alive or movable: players, mobs, dropped items and arrows.getLocation() where it is
teleport() moves it
remove() deletes it from the world
getType() what kind of entity it is
getUniqueId() its permanent id
customName() gets or sets the name tag
getScheduler() its own region scheduler
Entities and mobs
LivingEntity
org.bukkit.entity
Entities that have health, like mobs and players.getEquipment() what it wears and holds
addPotionEffect() gives it a potion effect
getAttribute() reads a stat like max health
getEyeLocation() where its eyes are
damage() hurts it
Entities and mobs
Damageable
org.bukkit.entity
Anything that has health points.getHealth() current health
setHealth() sets health
damage() hurts it
heal() restores health
Entities and mobs
Mob
org.bukkit.entity
A living thing with artificial intelligence, such as a zombie.getTarget() who it is chasing
setTarget() picks a target
getPathfinder() moves it with Paper's pathfinding
setAware() turns its AI behavior on or off
Entities and mobs
Ageable
org.bukkit.entity
Animals and villagers that have a baby stage.isAdult() true when grown up
setBaby() turns it into a baby
setAdult() grows it up
getAge() age counter
Entities and mobs
EntityType
org.bukkit.entity
The list of entity kinds.ZOMBIE a zombie
CREEPER a creeper
VILLAGER a villager
ARMOR_STAND an armor stand
PLAYER a player
Entities and mobs
Villager
org.bukkit.entity
A villager, with a profession and trades.getProfession() its job
setProfession() changes its job
getRecipes() its trades
setRecipes() replaces its trades
Entities and mobs
ArmorStand
org.bukkit.entity
The stand used for holograms and decorations.setGravity() turns gravity on or off
setVisible() shows or hides the stand
setSmall() makes it small
setArms() gives it arms
Entities and mobs
Item
org.bukkit.entity
A dropped item lying in the world.getItemStack() the item it holds
setItemStack() changes the item
setPickupDelay() how long before pickup
Items and ItemStacks
Projectile
org.bukkit.entity
Something thrown or shot, like arrows and snowballs.getShooter() who launched it
setShooter() changes the shooter
Entities and mobs
Arrow
org.bukkit.entity
An arrow in flight.setDamage() changes how hard it hits
getDamage() how hard it hits
setCritical() makes it a critical hit
Entities and mobs
Display
org.bukkit.entity
Parent of display entities, which show things without a hitbox.setBillboard() makes it turn to face the player
setTransformation() moves, rotates and scales it
setBrightness() sets its light level
Entities and mobs
TextDisplay
org.bukkit.entity
Floating text in the world, great for holograms.text() sets the text with a component
setBackgroundColor() colors the background
setAlignment() aligns the lines
Entities and mobs
ItemDisplay
org.bukkit.entity
A floating item model in the world.setItemStack() chooses the item
setItemDisplayTransform() chooses how the item is posed
Entities and mobs
Attribute
org.bukkit.attribute
The stats of a living thing.MAX_HEALTH how much health it can have
MOVEMENT_SPEED how fast it walks
ATTACK_DAMAGE how hard it hits
ARMOR how much armor
Entities and mobs
AttributeInstance
org.bukkit.attribute
One stat on one entity, with all its modifiers.getBaseValue() the plain value
setBaseValue() changes the plain value
getValue() the final value with modifiers
addModifier() adds a bonus or penalty
Entities and mobs
AttributeModifier
org.bukkit.attribute
A bonus or penalty added to a stat.getAmount() how much it changes the stat
getOperation() how it is applied
getKey() its unique key
Items and ItemStacks
Pathfinder
com.destroystokyo.paper.entity
Paper's tool for walking a mob to a spot.moveTo() starts walking to a location
stopPathfinding() stops walking
hasPath() true while it has a route
Entities and mobs

Items

The things players hold, wear and craft with.

ClassWhat it is forHandy membersLearn more
ItemStack
org.bukkit.inventory
A stack of items: a type, an amount and its extra data.of() makes a stack
getType() the material
getAmount() how many
setAmount() changes how many
editMeta() changes name, lore and more
setData() sets a data component
Items and ItemStacks
Material
org.bukkit
The old list of every block and item kind. Still used in most code.DIAMOND the diamond item
STONE the stone block
isBlock() true if it can be placed
isItem() true if it can be held
getMaxStackSize() biggest stack size
Items and ItemStacks
ItemType
org.bukkit.inventory
The newer object form of an item kind.getKey() its key
createItemStack() makes a stack
getMaxStackSize() biggest stack size
hasBlockType() true if it can be placed
Registries, keys and data components
ItemMeta
org.bukkit.inventory.meta
Extra data on an item: name, lore, enchants, flags.displayName() sets the name with a component
lore() sets the lore lines, the gray text under an item's name
addEnchant() adds an enchantment
addItemFlags() hides parts of the tooltip
getPersistentDataContainer() your own saved data
Items and ItemStacks
Damageable
org.bukkit.inventory.meta
Item meta for tools that wear out.getDamage() how worn it is
setDamage() changes the wear
hasDamage() true if it has any wear
Items and ItemStacks
SkullMeta
org.bukkit.inventory.meta
Item meta for player heads.setOwningPlayer() picks whose head it is
getOwningPlayer() reads whose head it is
setPlayerProfile() sets a custom profile
Items and ItemStacks
PotionMeta
org.bukkit.inventory.meta
Item meta for potions.setBasePotionType() picks the potion type
addCustomEffect() adds an extra effect
setColor() sets the liquid color
Items and ItemStacks
LeatherArmorMeta
org.bukkit.inventory.meta
Item meta for leather armor, to dye it.setColor() dyes the armor
getColor() reads the dye color
Items and ItemStacks
Enchantment
org.bukkit.enchantments
An enchantment, like Sharpness.SHARPNESS more melee damage
PROTECTION less damage taken
EFFICIENCY faster mining
getKey() its key
Items and ItemStacks
ItemFlag
org.bukkit.inventory
Switches that hide parts of an item's tooltip.HIDE_ENCHANTS hides the enchantment list
HIDE_ATTRIBUTES hides attribute lines
HIDE_UNBREAKABLE hides the unbreakable line
Items and ItemStacks
EquipmentSlot
org.bukkit.inventory
The places an entity holds or wears items.HAND the main hand
OFF_HAND the off hand
HEAD the helmet slot
CHEST the chestplate slot
FEET the boots slot
Items and ItemStacks
EquipmentSlotGroup
org.bukkit.inventory
A group of slots, used for attribute modifiers on items.MAINHAND the main hand
ANY any slot
ARMOR any armor slot
Items and ItemStacks
ItemRarity
org.bukkit.inventory
How rare an item is, which sets its name color.COMMON white names
UNCOMMON yellow names
RARE aqua names
EPIC light purple names
Items and ItemStacks
DataComponentTypes
io.papermc.paper.datacomponent
The list of data components an item can have, like its name or durability.CUSTOM_NAME a custom name
LORE the lore lines
MAX_STACK_SIZE the stack limit
ITEM_MODEL which model it uses
CUSTOM_MODEL_DATA a model selector
Registries, keys and data components
ItemLore
io.papermc.paper.datacomponent.item
The lore component's value.lore() makes lore from a list of components
lines() reads the lines
styledLines() reads the lines with default styling
Registries, keys and data components
ItemEnchantments
io.papermc.paper.datacomponent.item
The enchantments component's value.itemEnchantments() makes the value from a map of enchantments
enchantments() reads the enchantments
Registries, keys and data components
CustomModelData
io.papermc.paper.datacomponent.item
The component that picks a custom model for resource packs.customModelData() starts a builder for the value
floats() numbers a pack can read
strings() text a pack can read
Registries, keys and data components

Inventories

Chests, player inventories and menus.

ClassWhat it is forHandy membersLearn more
Inventory
org.bukkit.inventory
A grid of item slots.getItem() reads a slot
setItem() puts an item in a slot
addItem() adds an item to the first free space
contains() checks for an item
clear() empties it
getSize() how many slots
Inventories
PlayerInventory
org.bukkit.inventory
A player's inventory with hotbar and armor.getItemInMainHand() the held item
setItemInMainHand() replaces the held item
getHelmet() the worn helmet
getArmorContents() all armor pieces
getHeldItemSlot() the chosen hotbar slot
Inventories
InventoryHolder
org.bukkit.inventory
The owner of an inventory. Menu code often implements it.getInventory() returns the inventory this holder ownsBuilding GUI menus
InventoryView
org.bukkit.inventory
What a player currently sees: top and bottom inventory together.getTitle() the window title
getTopInventory() the upper inventory
getBottomInventory() the player's inventory
getPlayer() who is looking
Building GUI menus
InventoryType
org.bukkit.event.inventory
The kinds of inventory, like chest or furnace.CHEST a chest
HOPPER a hopper
FURNACE a furnace
ANVIL an anvil
PLAYER a player inventory
Inventories
ClickType
org.bukkit.event.inventory
The kind of click: left, right, shift and more.LEFT left click
RIGHT right click
SHIFT_LEFT left click with shift
DROP pressing the drop key
isLeftClick() true for any left click
Building GUI menus
InventoryAction
org.bukkit.event.inventory
What a click will do to the items.PICKUP_ALL picks up the stack
PLACE_ALL places the stack
MOVE_TO_OTHER_INVENTORY moves the stack across
NOTHING does nothing
Building GUI menus
MenuType
org.bukkit.inventory
The kinds of menu window, with a builder for custom ones.GENERIC_9X3 a 3 row chest menu
ANVIL an anvil menu
create() makes a menu window for a player
typed() gives a builder for more setup
Building GUI menus
MerchantRecipe
org.bukkit.inventory
One trade in a villager or custom merchant window.getResult() what the trade gives
getIngredients() what the trade costs
setMaxUses() how often it can be used
Building GUI menus

Scheduling

Running code later, repeatedly, or off the main thread.

ClassWhat it is forHandy membersLearn more
BukkitScheduler
org.bukkit.scheduler
The classic scheduler.runTask() runs once on the next tick
runTaskLater() runs once after a delay
runTaskTimer() repeats
runTaskAsynchronously() runs off the main thread
cancelTasks() stops all tasks of a plugin
Timing and tasks: the scheduler
BukkitTask
org.bukkit.scheduler
A handle to a task you scheduled.cancel() stops the task
isCancelled() true if stopped
getTaskId() its number
getOwner() the plugin that owns it
Timing and tasks: the scheduler
BukkitRunnable
org.bukkit.scheduler
A task class you extend and start yourself.run() the code to run
runTaskTimer() starts it repeating
runTaskLater() starts it after a delay
cancel() stops it
Timing and tasks: the scheduler
ScheduledTask
io.papermc.paper.threadedregions.scheduler
A handle to a task made by Paper's region schedulers.cancel() stops the task
isCancelled() true if stopped
getOwningPlugin() who scheduled it
isRepeatingTask() true if it repeats
Folia and regionized scheduling
GlobalRegionScheduler
io.papermc.paper.threadedregions.scheduler
Runs tasks that are not tied to a place.run() runs once soon
runDelayed() runs once after a delay
runAtFixedRate() repeats
cancelTasks() stops a plugin's tasks
Folia and regionized scheduling
RegionScheduler
io.papermc.paper.threadedregions.scheduler
Runs tasks at a place in the world.run() runs once at a location
runDelayed() runs after a delay
runAtFixedRate() repeats
Folia and regionized scheduling
EntityScheduler
io.papermc.paper.threadedregions.scheduler
Runs tasks that follow one entity.run() runs once for this entity
runDelayed() runs after a delay
runAtFixedRate() repeats
execute() runs a plain Runnable
Folia and regionized scheduling
AsyncScheduler
io.papermc.paper.threadedregions.scheduler
Runs slow work off the main thread.runNow() runs right away in the background
runDelayed() runs later in the background
runAtFixedRate() repeats in the background
Threads, performance and lag

Saving data

Config files, saved values and data stuck on items, entities and players.

ClassWhat it is forHandy membersLearn more
PersistentDataContainer
org.bukkit.persistence
Sticky notes you attach to entities, items and blocks. They are saved with the world.set() writes a value
get() reads a value or null
has() checks a key
remove() deletes a key
getKeys() lists all keys
Saving data on things: PersistentDataContainer
PersistentDataType
org.bukkit.persistence
Says which kind of value a sticky note holds.STRING text
INTEGER a whole number
DOUBLE a decimal number
BOOLEAN true or false
LONG a big whole number
Saving data on things: PersistentDataContainer
PersistentDataHolder
org.bukkit.persistence
Anything that can carry a container.getPersistentDataContainer() gets the containerSaving data on things: PersistentDataContainer
NamespacedKey
org.bukkit
A name like myplugin:coins that identifies your data.fromString() reads text like myplugin:coins
minecraft() builds a vanilla key
getKey() the name part
getNamespace() the plugin part
Saving data on things: PersistentDataContainer
FileConfiguration
org.bukkit.configuration.file
A config file loaded in memory.getString() reads text
getInt() reads a whole number
getBoolean() reads true or false
set() changes a value
save() writes the file
Configuration files
YamlConfiguration
org.bukkit.configuration.file
A FileConfiguration that reads and writes YAML files.loadConfiguration() reads a YAML file
save() writes the file
getKeys() lists keys
Configuration files
ConfigurationSection
org.bukkit.configuration
A group of values in a config, like one section of config.yml.getConfigurationSection() gets a sub-section
getKeys() lists the keys
getStringList() reads a list of text
contains() checks a path
Configuration files
ConfigurationSerializable
org.bukkit.configuration.serialization
Lets your own class be saved to and loaded from YAML.serialize() turns the object into a mapSaving player data: files and databases

Permissions

Who is allowed to do what.

ClassWhat it is forHandy membersLearn more
Permission
org.bukkit.permissions
A permission you declare in code, with a default.getName() the permission text
getDefault() who gets it by default
getDescription() what it allows
Permissions
PermissionDefault
org.bukkit.permissions
Who has a permission when nobody set it.TRUE everyone
FALSE nobody
OP operators only
NOT_OP everyone except operators
Permissions
Permissible
org.bukkit.permissions
Anything that can have permissions, like players and the console.hasPermission() checks one permission
isPermissionSet() true if it was set at all
addAttachment() gives a temporary permission
Permissions
PermissionAttachment
org.bukkit.permissions
A temporary set of permissions you give to a player.setPermission() turns a permission on or off
unsetPermission() removes a setting
remove() removes the whole attachment
Permissions

Scoreboards

Sidebars, teams and score numbers.

ClassWhat it is forHandy membersLearn more
Scoreboard
org.bukkit.scoreboard
A whole scoreboard: its objectives and teams.registerNewObjective() creates an objective
registerNewTeam() creates a team
getObjective() finds an objective
getTeam() finds a team
Scoreboards, sidebars and teams
Objective
org.bukkit.scoreboard
A list of scores with a name, which can show as the sidebar.getScore() gets the score line for a name
setDisplaySlot() chooses where it shows
displayName() sets the title
numberFormat() changes how numbers look
Scoreboards, sidebars and teams
Team
org.bukkit.scoreboard
A group of entries that share color, prefix and rules.addEntry() adds a player or name
prefix() sets the text before names
color() sets the name color
setAllowFriendlyFire() turns friendly fire on or off
Scoreboards, sidebars and teams
Score
org.bukkit.scoreboard
One line's number on an objective.setScore() sets the number
getScore() reads the number
customName() shows other text instead of the name
Scoreboards, sidebars and teams
ScoreboardManager
org.bukkit.scoreboard
Makes new scoreboards.getNewScoreboard() creates a fresh scoreboard
getMainScoreboard() the shared one
Scoreboards, sidebars and teams
DisplaySlot
org.bukkit.scoreboard
Where an objective shows.SIDEBAR the right side of the screen
BELOW_NAME under player names
PLAYER_LIST in the tab list
Scoreboards, sidebars and teams
Criteria
org.bukkit.scoreboard
How an objective's score changes by itself.DUMMY changes only when you set it
HEALTH follows the player's health
getName() its name
Scoreboards, sidebars and teams
NumberFormat
io.papermc.paper.scoreboard.numbers
Changes how score numbers look in a sidebar.blank() shows no number
fixed() shows fixed text
styled() shows the number with a style
Scoreboards, sidebars and teams

Effects, sounds and particles

Things players see and hear.

ClassWhat it is forHandy membersLearn more
Particle
org.bukkit
The particles you can spawn.FLAME a flame
HEART a heart
CLOUD a puff of cloud
CRIT a critical hit spark
DUST colored dust
Potion effects, particles and effects
Sound
org.bukkit
The sounds you can play.ENTITY_EXPERIENCE_ORB_PICKUP the orb ping
ENTITY_PLAYER_LEVELUP the level-up chime
BLOCK_NOTE_BLOCK_PLING a note block pling
Potion effects, particles and effects
SoundCategory
org.bukkit
Which volume slider controls a sound.MASTER overall volume
MUSIC music slider
AMBIENT ambient slider
PLAYERS player sounds
Potion effects, particles and effects
PotionEffect
org.bukkit.potion
One effect with a type, a time, a level and some flags.getType() the effect type
getDuration() how long it lasts in ticks
getAmplifier() the level minus one
withDuration() a copy with a new duration
Potion effects, particles and effects
PotionEffectType
org.bukkit.potion
The list of effect kinds.SPEED speed
NIGHT_VISION night vision
REGENERATION regeneration
SLOWNESS slowness
getKey() its key
Potion effects, particles and effects
PotionType
org.bukkit.potion
The kinds of potion bottle.WATER plain water
SWIFTNESS the speed potion
HEALING the healing potion
getKey() its key
Items and ItemStacks
Effect
org.bukkit
Old-style world effects such as smoke and disc playing.SMOKE smoke
RECORD_PLAY plays a disc
getType() the effect's kind
Potion effects, particles and effects
FireworkEffect
org.bukkit
The look of one firework burst.builder() starts building an effect
getColors() the main colors
hasTrail() true if it leaves a trail
hasFlicker() true if it twinkles
Potion effects, particles and effects
Firework
org.bukkit.entity
A firework rocket entity.getFireworkMeta() reads its effects
setFireworkMeta() changes its effects
detonate() makes it burst right now
Potion effects, particles and effects
Color
org.bukkit
An RGB color for dust, leather and fireworks.fromRGB() makes a color from red, green and blue numbers
RED red
BLUE blue
getRed() the red part
Potion effects, particles and effects

Recipes

Custom crafting, smelting and more.

ClassWhat it is forHandy membersLearn more
Recipe
org.bukkit.inventory
The parent of all recipes.getResult() the item the recipe makesCustom crafting recipes
ShapedRecipe
org.bukkit.inventory
A crafting recipe where the pattern matters.shape() sets the rows of the pattern
setIngredient() says what a letter means
getKey() its key
Custom crafting recipes
ShapelessRecipe
org.bukkit.inventory
A crafting recipe where only the ingredients matter.addIngredient() adds one ingredient
getIngredientList() lists the ingredients
getKey() its key
Custom crafting recipes
FurnaceRecipe
org.bukkit.inventory
A smelting recipe.getInput() what goes in
getExperience() experience given
getCookingTime() how many ticks it takes
Custom crafting recipes
StonecuttingRecipe
org.bukkit.inventory
A stonecutter recipe.getInput() what goes in
getResult() what comes out
getGroup() its recipe book group
Custom crafting recipes
RecipeChoice
org.bukkit.inventory
Says which items count for one ingredient.test() checks if an item fits
getItemStack() a sample item
clone() makes a copy
Custom crafting recipes

Registries and keys

The lists of everything Minecraft knows, and the keys that name them.

ClassWhat it is forHandy membersLearn more
Registry
org.bukkit
A list of one kind of thing, such as enchantments or biomes.get() finds an entry by key
stream() walks through all entries
getOrThrow() finds an entry or fails
getKey() finds the key of an entry
Registries, keys and data components
RegistryAccess
io.papermc.paper.registry
The doorway to all registries.registryAccess() gets the shared access object
getRegistry() gets one registry by its key
Registries, keys and data components
RegistryKey
io.papermc.paper.registry
Names a registry, such as the enchantment registry.ENCHANTMENT enchantments
BIOME biomes
ITEM items
BLOCK blocks
Registries, keys and data components
TypedKey
io.papermc.paper.registry
A key that knows which registry it belongs to.create() makes a typed key
key() the plain key inside
registryKey() which registry it is for
Registries, keys and data components
Keyed
org.bukkit
Anything that has a key.getKey() returns its keyRegistries, keys and data components
Tag
org.bukkit
A named group of blocks, items or entity types, like logs or wool.isTagged() checks if something is in the group
getValues() lists everything in it
LOGS all log blocks
WOOL all wool blocks
Registries, keys and data components
Key
net.kyori.adventure.key
A namespaced name such as minecraft:diamond.key() makes a key
namespace() the part before the colon
value() the part after it
asString() writes it as text
Registries, keys and data components

Utilities

Small helper types for math, rays and text matching.

ClassWhat it is forHandy membersLearn more
Vector
org.bukkit.util
A direction and length in 3D, used for velocity and offsets.add() adds another vector
multiply() scales it
normalize() makes its length 1
length() how long it is
dot() measures how aligned two vectors are
Worlds, locations and movement
BlockVector
org.bukkit.util
A vector that always sits on whole block numbers.getBlockX() the block x
getBlockY() the block y
getBlockZ() the block z
Worlds, locations and movement
BoundingBox
org.bukkit.util
A box in space, like a hitbox.of() makes a box
contains() checks if a point is inside
overlaps() checks if two boxes touch
expand() makes it bigger
Worlds, locations and movement
RayTraceResult
org.bukkit.util
What a ray found when it was shot through the world.getHitBlock() the block it hit
getHitEntity() the entity it hit
getHitPosition() the exact point
Worlds, locations and movement
StringUtil
org.bukkit.util
Helpers for tab completion text.copyPartialMatches() collects the options that start with what was typedCommands, part 3: the classic plugin.yml way
EulerAngle
org.bukkit.util
Rotation values in radians for armor stands.getX() rotation around x
getY() rotation around y
getZ() rotation around z
add() adds angles
Entities and mobs
Transformation
org.bukkit.util
The move, turn and scale of a display entity.getTranslation() the shift
getScale() the size
getLeftRotation() the first rotation
Entities and mobs
NumberConversions
org.bukkit.util
Small number helpers.floor() rounds down to a whole number
square() multiplies a number by itself
round() rounds to the nearest whole number
Operators and math

Putting classes from many categories together

Real plugins mix categories all the time. This listener welcomes a player, counts their visits, gives a gift on the first visit and plays a little celebration. Next to each step is the category from this page that the class comes from, so you can practice reading the map.

TourListener.javaCompiles on Paper 26.3Compile Lab
Where this file livesref-api-map-toursrcmainjavacomexamplerefapimaptourTourListener.java

The package com.example.refapimaptour is the folder path com/example/refapimaptour inside src/main/java: every dot in the package name is one folder. IntelliJ creates these folders for you when you make a new package.

  • ref-api-map-tour/
    • src/main/
      • java/com/example/refapimaptour/Package com.example.refapimaptour
        • TourListener.javayou are hereListener: reacts to events
        • TourPlugin.javaMain class: Paper starts here (named as main in plugin.yml)
      • resources/Files copied into the jar as they are
        • plugin.ymlTells Paper the plugin's name, version and main class
    • build.gradle.ktsThe build recipe: Paper 26.3 API, Java 25, how the jar is made
    • gradle.propertiesVersion numbers used by the build
    • gradlew.batRuns Gradle on Windows without installing it
    • settings.gradle.ktsThe project's name

Gray files come with the project template; you rarely edit them. Open the whole project in the Compile Lab, or download it from the project page.

31@EventHandler32public void onJoin(PlayerJoinEvent event) {33    Player player = event.getPlayer();34    int visits = countVisit(player);35 36    World world = player.getWorld();37    Location spawn = world.getSpawnLocation();38    long blocksFromSpawn = Math.round(player.getLocation().distance(spawn));39 40    Component greeting = MiniMessage.miniMessage().deserialize(41            "<green>Welcome, <name>! Visit number <visits>, <distance> blocks from spawn.",42            Placeholder.unparsed("name", player.getName()),43            Placeholder.unparsed("visits", String.valueOf(visits)),44            Placeholder.unparsed("distance", String.valueOf(blocksFromSpawn)));45    player.sendMessage(greeting);46 47    if (visits == 1) {48        player.getInventory().addItem(ItemStack.of(Material.BREAD, 3));49    }50 51    player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);52    world.spawnParticle(Particle.HAPPY_VILLAGER, player.getLocation().add(0, 1, 0), 10);53 54    plugin.getServer().getScheduler().runTaskLater(plugin,55            () -> player.sendActionBar(Component.text("Have fun!")), 40L);56}
  1. Category Events. Paper calls this method whenever a player joins.
  2. A helper method below that uses Saving data. It returns how many times this player has joined.
  3. Category Players and senders gives you the player, and World and blocks gives you the World they stand in.
  4. A Location is a point in a world. distance measures the gap between two of them.
  5. Category Text and colors. The text uses tags like <green>, and each Placeholder fills one named hole.
  6. Category Items. Three loaves of bread, given only on the very first visit.
  7. Category Effects, sounds and particles.
  8. Category Scheduling. Runs the code inside the parentheses 40 ticks (two seconds) later.

The helper method is where the saved data lives:

TourListener.javaCompiles on Paper 26.3Compile Lab
Where this file livesref-api-map-toursrcmainjavacomexamplerefapimaptourTourListener.java

The package com.example.refapimaptour is the folder path com/example/refapimaptour inside src/main/java: every dot in the package name is one folder. IntelliJ creates these folders for you when you make a new package.

  • ref-api-map-tour/
    • src/main/
      • java/com/example/refapimaptour/Package com.example.refapimaptour
        • TourListener.javayou are hereListener: reacts to events
        • TourPlugin.javaMain class: Paper starts here (named as main in plugin.yml)
      • resources/Files copied into the jar as they are
        • plugin.ymlTells Paper the plugin's name, version and main class
    • build.gradle.ktsThe build recipe: Paper 26.3 API, Java 25, how the jar is made
    • gradle.propertiesVersion numbers used by the build
    • gradlew.batRuns Gradle on Windows without installing it
    • settings.gradle.ktsThe project's name

Gray files come with the project template; you rarely edit them. Open the whole project in the Compile Lab, or download it from the project page.

58private int countVisit(Player player) {59    PersistentDataContainer data = player.getPersistentDataContainer();60    int visits = data.getOrDefault(visitsKey, PersistentDataType.INTEGER, 0) + 1;61    data.set(visitsKey, PersistentDataType.INTEGER, visits);62    return visits;63}
  1. Every player carries a container of saved values. It is stored with the player, so it survives restarts.
  2. Reads the saved number, or uses 0 if the player has never been counted. Then we add one.
  3. Writes the new total back.

A returning player sees this in chat, and the action bar message follows two seconds later:

Welcome, Steve! Visit number 3, 14 blocks from spawn.
Have fun!

Count the categories: Events, Players, World, Saving data, Text, Items, Effects and Scheduling. Eight categories in one small method. Knowing where to look is half of writing plugins.

When the class you need is not here

The API has far more classes than this page lists on purpose. When you do not find what you need:

  • Use the Event Finder to look up events by describing what happens.
  • Use the Names Lookup to check the exact spelling of a class or method.
  • In IntelliJ, type the first letters of a name and press Ctrl+Space. The suggestion list shows classes and methods that fit.
  • Hold Ctrl and click any class name to open its source, where the documentation comments explain every method.
  • Browse the official documentation at jd.papermc.io and the guides at docs.papermc.io.
Try it

Find the classes yourself

Without copying any code, write a plugin that does this when a player joins: give them the Speed potion effect for 10 seconds, and show the words "Speed boost!" in the action bar. Use only this page to find the classes. Write down which category each class came from before you code.

Hint 1
The effect belongs to the Effects, sounds and particles category. You need two classes there: one for the effect and one for the kind of effect.
Hint 2
Time in Minecraft is counted in ticks. There are 20 ticks in a second, so ten seconds is 200 ticks.
Hint 3
A Player is a LivingEntity, and LivingEntity has the method for adding effects. The action bar method comes from Audience.
Show the solution

The effect classes are PotionEffect and PotionEffectType (Effects category). The message needs a Component (Text category) and sendActionBar (an Audience method, which Player is). The event is PlayerJoinEvent (Events category).

SpeedListener.javaCompiles on Paper 26.3Compile Lab
Where this file livesref-api-map-exercisesrcmainjavacomexamplerefapimapexerciseSpeedListener.java

The package com.example.refapimapexercise is the folder path com/example/refapimapexercise inside src/main/java: every dot in the package name is one folder. IntelliJ creates these folders for you when you make a new package.

  • ref-api-map-exercise/
    • src/main/
      • java/com/example/refapimapexercise/Package com.example.refapimapexercise
        • SpeedListener.javayou are hereListener: reacts to events
        • SpeedPlugin.javaMain class: Paper starts here (named as main in plugin.yml)
      • resources/Files copied into the jar as they are
        • plugin.ymlTells Paper the plugin's name, version and main class
    • build.gradle.ktsThe build recipe: Paper 26.3 API, Java 25, how the jar is made
    • gradle.propertiesVersion numbers used by the build
    • gradlew.batRuns Gradle on Windows without installing it
    • settings.gradle.ktsThe project's name

Gray files come with the project template; you rarely edit them. Open the whole project in the Compile Lab, or download it from the project page.

16@EventHandler17public void onJoin(PlayerJoinEvent event) {18    Player player = event.getPlayer();19    player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, TEN_SECONDS_IN_TICKS, 1));20    player.sendActionBar(Component.text("Speed boost!", NamedTextColor.AQUA));21}
  1. The three numbers are the effect type, how long it lasts in ticks, and the strength. Strength 1 means Speed II, because counting starts at 0.
  2. Shows text above the hotbar for a moment.

Do not forget the main class that registers the listener. It is the same registerEvents call you saw in Events and listeners.

Recap

  • A full class name is a package plus a class name, and it is exactly what an import line needs.
  • Names starting with org.bukkit are the classic API. io.papermc.paper is Paper's own additions. net.kyori.adventure is text. com.mojang.brigadier is commands.
  • Think in categories: events, players, text, world, entities, items, inventories, scheduling, data, permissions, scoreboards, effects, recipes, registries and utilities.
  • A small plugin method usually touches several categories. That is normal.
  • When in doubt, search this site with /, press Ctrl+Q in IntelliJ, or open the class source with Ctrl+click.

Quick quiz

  1. You want to save how many times a player joined, so it survives a restart. Which category do you open?

  2. What does the import line import org.bukkit.entity.Player; tell you?

  3. Which family of packages holds Paper's own additions to the API?

  4. In the tables, what does a name written like CREATIVE mean?

  5. Which class do you extend to make your plugin's main class?

Next steps