PHPackages                             blockbrawn/npcdialogue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. blockbrawn/npcdialogue

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

blockbrawn/npcdialogue
======================

A PocketMine-MP library for making NPC dialogues

010PHP

Since Mar 10Pushed 1y agoCompare

[ Source](https://github.com/BlockBrawn/NpcDialogue)[ Packagist](https://packagist.org/packages/blockbrawn/npcdialogue)[ RSS](/packages/blockbrawn-npcdialogue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

NpcDialogue
===========

[](#npcdialogue)

NpcDialogue is a PocketMine-MP library for creating NPC dialogues. The library is built for portability, letting developers build dialgoues without spawning (and handling despawning of) any entities whatsoever.

The library requires event handling and therefore a plugin must call `NpcDialogueManager::register()` on enable.

```
+use cosmicpe\npcdialogue\NpcDialogueManager;

protected function onEnable() : void{
+	if(!NpcDialogueManager::isRegistered()){
+		NpcDialogueManager::register($this);
+	}
}
```

Examples
--------

[](#examples)

### Building a simple dialogue

[](#building-a-simple-dialogue)

The library provides a builder class (`NpcDialogueBuilder`) to conveniently build NPC dialogue. NPC dialogues can be sent to players using `NPCDialogueManager::send()` once built.

```
use cosmicpe\npcdialogue\dialogue\texture\DefaultNpcDialogueTexture;
use cosmicpe\npcdialogue\NpcDialogueBuilder;
use cosmicpe\npcdialogue\NpcDialogueManager;
use pocketmine\player\Player;

$dialogue = NpcDialogueBuilder::create()
	->setName("Dialogue Name")
	->setText("This is an example dialogue.")
	->setDefaultNpcTexture(DefaultNpcDialogueTexture::TEXTURE_NPC_10)
	->addSimpleButton("Okay")
	->addSimpleButton("Whatever", function(Player $player) : void{
		$player->sendMessage("You clicked 'Whatever' button");
	})
	->setCloseListener(function(Player $player) : void{
		$player->sendMessage("You closed the dialogue");
	})
->build();
NpcDialogueManager::send($player, $dialogue);
```

[![img.png](resources-readme/example-1.png)](resources-readme/example-1.png)

### Building a dialogue with a pre-registered entity's texture

[](#building-a-dialogue-with-a-pre-registered-entitys-texture)

A pre-registered entity's entity identifier can be supplied to `NpcDialogueBuilder::setEntityNpcTexture()`.

```
use cosmicpe\npcdialogue\NpcDialogueBuilder;
use cosmicpe\npcdialogue\NpcDialogueManager;
use pocketmine\network\mcpe\protocol\types\entity\EntityIds;

NpcDialogueManager::send($player, NpcDialogueBuilder::create()
	->setName("Honey Bee")
	->setText(file_get_contents("bee_movie_script.txt"))
	->setEntityNpcTexture(EntityIds::BEE)
->build());
```

[![img.png](resources-readme/example-2.png)](resources-readme/example-2.png)

### Building a dialogue with a player's skin as texture

[](#building-a-dialogue-with-a-players-skin-as-texture)

A player skin (a `Skin` object) can be supplied to `NpcDialogueBuilder::setSkinNpcTexture()`.

```
use cosmicpe\npcdialogue\NpcDialogueBuilder;
use cosmicpe\npcdialogue\NpcDialogueManager;

NpcDialogueManager::send($player, NpcDialogueBuilder::create()
	->setName("This is YOU!")
	->setText("You have the power within you to overcome any obstacle that comes your way. You are resilient, capable, and determined to achieve greatness. Embrace the challenges, believe in yourself, and remember that every step you take brings you closer to your dreams. Keep pushing forward with unwavering determination, for the world awaits the extraordinary impact you're destined to make.")
	->setSkinNpcTexture($player->getSkin())
->build());
```

[![img.png](resources-readme/example-3.png)](resources-readme/example-3.png)

You can set 'portrait offset' of player skins to adjust scale of the texture.

```
use cosmicpe\npcdialogue\NpcDialogueBuilder;
use cosmicpe\npcdialogue\NpcDialogueManager;

$parent = NpcDialogueTextureOffset::defaultPlayerPortrait();
$portrait_offset = new NpcDialogueTextureOffset(2.0, 2.0, 2.0, $parent->translate_x, $parent->translate_y, $parent->translate_z);
NpcDialogueManager::send($player, NpcDialogueBuilder::create()
	->setName("This is YOU!")
	->setText("You have the power within you to overcome any obstacle that comes your way. You are resilient, capable, and determined to achieve greatness. Embrace the challenges, believe in yourself, and remember that every step you take brings you closer to your dreams. Keep pushing forward with unwavering determination, for the world awaits the extraordinary impact you're destined to make.")
	->setSkinNpcTexture($player->getSkin(), null, $portrait_offset)
->build());
```

[![img.png](resources-readme/example-4.png)](resources-readme/example-4.png)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/684077d2279601ba32ca600c352b6cb7934a12618293701b802a4e98abe34c7f?d=identicon)[Josscoder](/maintainers/Josscoder)

---

Top Contributors

[![Muqsit](https://avatars.githubusercontent.com/u/15074389?v=4)](https://github.com/Muqsit "Muqsit (16 commits)")[![Josscoder](https://avatars.githubusercontent.com/u/49004785?v=4)](https://github.com/Josscoder "Josscoder (7 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")

### Embed Badge

![Health badge](/badges/blockbrawn-npcdialogue/health.svg)

```
[![Health](https://phpackages.com/badges/blockbrawn-npcdialogue/health.svg)](https://phpackages.com/packages/blockbrawn-npcdialogue)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
