# mineflayer-pvp

> Adds support for basic PVP and PVE to Mineflayer bots.

Latest version **1.3.2** (published 2022-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install mineflayer-pvp
pnpm add mineflayer-pvp
yarn add mineflayer-pvp
bun add mineflayer-pvp
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2022-07-03 |
| First published | 2020-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 22.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 72 |
| Author | TheDudeFromCI |
| Maintainers | thedudefromci |
| Keywords | mineflayer, plugin, template |

## Links

- npm: https://www.npmjs.com/package/mineflayer-pvp
- Repository: https://github.com/TheDudeFromCI/mineflayer-pvp
- Homepage: https://github.com/TheDudeFromCI/mineflayer-pvp#readme
- Issues: https://github.com/TheDudeFromCI/mineflayer-pvp/issues
- npm.io page: https://npm.io/package/mineflayer-pvp

## Dependencies (3)

- [mineflayer](https://npm.io/package/mineflayer.md) ^4.0.0
- [mineflayer-utils](https://npm.io/package/mineflayer-utils.md) ^0.1.4
- [mineflayer-pathfinder](https://npm.io/package/mineflayer-pathfinder.md) ^2.0.0

## Recent versions

- 1.3.2 (latest) — 2022-07-03
- 1.3.1 — 2022-07-03
- 1.2.1 — 2022-02-13
- 1.2.0 — 2022-02-13
- 1.0.2 — 2020-10-12
- 1.0.1 — 2020-10-09

## README

<h1 align="center">mineflayer-pvp</h1>
<p align="center"><i>A lightweight plugin for Mineflayer that makes it easier to manage PVP and PVE actions.</i></p>

<p align="center">
  <img src="https://github.com/TheDudeFromCI/mineflayer-plugin-template/workflows/Build/badge.svg" />
  <img src="https://img.shields.io/npm/v/mineflayer-pvp" />
  <img src="https://img.shields.io/github/repo-size/TheDudeFromCI/mineflayer-pvp" />
  <img src="https://img.shields.io/npm/dm/mineflayer-pvp" />
  <img src="https://img.shields.io/github/contributors/TheDudeFromCI/mineflayer-pvp" />
  <img src="https://img.shields.io/github/license/TheDudeFromCI/mineflayer-pvp" />
</p>

---

### Getting Started

This plugin is built using Node and can be installed using:
```bash
npm install --save mineflayer-pvp
```

**Plugin Dependencies**
These plugins must be loaded using `bot.loadPlugin` in order to use this plugin.

* [**mineflayer-pathfinder**](https://github.com/Karang/mineflayer-pathfinder)

### Simple Bot

The brief description goes here.

```js
const mineflayer = require('mineflayer')
const { pathfinder, Movements, goals } = require('mineflayer-pathfinder')
const pvp = require('mineflayer-pvp').plugin

const bot = mineflayer.createBot({ 'Guard' })

bot.loadPlugin(pathfinder)
bot.loadPlugin(pvp)

bot.on('chat', (username, message) => {
  if (message === 'fight me') {
    const player = bot.players[username]

    if (!player) {
      bot.chat("I can't see you.")
      return
    }

    bot.pvp.attack(player.entity)
  }

  if (message === 'stop') {
    bot.pvp.stop()
  }
})
```

### Documentation

[API](https://github.com/TheDudeFromCI/mineflayer-pvp/blob/master/docs/api.md)

[Examples](https://github.com/TheDudeFromCI/mineflayer-pvp/tree/master/examples)

**Video Tutorial:**

<a href="https://youtu.be/Giu0ADA5uo8"><img src="https://img.youtube.com/vi/Giu0ADA5uo8/hqdefault.jpg" width="256" /></a>

### License

This project uses the [MIT](https://github.com/TheDudeFromCI/mineflayer-pvp/blob/master/LICENSE) license.

### Contributions

This project is accepting PRs and Issues. See something you think can be improved? Go for it! Any and all help is highly appreciated!

For larger changes, it is recommended to discuss these changes in the issues tab before writing any code. It's also preferred to make many smaller PRs than one large one, where applicable.

---
_Source: https://npm.io/package/mineflayer-pvp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
