API map: which class does what
The Paper API sorted into plain-English categories, with the classes you will use most.
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
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.
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.
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.
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.
The first part of the package also tells you where a class comes from. That helps when you search online for help.
org.bukkitis the original game API. Paper is built on top of it, so older tutorials use it a lot.Player,World,MaterialandItemStacklive here.io.papermc.paper(and the oldercom.destroystokyo.paper) holds what Paper added: data components, registries, lifecycle events and the region schedulers.net.kyori.adventureis the text library built into Paper. Chat, titles, boss bars and item names all use it.com.mojang.brigadieris 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 in | Start with |
|---|---|---|
| Send a colored chat message | Text and colors | Component, MiniMessage |
| Show a title, action bar or boss bar | Text and colors | Title, BossBar |
| Run code when something happens | Events | PlayerJoinEvent, BlockBreakEvent |
| Stop something from happening | Events | Cancellable, EventPriority |
Make a command like /heal | Commands | BasicCommand, Commands |
| Teleport a player or change a block | World and blocks | Location, Block |
| Spawn a zombie or find mobs nearby | Entities and mobs | World, EntityType, LivingEntity |
| Give an item a name or lore | Items | ItemStack, ItemMeta |
| Open a chest-style menu | Inventories | Inventory, InventoryClickEvent |
| Do something every second, or later | Scheduling | BukkitScheduler, BukkitRunnable |
| Run slow work without causing lag | Scheduling | AsyncScheduler |
| Save a number on a player or an item | Saving data | PersistentDataContainer |
Read settings from config.yml | Saving data | FileConfiguration |
| Check what a player may do | Permissions | Permissible, PermissionDefault |
| Show a sidebar with scores | Scoreboards | Scoreboard, Objective |
| Play sounds, particles and potion effects | Effects, sounds and particles | Particle, PotionEffect |
| Add a crafting recipe | Recipes | ShapedRecipe |
| Talk to another plugin | Server and plugin | PluginManager, ServicesManager |
| Look up a vanilla item, biome or enchantment by name | Registries and keys | Registry, Key |
| Aim a ray and see what it hits | Utilities | RayTraceResult, 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.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Bukkitorg.bukkit | A static shortcut to the running server, for when you have no plugin object at hand. | getServer() gets the Server objectgetPlayer() finds an online player by namegetOnlinePlayers() lists everyone onlinegetWorld() finds a world by namebroadcast() sends a message to everyone | The main class and plugin lifecycle |
Serverorg.bukkit | The running server itself: its players, worlds, plugins and settings. | getOnlinePlayers() everyone online right nowgetPlayerExact() finds one online player by exact namegetWorld() finds a world by namegetPluginManager() gets the plugin managergetScheduler() gets the schedulergetConsoleSender() the console, as a command sender | The main class and plugin lifecycle |
JavaPluginorg.bukkit.plugin.java | The class your main class extends. Paper creates one object of it when your plugin loads. | onEnable() runs when your plugin startsonDisable() runs when your plugin stopsonLoad() runs before the worlds loadgetLogger() writes to the consolesaveDefaultConfig() copies config.yml out of the jargetConfig() reads config.ymlgetDataFolder() your plugin's folder in plugins/ | The main class and plugin lifecycle |
Pluginorg.bukkit.plugin | The interface JavaPlugin implements. Many methods ask for one when they need to know who is calling. | getName() the plugin's nameisEnabled() true while it runsgetDataFolder() the folder for its filesgetServer() the server it runs ongetPluginMeta() the details from plugin.yml | The main class and plugin lifecycle |
PluginManagerorg.bukkit.plugin | Registers listeners, fires events and looks up other plugins. | registerEvents() starts a listenercallEvent() fires an eventgetPlugin() finds a plugin by nameisPluginEnabled() checks that another plugin is runninggetPlugins() lists all loaded plugins | Working with other plugins |
PluginMetaio.papermc.paper.plugin.configuration | Everything plugin.yml or paper-plugin.yml says about a plugin. | getName() the plugin's namegetVersion() its version textgetAuthors() who wrote itgetDescription() its one-line descriptiongetMainClass() the main class name | plugin.yml explained |
ServicesManagerorg.bukkit.plugin | A shared notice board where plugins offer services to each other. | register() offers a serviceload() gets the best provider of a servicegetRegistration() gets a provider with its details | Working with other plugins |
PluginBootstrapio.papermc.paper.plugin.bootstrap | Code that runs before the server finishes loading, used by paper-plugin.yml plugins. | bootstrap() runs very early with a BootstrapContextcreatePlugin() lets you build your main class yourself | Paper plugins: paper-plugin.yml, bootstrapper and loader |
BootstrapContextio.papermc.paper.plugin.bootstrap | What a bootstrapper receives: the plugin's details and early access to the server. | getPluginMeta() the plugin's detailsgetDataDirectory() the plugin's data folder as a PathgetLifecycleManager() registers early handlersgetLogger() a logger that works this early | Paper plugins: paper-plugin.yml, bootstrapper and loader |
PluginLoaderio.papermc.paper.plugin.loader | Code that runs before your plugin class loads, to add libraries. | classloader() adds libraries to the plugin's classpath | Paper plugins: paper-plugin.yml, bootstrapper and loader |
LifecycleEventManagerio.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 step | Commands, part 2: Brigadier command trees |
ComponentLoggernet.kyori.adventure.text.logger.slf4j | A logger that prints Adventure text with colors to the console. | info() logs a normal messagewarn() logs a warningerror() logs an errordebug() logs a debug message | The main class and plugin lifecycle |
Players and senders
Everything that is a person, or acts like one.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Playerorg.bukkit.entity | One online player. The class you will use more than any other. | getName() the player's namegetUniqueId() the player's UUID, an id that never changes even if they renamesendMessage() sends a chat messageteleport() moves the playergetInventory() the player's inventorysetGameMode() changes game modekick() removes them from the server | Working with players |
OfflinePlayerorg.bukkit | A player who may or may not be online right now, found by name or UUID. | getName() the last known namegetUniqueId() the permanent UUIDisOnline() true when they are connectedgetPlayer() the online Player, or nullhasPlayedBefore() true if they joined at least oncegetFirstPlayed() when they first joined | Working with players |
HumanEntityorg.bukkit.entity | The shared parent of players and other human-shaped entities. | getInventory() the inventorygetGameMode() the game modeopenInventory() shows an inventorycloseInventory() closes the open onegetItemOnCursor() the item on the mouse cursor | Inventories |
CommandSenderorg.bukkit.command | Anything that can run a command: a player, the console or a command block. | sendMessage() sends textsendRichMessage() sends MiniMessage textgetName() the sender's namehasPermission() checks a permissionisOp() true for operators | Commands, part 1: simple commands |
Audiencenet.kyori.adventure.audience | Anything that can receive messages, titles and sounds. Players, the server and worlds are all audiences. | sendMessage() sends chat textsendActionBar() shows text above the hotbarshowTitle() shows a titleplaySound() plays a soundshowBossBar() shows a boss bar | Titles, action bars, boss bars and sounds |
GameModeorg.bukkit | The four game modes. | SURVIVAL normal playCREATIVE build with unlimited itemsADVENTURE cannot break blocks freelySPECTATOR fly through everything | Working with players |
Statisticorg.bukkit | Counters Minecraft keeps for each player, like blocks mined or time played. | PLAY_ONE_MINUTE ticks playedDEATHS times diedMOB_KILLS mobs killedJUMP times jumpedWALK_ONE_CM distance walked | Working with players |
Text and colors
Adventure, the text library built into Paper. All chat, titles and names use it.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Componentnet.kyori.adventure.text | One piece of formatted text. Components never change: every edit gives you a new one. | text() makes plain textempty() text with nothing in itnewline() a line breakjoin() glues many components togetherappend() adds another component after this onecolor() sets the colordecorate() turns on bold, italic and so on | Text and colors with Adventure |
TextComponentnet.kyori.adventure.text | A component that holds literal text, the kind Component.text makes. | content() the text insidechildren() the components added after itstyle() the formattingcolor() the color | Text and colors with Adventure |
TextColornet.kyori.adventure.text.format | Any color, including exact hex colors. | color() makes a color from numbersfromHexString() reads "#ff8800"asHexString() writes the color as hexvalue() the color as one number | Text and colors with Adventure |
NamedTextColornet.kyori.adventure.text.format | The 16 classic Minecraft colors as ready-made constants. | RED redGREEN greenGOLD goldAQUA aquaGRAY grayWHITE white | Text and colors with Adventure |
Stylenet.kyori.adventure.text.format | A bundle of color, decorations, click and hover that you can reuse on many components. | style() builds a stylecolor() gets the colordecoration() checks one decorationhoverEvent() gets the hoverclickEvent() gets the click | Text and colors with Adventure |
TextDecorationnet.kyori.adventure.text.format | The text effects: bold, italic and friends. | BOLD bold textITALIC italic textUNDERLINED underlined textSTRIKETHROUGH struck-through textOBFUSCATED scrambled "magic" text | Text and colors with Adventure |
MiniMessagenet.kyori.adventure.text.minimessage | Turns text with tags like <green> into components, and back. | miniMessage() gets the shared MiniMessagedeserialize() reads MiniMessage text into a componentserialize() writes a component as MiniMessageescapeTags() makes tag characters safestripTags() removes all tags | MiniMessage: easy formatted text |
Placeholdernet.kyori.adventure.text.minimessage.tag.resolver | Fills in a named hole like <name> inside MiniMessage text. | component() inserts a componentunparsed() inserts plain text that is never read as tagsparsed() inserts text that is read as MiniMessagestyling() inserts a style | MiniMessage: easy formatted text |
TagResolvernet.kyori.adventure.text.minimessage.tag.resolver | A set of tags MiniMessage understands. You pass resolvers when you deserialize. | resolver() combines several placeholdersstandard() all the built-in tagsempty() no tags at all | MiniMessage: easy formatted text |
ClickEventnet.kyori.adventure.text.event | What happens when a player clicks text in chat. | runCommand() runs a commandsuggestCommand() puts a command in the chat boxopenUrl() opens a linkcopyToClipboard() copies textchangePage() turns a book page | Text and colors with Adventure |
HoverEventnet.kyori.adventure.text.event | What a player sees when pointing at text. | showText() shows a tooltip of textshowItem() shows an item tooltipshowEntity() shows an entity tooltip | Text and colors with Adventure |
PlainTextComponentSerializernet.kyori.adventure.text.serializer.plain | Turns a component into plain text with no colors. | plainText() gets the shared serializerserialize() component to plain Stringdeserialize() plain String to component | Text and colors with Adventure |
LegacyComponentSerializernet.kyori.adventure.text.serializer.legacy | Converts old-style color codes like &a and section signs. | legacyAmpersand() reads and writes & codeslegacySection() reads and writes the section signdeserialize() String to componentserialize() component to String | Text and colors with Adventure |
GsonComponentSerializernet.kyori.adventure.text.serializer.gson | Converts components to and from the JSON Minecraft uses internally. | gson() gets the shared serializerserialize() component to JSONdeserialize() JSON to component | Text and colors with Adventure |
JoinConfigurationnet.kyori.adventure.text | Settings for Component.join: what goes between the pieces. | separator() puts one component between the piecescommas() separates with commasnewlines() puts each piece on its own linebuilder() builds a custom setup | Text and colors with Adventure |
Titlenet.kyori.adventure.title | A title and subtitle shown in the middle of the screen. | title() makes a title from two componentstimes() makes the fade and stay timingssubtitle() gets the second line | Titles, action bars, boss bars and sounds |
BossBarnet.kyori.adventure.bossbar | The bar at the top of the screen. | bossBar() makes a barname() sets the textprogress() sets how full it is from 0 to 1color() sets the coloraddViewer() shows it to a player | Titles, action bars, boss bars and sounds |
Soundnet.kyori.adventure.sound | A sound described with a key, a source, a volume and a pitch. | sound() makes a soundname() the sound's keyvolume() how loudpitch() how highsource() which volume slider controls it | Titles, action bars, boss bars and sounds |
ChatRendererio.papermc.paper.chat | Decides how one chat message looks to each viewer. | render() builds the final chat lineviewerUnaware() a simple renderer that ignores the viewer | Project: Chat formatter and filter |
Commands
Creating commands and reading what players type.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Commandsio.papermc.paper.command.brigadier | The tools for building and registering Brigadier commands. | literal() starts a command wordargument() adds a typed argumentregister() adds your command to the server | Commands, part 2: Brigadier command trees |
CommandSourceStackio.papermc.paper.command.brigadier | Who ran a Brigadier command and where. | getSender() the sender that ran itgetLocation() where it was rungetExecutor() who it was run as | Commands, part 2: Brigadier command trees |
BasicCommandio.papermc.paper.command.brigadier | The simplest modern command: one class with an execute method. | execute() runs the commandsuggest() gives tab completionscanUse() decides who may use itpermission() the permission needed | Commands, part 1: simple commands |
ArgumentTypesio.papermc.paper.command.brigadier.argument | Paper's ready-made argument types for Brigadier. | player() one online playerplayers() several playersworld() a worldfinePosition() exact coordinatescomponent() formatted text | Commands, part 2: Brigadier command trees |
PlayerSelectorArgumentResolverio.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 players | Commands, part 2: Brigadier command trees |
LifecycleEventsio.papermc.paper.plugin.lifecycle.event.types | The list of startup moments you can hook into. | COMMANDS the moment to register commandsTAGS the moment to change block and item tags | Commands, part 2: Brigadier command trees |
ReloadableRegistrarEventio.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 with | Commands, part 2: Brigadier command trees |
LiteralArgumentBuildercom.mojang.brigadier.builder | Builds a fixed command word such as heal. | literal() starts a new wordthen() adds a child word or argumentexecutes() sets the code to runrequires() sets who may use it | Commands, part 2: Brigadier command trees |
RequiredArgumentBuildercom.mojang.brigadier.builder | Builds an argument a player must type, such as a number or a name. | argument() starts a new argumentsuggests() adds tab completionsthen() adds a childexecutes() sets the code to run | Commands, part 2: Brigadier command trees |
CommandContextcom.mojang.brigadier.context | What your command code receives: the sender and the typed arguments. | getSource() who ran the commandgetArgument() reads an argument by name | Commands, part 2: Brigadier command trees |
Commandcom.mojang.brigadier | The interface your executes code fulfills, plus the usual return value. | SINGLE_SUCCESS the number 1, meaning it workedrun() the method that runs your code | Commands, part 2: Brigadier command trees |
StringArgumentTypecom.mojang.brigadier.arguments | Argument types for words and text. | word() one wordstring() a word or quoted textgreedyString() all the rest of the linegetString() reads the value | Commands, part 2: Brigadier command trees |
IntegerArgumentTypecom.mojang.brigadier.arguments | Argument type for whole numbers, with optional limits. | integer() a whole number, optionally with a minimum and maximumgetInteger() reads the value | Commands, part 2: Brigadier command trees |
SuggestionsBuildercom.mojang.brigadier.suggestion | Collects tab-completion suggestions. | suggest() adds one suggestiongetRemaining() the text typed so farbuild() finishes the list | Commands, part 2: Brigadier command trees |
CommandExecutororg.bukkit.command | The classic interface for commands listed in plugin.yml. | onCommand() runs when someone uses the command | Commands, part 3: the classic plugin.yml way |
TabCompleterorg.bukkit.command | The classic interface for tab completion. | onTabComplete() returns the suggestions | Commands, part 3: the classic plugin.yml way |
PluginCommandorg.bukkit.command | A command declared in plugin.yml, as an object. | setExecutor() attaches your codesetTabCompleter() attaches completionssetPermission() sets the permissiongetName() the command's name | Commands, part 3: the classic plugin.yml way |
ConsoleCommandSenderorg.bukkit.command | The server console as a command sender. | sendMessage() prints a messagegetName() returns CONSOLEhasPermission() true for every permission | Commands, part 1: simple commands |
Events
The things that happen in the game, and the pieces for listening to them.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Eventorg.bukkit.event | The parent of every event. | getEventName() the event's class nameisAsynchronous() true if it is fired off the main threadcallEvent() fires the event to all listeners | Events and listeners |
Listenerorg.bukkit.event | A label that marks a class as holding event handlers. It has no methods. | no methods, just implement it | Events and listeners |
EventHandlerorg.bukkit.event | The annotation you put on a handler method. | priority() when to run compared to other pluginsignoreCancelled() skip events another plugin already canceled | Events and listeners |
EventPriorityorg.bukkit.event | The order handlers run in. | LOWEST firstLOW earlyNORMAL the defaultHIGH lateHIGHEST last to change thingsMONITOR last of all, only to watch | Event priorities and canceling |
Cancellableorg.bukkit.event | Marks events you can cancel to stop the action. | isCancelled() true if someone already stopped itsetCancelled() stops it or lets it happen | Event priorities and canceling |
HandlerListorg.bukkit.event | The list of handlers an event keeps. Needed when you write your own event. | unregisterAll() removes every handler a plugin or listener addedgetRegisteredListeners() lists the registered handlersgetHandlerLists() all the lists of all events | Making your own events |
PlayerJoinEventorg.bukkit.event.player | A player has just joined. | getPlayer() who joinedjoinMessage() the message everyone sees, or null to hide it | Events and listeners |
PlayerQuitEventorg.bukkit.event.player | A player is leaving. | getPlayer() who leftquitMessage() the message everyone seesgetReason() why they left | Events and listeners |
PlayerInteractEventorg.bukkit.event.player | A player clicked the air or a block. | getPlayer() who clickedgetAction() which kind of clickgetClickedBlock() the block they clickedgetItem() the item in their handgetHand() which hand | Events and listeners |
PlayerInteractEntityEventorg.bukkit.event.player | A player right-clicked an entity. | getPlayer() who clickedgetRightClicked() the entity they clickedgetHand() which hand | Entities and mobs |
PlayerMoveEventorg.bukkit.event.player | A player moved or turned. It fires very often, so keep the code short. | getPlayer() who movedgetFrom() where they weregetTo() where they are goinghasChangedBlock() true if they entered a new block | Events and listeners |
PlayerRespawnEventorg.bukkit.event.player | A player is about to respawn. | getPlayer() who diedgetRespawnLocation() where they will appearsetRespawnLocation() chooses a different spot | Events and listeners |
PlayerDropItemEventorg.bukkit.event.player | A player threw an item out. | getPlayer() who dropped itgetItemDrop() the dropped item entity | Events and listeners |
PlayerItemConsumeEventorg.bukkit.event.player | A player is about to eat or drink something. | getPlayer() who is eatinggetItem() the food or potionsetItem() changes what they consume | Events and listeners |
AsyncChatEventio.papermc.paper.event.player | A player sent a chat message. It fires off the main thread. | getPlayer() who chattedmessage() the message as a componentrenderer() how the line is shownviewers() who will see it | Project: Chat formatter and filter |
BlockBreakEventorg.bukkit.event.block | A player is breaking a block. | getPlayer() who breaks itgetBlock() which blocksetDropItems() turns the drops off or onsetExpToDrop() sets the experience dropped | Events and listeners |
BlockPlaceEventorg.bukkit.event.block | A player placed a block. | getPlayer() who placed itgetBlock() the new blockgetBlockPlaced() the same new blockgetItemInHand() the item used | Events and listeners |
EntityDamageEventorg.bukkit.event.entity | Something is about to take damage. | getEntity() who is hurtgetDamage() how much damagesetDamage() changes the damagegetCause() what caused it | Events and listeners |
EntityDamageByEntityEventorg.bukkit.event.entity | Damage that one entity caused to another. | getDamager() who hitgetEntity() who was hitgetDamage() how much damage | Events and listeners |
EntityDeathEventorg.bukkit.event.entity | A living thing died. | getEntity() what diedgetDrops() the items it dropssetDroppedExp() sets the experience dropped | Events and listeners |
PlayerDeathEventorg.bukkit.event.entity | A player died. | deathMessage() the death messagegetDrops() the items droppedsetKeepInventory() keeps the itemsgetEntity() the player who died | Events and listeners |
EntityExplodeEventorg.bukkit.event.entity | An entity such as a creeper is exploding. | blockList() the blocks that will breakgetEntity() what explodedsetYield() sets what fraction of the blocks drop items | Events and listeners |
InventoryClickEventorg.bukkit.event.inventory | A player clicked a slot in an open inventory. | getWhoClicked() the playergetSlot() which slotgetCurrentItem() the clicked itemgetClick() the kind of clickgetClickedInventory() which inventory was clicked | Building GUI menus |
InventoryCloseEventorg.bukkit.event.inventory | A player closed an inventory. | getPlayer() who closed itgetInventory() which inventory | Building GUI menus |
PaperServerListPingEventcom.destroystokyo.paper.event.server | The server list asked for your server's status. | motd() the message of the daysetMaxPlayers() the shown player limitgetNumPlayers() the shown player count | Events and listeners |
World and blocks
Places, positions and blocks.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Worldorg.bukkit | One world, like the overworld or the nether. | getName() the world's namegetBlockAt() gets the block at a positiongetSpawnLocation() the spawn pointgetTime() the time of dayspawnEntity() creates a mob or entitygetPlayers() players in this worldstrikeLightning() hits a spot with lightning | Worlds, locations and movement |
Locationorg.bukkit | A point in a world: x, y, z and the direction you face. | getWorld() the worldgetX() the x coordinategetBlock() the block hereadd() moves the pointdistance() distance to another locationclone() makes a copy | Worlds, locations and movement |
Chunkorg.bukkit | A 16 by 16 column of the world that the server loads in one piece. | getX() chunk x numbergetZ() chunk z numberisLoaded() true if it is loadedgetWorld() the world it is in | Worlds, locations and movement |
Blockorg.bukkit.block | One block in the world. | getType() the materialsetType() changes the materialgetLocation() where it isgetRelative() the neighbor in some directiongetState() a snapshot with extra detailsgetBlockData() its current settings | Blocks and block data |
BlockStateorg.bukkit.block | A snapshot of a block, including things like chest contents. | update() writes your changes back to the worldgetBlock() the block it came fromgetType() the material at that moment | Blocks and block data |
BlockFaceorg.bukkit.block | A direction: north, up, down and so on. | NORTH toward negative zEAST toward positive xUP aboveDOWN belowgetOppositeFace() the other way | Blocks and block data |
BlockDataorg.bukkit.block.data | The settings of a block, such as which way a door faces. | getMaterial() the block typeclone() makes a copymatches() compares two settingsgetAsString() writes it as text | Blocks and block data |
Directionalorg.bukkit.block.data | Block data for blocks that face a direction, like furnaces and stairs. | getFacing() the directionsetFacing() turns the blockgetFaces() the directions allowed | Blocks and block data |
Ageableorg.bukkit.block.data | Block data for crops that grow in stages. | getAge() the growth stagesetAge() sets the stagegetMaximumAge() the last stage | Blocks and block data |
Containerorg.bukkit.block | A block that holds items, like a chest or barrel. | getInventory() the contentsgetSnapshotInventory() a copy you can edit before update | Blocks and block data |
Signorg.bukkit.block | A sign block, with text you can read and change. | getSide() gets the front or back sidesetWaxed() locks the signisWaxed() true if it is locked | Blocks and block data |
BlockTypeorg.bukkit.block | The type of a block as an object, the block twin of ItemType. | getKey() its keycreateBlockData() makes default block datahasItemType() true if it can be an item | Registries, keys and data components |
Biomeorg.bukkit.block | The climate and look of a spot in the world, like plains or desert. | PLAINS the plains biomeDESERT the desert biomeFOREST the forest biomegetKey() the biome's key | Worlds, locations and movement |
WorldBorderorg.bukkit | The edge of a world. | setSize() sets the widthsetCenter() sets the middlegetSize() the current widthisInside() true if a location is inside | Worlds, locations and movement |
WorldCreatororg.bukkit | Recipe for creating a new world. | name() starts a creator for that namecreateWorld() makes the worldenvironment() nether, end or normalseed() sets the seed | Worlds, locations and movement |
Positionio.papermc.paper.math | A plain position that is not tied to a world. | block() makes a block positionfine() makes an exact positionx() the x coordinate | Worlds, locations and movement |
Entities and mobs
Everything that moves or stands in the world besides blocks.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Entityorg.bukkit.entity | The parent of everything alive or movable: players, mobs, dropped items and arrows. | getLocation() where it isteleport() moves itremove() deletes it from the worldgetType() what kind of entity it isgetUniqueId() its permanent idcustomName() gets or sets the name taggetScheduler() its own region scheduler | Entities and mobs |
LivingEntityorg.bukkit.entity | Entities that have health, like mobs and players. | getEquipment() what it wears and holdsaddPotionEffect() gives it a potion effectgetAttribute() reads a stat like max healthgetEyeLocation() where its eyes aredamage() hurts it | Entities and mobs |
Damageableorg.bukkit.entity | Anything that has health points. | getHealth() current healthsetHealth() sets healthdamage() hurts itheal() restores health | Entities and mobs |
Moborg.bukkit.entity | A living thing with artificial intelligence, such as a zombie. | getTarget() who it is chasingsetTarget() picks a targetgetPathfinder() moves it with Paper's pathfindingsetAware() turns its AI behavior on or off | Entities and mobs |
Ageableorg.bukkit.entity | Animals and villagers that have a baby stage. | isAdult() true when grown upsetBaby() turns it into a babysetAdult() grows it upgetAge() age counter | Entities and mobs |
EntityTypeorg.bukkit.entity | The list of entity kinds. | ZOMBIE a zombieCREEPER a creeperVILLAGER a villagerARMOR_STAND an armor standPLAYER a player | Entities and mobs |
Villagerorg.bukkit.entity | A villager, with a profession and trades. | getProfession() its jobsetProfession() changes its jobgetRecipes() its tradessetRecipes() replaces its trades | Entities and mobs |
ArmorStandorg.bukkit.entity | The stand used for holograms and decorations. | setGravity() turns gravity on or offsetVisible() shows or hides the standsetSmall() makes it smallsetArms() gives it arms | Entities and mobs |
Itemorg.bukkit.entity | A dropped item lying in the world. | getItemStack() the item it holdssetItemStack() changes the itemsetPickupDelay() how long before pickup | Items and ItemStacks |
Projectileorg.bukkit.entity | Something thrown or shot, like arrows and snowballs. | getShooter() who launched itsetShooter() changes the shooter | Entities and mobs |
Arroworg.bukkit.entity | An arrow in flight. | setDamage() changes how hard it hitsgetDamage() how hard it hitssetCritical() makes it a critical hit | Entities and mobs |
Displayorg.bukkit.entity | Parent of display entities, which show things without a hitbox. | setBillboard() makes it turn to face the playersetTransformation() moves, rotates and scales itsetBrightness() sets its light level | Entities and mobs |
TextDisplayorg.bukkit.entity | Floating text in the world, great for holograms. | text() sets the text with a componentsetBackgroundColor() colors the backgroundsetAlignment() aligns the lines | Entities and mobs |
ItemDisplayorg.bukkit.entity | A floating item model in the world. | setItemStack() chooses the itemsetItemDisplayTransform() chooses how the item is posed | Entities and mobs |
Attributeorg.bukkit.attribute | The stats of a living thing. | MAX_HEALTH how much health it can haveMOVEMENT_SPEED how fast it walksATTACK_DAMAGE how hard it hitsARMOR how much armor | Entities and mobs |
AttributeInstanceorg.bukkit.attribute | One stat on one entity, with all its modifiers. | getBaseValue() the plain valuesetBaseValue() changes the plain valuegetValue() the final value with modifiersaddModifier() adds a bonus or penalty | Entities and mobs |
AttributeModifierorg.bukkit.attribute | A bonus or penalty added to a stat. | getAmount() how much it changes the statgetOperation() how it is appliedgetKey() its unique key | Items and ItemStacks |
Pathfindercom.destroystokyo.paper.entity | Paper's tool for walking a mob to a spot. | moveTo() starts walking to a locationstopPathfinding() stops walkinghasPath() true while it has a route | Entities and mobs |
Items
The things players hold, wear and craft with.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
ItemStackorg.bukkit.inventory | A stack of items: a type, an amount and its extra data. | of() makes a stackgetType() the materialgetAmount() how manysetAmount() changes how manyeditMeta() changes name, lore and moresetData() sets a data component | Items and ItemStacks |
Materialorg.bukkit | The old list of every block and item kind. Still used in most code. | DIAMOND the diamond itemSTONE the stone blockisBlock() true if it can be placedisItem() true if it can be heldgetMaxStackSize() biggest stack size | Items and ItemStacks |
ItemTypeorg.bukkit.inventory | The newer object form of an item kind. | getKey() its keycreateItemStack() makes a stackgetMaxStackSize() biggest stack sizehasBlockType() true if it can be placed | Registries, keys and data components |
ItemMetaorg.bukkit.inventory.meta | Extra data on an item: name, lore, enchants, flags. | displayName() sets the name with a componentlore() sets the lore lines, the gray text under an item's nameaddEnchant() adds an enchantmentaddItemFlags() hides parts of the tooltipgetPersistentDataContainer() your own saved data | Items and ItemStacks |
Damageableorg.bukkit.inventory.meta | Item meta for tools that wear out. | getDamage() how worn it issetDamage() changes the wearhasDamage() true if it has any wear | Items and ItemStacks |
SkullMetaorg.bukkit.inventory.meta | Item meta for player heads. | setOwningPlayer() picks whose head it isgetOwningPlayer() reads whose head it issetPlayerProfile() sets a custom profile | Items and ItemStacks |
PotionMetaorg.bukkit.inventory.meta | Item meta for potions. | setBasePotionType() picks the potion typeaddCustomEffect() adds an extra effectsetColor() sets the liquid color | Items and ItemStacks |
LeatherArmorMetaorg.bukkit.inventory.meta | Item meta for leather armor, to dye it. | setColor() dyes the armorgetColor() reads the dye color | Items and ItemStacks |
Enchantmentorg.bukkit.enchantments | An enchantment, like Sharpness. | SHARPNESS more melee damagePROTECTION less damage takenEFFICIENCY faster mininggetKey() its key | Items and ItemStacks |
ItemFlagorg.bukkit.inventory | Switches that hide parts of an item's tooltip. | HIDE_ENCHANTS hides the enchantment listHIDE_ATTRIBUTES hides attribute linesHIDE_UNBREAKABLE hides the unbreakable line | Items and ItemStacks |
EquipmentSlotorg.bukkit.inventory | The places an entity holds or wears items. | HAND the main handOFF_HAND the off handHEAD the helmet slotCHEST the chestplate slotFEET the boots slot | Items and ItemStacks |
EquipmentSlotGrouporg.bukkit.inventory | A group of slots, used for attribute modifiers on items. | MAINHAND the main handANY any slotARMOR any armor slot | Items and ItemStacks |
ItemRarityorg.bukkit.inventory | How rare an item is, which sets its name color. | COMMON white namesUNCOMMON yellow namesRARE aqua namesEPIC light purple names | Items and ItemStacks |
DataComponentTypesio.papermc.paper.datacomponent | The list of data components an item can have, like its name or durability. | CUSTOM_NAME a custom nameLORE the lore linesMAX_STACK_SIZE the stack limitITEM_MODEL which model it usesCUSTOM_MODEL_DATA a model selector | Registries, keys and data components |
ItemLoreio.papermc.paper.datacomponent.item | The lore component's value. | lore() makes lore from a list of componentslines() reads the linesstyledLines() reads the lines with default styling | Registries, keys and data components |
ItemEnchantmentsio.papermc.paper.datacomponent.item | The enchantments component's value. | itemEnchantments() makes the value from a map of enchantmentsenchantments() reads the enchantments | Registries, keys and data components |
CustomModelDataio.papermc.paper.datacomponent.item | The component that picks a custom model for resource packs. | customModelData() starts a builder for the valuefloats() numbers a pack can readstrings() text a pack can read | Registries, keys and data components |
Inventories
Chests, player inventories and menus.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Inventoryorg.bukkit.inventory | A grid of item slots. | getItem() reads a slotsetItem() puts an item in a slotaddItem() adds an item to the first free spacecontains() checks for an itemclear() empties itgetSize() how many slots | Inventories |
PlayerInventoryorg.bukkit.inventory | A player's inventory with hotbar and armor. | getItemInMainHand() the held itemsetItemInMainHand() replaces the held itemgetHelmet() the worn helmetgetArmorContents() all armor piecesgetHeldItemSlot() the chosen hotbar slot | Inventories |
InventoryHolderorg.bukkit.inventory | The owner of an inventory. Menu code often implements it. | getInventory() returns the inventory this holder owns | Building GUI menus |
InventoryVieworg.bukkit.inventory | What a player currently sees: top and bottom inventory together. | getTitle() the window titlegetTopInventory() the upper inventorygetBottomInventory() the player's inventorygetPlayer() who is looking | Building GUI menus |
InventoryTypeorg.bukkit.event.inventory | The kinds of inventory, like chest or furnace. | CHEST a chestHOPPER a hopperFURNACE a furnaceANVIL an anvilPLAYER a player inventory | Inventories |
ClickTypeorg.bukkit.event.inventory | The kind of click: left, right, shift and more. | LEFT left clickRIGHT right clickSHIFT_LEFT left click with shiftDROP pressing the drop keyisLeftClick() true for any left click | Building GUI menus |
InventoryActionorg.bukkit.event.inventory | What a click will do to the items. | PICKUP_ALL picks up the stackPLACE_ALL places the stackMOVE_TO_OTHER_INVENTORY moves the stack acrossNOTHING does nothing | Building GUI menus |
MenuTypeorg.bukkit.inventory | The kinds of menu window, with a builder for custom ones. | GENERIC_9X3 a 3 row chest menuANVIL an anvil menucreate() makes a menu window for a playertyped() gives a builder for more setup | Building GUI menus |
MerchantRecipeorg.bukkit.inventory | One trade in a villager or custom merchant window. | getResult() what the trade givesgetIngredients() what the trade costssetMaxUses() how often it can be used | Building GUI menus |
Scheduling
Running code later, repeatedly, or off the main thread.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
BukkitSchedulerorg.bukkit.scheduler | The classic scheduler. | runTask() runs once on the next tickrunTaskLater() runs once after a delayrunTaskTimer() repeatsrunTaskAsynchronously() runs off the main threadcancelTasks() stops all tasks of a plugin | Timing and tasks: the scheduler |
BukkitTaskorg.bukkit.scheduler | A handle to a task you scheduled. | cancel() stops the taskisCancelled() true if stoppedgetTaskId() its numbergetOwner() the plugin that owns it | Timing and tasks: the scheduler |
BukkitRunnableorg.bukkit.scheduler | A task class you extend and start yourself. | run() the code to runrunTaskTimer() starts it repeatingrunTaskLater() starts it after a delaycancel() stops it | Timing and tasks: the scheduler |
ScheduledTaskio.papermc.paper.threadedregions.scheduler | A handle to a task made by Paper's region schedulers. | cancel() stops the taskisCancelled() true if stoppedgetOwningPlugin() who scheduled itisRepeatingTask() true if it repeats | Folia and regionized scheduling |
GlobalRegionSchedulerio.papermc.paper.threadedregions.scheduler | Runs tasks that are not tied to a place. | run() runs once soonrunDelayed() runs once after a delayrunAtFixedRate() repeatscancelTasks() stops a plugin's tasks | Folia and regionized scheduling |
RegionSchedulerio.papermc.paper.threadedregions.scheduler | Runs tasks at a place in the world. | run() runs once at a locationrunDelayed() runs after a delayrunAtFixedRate() repeats | Folia and regionized scheduling |
EntitySchedulerio.papermc.paper.threadedregions.scheduler | Runs tasks that follow one entity. | run() runs once for this entityrunDelayed() runs after a delayrunAtFixedRate() repeatsexecute() runs a plain Runnable | Folia and regionized scheduling |
AsyncSchedulerio.papermc.paper.threadedregions.scheduler | Runs slow work off the main thread. | runNow() runs right away in the backgroundrunDelayed() runs later in the backgroundrunAtFixedRate() repeats in the background | Threads, performance and lag |
Saving data
Config files, saved values and data stuck on items, entities and players.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
PersistentDataContainerorg.bukkit.persistence | Sticky notes you attach to entities, items and blocks. They are saved with the world. | set() writes a valueget() reads a value or nullhas() checks a keyremove() deletes a keygetKeys() lists all keys | Saving data on things: PersistentDataContainer |
PersistentDataTypeorg.bukkit.persistence | Says which kind of value a sticky note holds. | STRING textINTEGER a whole numberDOUBLE a decimal numberBOOLEAN true or falseLONG a big whole number | Saving data on things: PersistentDataContainer |
PersistentDataHolderorg.bukkit.persistence | Anything that can carry a container. | getPersistentDataContainer() gets the container | Saving data on things: PersistentDataContainer |
NamespacedKeyorg.bukkit | A name like myplugin:coins that identifies your data. | fromString() reads text like myplugin:coinsminecraft() builds a vanilla keygetKey() the name partgetNamespace() the plugin part | Saving data on things: PersistentDataContainer |
FileConfigurationorg.bukkit.configuration.file | A config file loaded in memory. | getString() reads textgetInt() reads a whole numbergetBoolean() reads true or falseset() changes a valuesave() writes the file | Configuration files |
YamlConfigurationorg.bukkit.configuration.file | A FileConfiguration that reads and writes YAML files. | loadConfiguration() reads a YAML filesave() writes the filegetKeys() lists keys | Configuration files |
ConfigurationSectionorg.bukkit.configuration | A group of values in a config, like one section of config.yml. | getConfigurationSection() gets a sub-sectiongetKeys() lists the keysgetStringList() reads a list of textcontains() checks a path | Configuration files |
ConfigurationSerializableorg.bukkit.configuration.serialization | Lets your own class be saved to and loaded from YAML. | serialize() turns the object into a map | Saving player data: files and databases |
Permissions
Who is allowed to do what.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Permissionorg.bukkit.permissions | A permission you declare in code, with a default. | getName() the permission textgetDefault() who gets it by defaultgetDescription() what it allows | Permissions |
PermissionDefaultorg.bukkit.permissions | Who has a permission when nobody set it. | TRUE everyoneFALSE nobodyOP operators onlyNOT_OP everyone except operators | Permissions |
Permissibleorg.bukkit.permissions | Anything that can have permissions, like players and the console. | hasPermission() checks one permissionisPermissionSet() true if it was set at alladdAttachment() gives a temporary permission | Permissions |
PermissionAttachmentorg.bukkit.permissions | A temporary set of permissions you give to a player. | setPermission() turns a permission on or offunsetPermission() removes a settingremove() removes the whole attachment | Permissions |
Scoreboards
Sidebars, teams and score numbers.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Scoreboardorg.bukkit.scoreboard | A whole scoreboard: its objectives and teams. | registerNewObjective() creates an objectiveregisterNewTeam() creates a teamgetObjective() finds an objectivegetTeam() finds a team | Scoreboards, sidebars and teams |
Objectiveorg.bukkit.scoreboard | A list of scores with a name, which can show as the sidebar. | getScore() gets the score line for a namesetDisplaySlot() chooses where it showsdisplayName() sets the titlenumberFormat() changes how numbers look | Scoreboards, sidebars and teams |
Teamorg.bukkit.scoreboard | A group of entries that share color, prefix and rules. | addEntry() adds a player or nameprefix() sets the text before namescolor() sets the name colorsetAllowFriendlyFire() turns friendly fire on or off | Scoreboards, sidebars and teams |
Scoreorg.bukkit.scoreboard | One line's number on an objective. | setScore() sets the numbergetScore() reads the numbercustomName() shows other text instead of the name | Scoreboards, sidebars and teams |
ScoreboardManagerorg.bukkit.scoreboard | Makes new scoreboards. | getNewScoreboard() creates a fresh scoreboardgetMainScoreboard() the shared one | Scoreboards, sidebars and teams |
DisplaySlotorg.bukkit.scoreboard | Where an objective shows. | SIDEBAR the right side of the screenBELOW_NAME under player namesPLAYER_LIST in the tab list | Scoreboards, sidebars and teams |
Criteriaorg.bukkit.scoreboard | How an objective's score changes by itself. | DUMMY changes only when you set itHEALTH follows the player's healthgetName() its name | Scoreboards, sidebars and teams |
NumberFormatio.papermc.paper.scoreboard.numbers | Changes how score numbers look in a sidebar. | blank() shows no numberfixed() shows fixed textstyled() shows the number with a style | Scoreboards, sidebars and teams |
Effects, sounds and particles
Things players see and hear.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Particleorg.bukkit | The particles you can spawn. | FLAME a flameHEART a heartCLOUD a puff of cloudCRIT a critical hit sparkDUST colored dust | Potion effects, particles and effects |
Soundorg.bukkit | The sounds you can play. | ENTITY_EXPERIENCE_ORB_PICKUP the orb pingENTITY_PLAYER_LEVELUP the level-up chimeBLOCK_NOTE_BLOCK_PLING a note block pling | Potion effects, particles and effects |
SoundCategoryorg.bukkit | Which volume slider controls a sound. | MASTER overall volumeMUSIC music sliderAMBIENT ambient sliderPLAYERS player sounds | Potion effects, particles and effects |
PotionEffectorg.bukkit.potion | One effect with a type, a time, a level and some flags. | getType() the effect typegetDuration() how long it lasts in ticksgetAmplifier() the level minus onewithDuration() a copy with a new duration | Potion effects, particles and effects |
PotionEffectTypeorg.bukkit.potion | The list of effect kinds. | SPEED speedNIGHT_VISION night visionREGENERATION regenerationSLOWNESS slownessgetKey() its key | Potion effects, particles and effects |
PotionTypeorg.bukkit.potion | The kinds of potion bottle. | WATER plain waterSWIFTNESS the speed potionHEALING the healing potiongetKey() its key | Items and ItemStacks |
Effectorg.bukkit | Old-style world effects such as smoke and disc playing. | SMOKE smokeRECORD_PLAY plays a discgetType() the effect's kind | Potion effects, particles and effects |
FireworkEffectorg.bukkit | The look of one firework burst. | builder() starts building an effectgetColors() the main colorshasTrail() true if it leaves a trailhasFlicker() true if it twinkles | Potion effects, particles and effects |
Fireworkorg.bukkit.entity | A firework rocket entity. | getFireworkMeta() reads its effectssetFireworkMeta() changes its effectsdetonate() makes it burst right now | Potion effects, particles and effects |
Colororg.bukkit | An RGB color for dust, leather and fireworks. | fromRGB() makes a color from red, green and blue numbersRED redBLUE bluegetRed() the red part | Potion effects, particles and effects |
Recipes
Custom crafting, smelting and more.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Recipeorg.bukkit.inventory | The parent of all recipes. | getResult() the item the recipe makes | Custom crafting recipes |
ShapedRecipeorg.bukkit.inventory | A crafting recipe where the pattern matters. | shape() sets the rows of the patternsetIngredient() says what a letter meansgetKey() its key | Custom crafting recipes |
ShapelessRecipeorg.bukkit.inventory | A crafting recipe where only the ingredients matter. | addIngredient() adds one ingredientgetIngredientList() lists the ingredientsgetKey() its key | Custom crafting recipes |
FurnaceRecipeorg.bukkit.inventory | A smelting recipe. | getInput() what goes ingetExperience() experience givengetCookingTime() how many ticks it takes | Custom crafting recipes |
StonecuttingRecipeorg.bukkit.inventory | A stonecutter recipe. | getInput() what goes ingetResult() what comes outgetGroup() its recipe book group | Custom crafting recipes |
RecipeChoiceorg.bukkit.inventory | Says which items count for one ingredient. | test() checks if an item fitsgetItemStack() a sample itemclone() makes a copy | Custom crafting recipes |
Registries and keys
The lists of everything Minecraft knows, and the keys that name them.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Registryorg.bukkit | A list of one kind of thing, such as enchantments or biomes. | get() finds an entry by keystream() walks through all entriesgetOrThrow() finds an entry or failsgetKey() finds the key of an entry | Registries, keys and data components |
RegistryAccessio.papermc.paper.registry | The doorway to all registries. | registryAccess() gets the shared access objectgetRegistry() gets one registry by its key | Registries, keys and data components |
RegistryKeyio.papermc.paper.registry | Names a registry, such as the enchantment registry. | ENCHANTMENT enchantmentsBIOME biomesITEM itemsBLOCK blocks | Registries, keys and data components |
TypedKeyio.papermc.paper.registry | A key that knows which registry it belongs to. | create() makes a typed keykey() the plain key insideregistryKey() which registry it is for | Registries, keys and data components |
Keyedorg.bukkit | Anything that has a key. | getKey() returns its key | Registries, keys and data components |
Tagorg.bukkit | A named group of blocks, items or entity types, like logs or wool. | isTagged() checks if something is in the groupgetValues() lists everything in itLOGS all log blocksWOOL all wool blocks | Registries, keys and data components |
Keynet.kyori.adventure.key | A namespaced name such as minecraft:diamond. | key() makes a keynamespace() the part before the colonvalue() the part after itasString() writes it as text | Registries, keys and data components |
Utilities
Small helper types for math, rays and text matching.
| Class | What it is for | Handy members | Learn more |
|---|---|---|---|
Vectororg.bukkit.util | A direction and length in 3D, used for velocity and offsets. | add() adds another vectormultiply() scales itnormalize() makes its length 1length() how long it isdot() measures how aligned two vectors are | Worlds, locations and movement |
BlockVectororg.bukkit.util | A vector that always sits on whole block numbers. | getBlockX() the block xgetBlockY() the block ygetBlockZ() the block z | Worlds, locations and movement |
BoundingBoxorg.bukkit.util | A box in space, like a hitbox. | of() makes a boxcontains() checks if a point is insideoverlaps() checks if two boxes touchexpand() makes it bigger | Worlds, locations and movement |
RayTraceResultorg.bukkit.util | What a ray found when it was shot through the world. | getHitBlock() the block it hitgetHitEntity() the entity it hitgetHitPosition() the exact point | Worlds, locations and movement |
StringUtilorg.bukkit.util | Helpers for tab completion text. | copyPartialMatches() collects the options that start with what was typed | Commands, part 3: the classic plugin.yml way |
EulerAngleorg.bukkit.util | Rotation values in radians for armor stands. | getX() rotation around xgetY() rotation around ygetZ() rotation around zadd() adds angles | Entities and mobs |
Transformationorg.bukkit.util | The move, turn and scale of a display entity. | getTranslation() the shiftgetScale() the sizegetLeftRotation() the first rotation | Entities and mobs |
NumberConversionsorg.bukkit.util | Small number helpers. | floor() rounds down to a whole numbersquare() multiplies a number by itselfround() 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.
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
- java/com/example/refapimaptour/Package com.example.refapimaptour
- 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
- src/main/
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}- Category Events. Paper calls this method whenever a player joins.
- A helper method below that uses Saving data. It returns how many times this player has joined.
- Category Players and senders gives you the player, and World and blocks gives you the
Worldthey stand in. - A
Locationis a point in a world.distancemeasures the gap between two of them. - Category Text and colors. The text uses tags like
<green>, and eachPlaceholderfills one named hole. - Category Items. Three loaves of bread, given only on the very first visit.
- Category Effects, sounds and particles.
- Category Scheduling. Runs the code inside the parentheses 40 ticks (two seconds) later.
The helper method is where the saved data lives:
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
- java/com/example/refapimaptour/Package com.example.refapimaptour
- 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
- src/main/
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}- Every player carries a container of saved values. It is stored with the player, so it survives restarts.
- Reads the saved number, or uses 0 if the player has never been counted. Then we add one.
- Writes the new total back.
A returning player sees this in chat, and the action bar message follows two seconds later:
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.
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
Hint 2
Hint 3
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).
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
- java/com/example/refapimapexercise/Package com.example.refapimapexercise
- 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
- src/main/
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}- 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.
- 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.bukkitare the classic API.io.papermc.paperis Paper's own additions.net.kyori.adventureis text.com.mojang.brigadieris 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
You want to save how many times a player joined, so it survives a restart. Which category do you open?
Saved values live in aPersistentDataContainer, listed under Saving data. A scoreboard shows numbers but is not the right place to store them for good.What does the import line
import org.bukkit.entity.Player;tell you?The last part of a full name is the class, and everything before it is the package. Adventure classes start withnet.kyori.adventure.Which family of packages holds Paper's own additions to the API?
org.bukkitis the classic API that Paper started from, andcom.mojang.brigadieris the command library. Paper's new things are underio.papermc.paper.In the tables, what does a name written like
CREATIVEmean?Methods end with()in the tables and start with a lowercase letter. ALL_CAPITALS names are constants such asGameMode.CREATIVE.Which class do you extend to make your plugin's main class?
JavaPluginis the base class for a main class.PluginManagerregisters listeners, andBukkitis a shortcut to the server.
Next steps
- Copy ready-made one-liners from the Paper cheat sheet.
- Learn how a class and its methods fit together in Classes and objects.
- Follow a full plugin from the start in Your first plugin.