PHPackages                             cosmicpe/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. cosmicpe/npcdialogue

ActiveLibrary

cosmicpe/npcdialogue
====================

A PocketMine-MP library for making NPC dialogues

0.1.3(5d ago)31696[3 issues](https://github.com/Cosmoverse/NpcDialogue/issues)[1 PRs](https://github.com/Cosmoverse/NpcDialogue/pulls)GPL-3.0-onlyPHPPHP ^8.1

Since Aug 7Pushed 5d ago1 watchersCompare

[ Source](https://github.com/Cosmoverse/NpcDialogue)[ Packagist](https://packagist.org/packages/cosmicpe/npcdialogue)[ RSS](/packages/cosmicpe-npcdialogue/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (3)Versions (8)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

47

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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.

###  Release Activity

Cadence

Every ~190 days

Recently: every ~232 days

Total

6

Last Release

5d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/247134f60bf8c5c7c8a2f06b0ecea431a052614283aac5093b57bde51039e34a?d=identicon)[muqsit](/maintainers/muqsit)

---

Top Contributors

[![Muqsit](https://avatars.githubusercontent.com/u/15074389?v=4)](https://github.com/Muqsit "Muqsit (18 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")[![SmallkingDev](https://avatars.githubusercontent.com/u/57811430?v=4)](https://github.com/SmallkingDev "SmallkingDev (1 commits)")

---

Tags

librarypmmppocketmine-mpvirion

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sof3/libasynql

1427.8k3](/packages/sof3-libasynql)[muqsit/invmenu

A PocketMine-MP virion to create and manage virtual inventories!

2223.8k1](/packages/muqsit-invmenu)[muqsit/simple-packet-handler

Handle specific data packets (virion for PMMP API 4.0.0)

425.5k3](/packages/muqsit-simple-packet-handler)[dktapps/pmforms

Form API library for PocketMine-MP plugins

522.2k1](/packages/dktapps-pmforms)[sof3/infoapi

321.2k1](/packages/sof3-infoapi)[muqsit/asynciterator

A virion that simplifies writing tasks that traverse iterators

182.9k](/packages/muqsit-asynciterator)

PHPackages © 2026

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