mineflayer-pvp

Adds support for basic PVP and PVE to Mineflayer bots.

Usage no npm install needed!

<script type="module">
  import mineflayerPvp from 'https://cdn.skypack.dev/mineflayer-pvp';
</script>

README

mineflayer-pvp

A lightweight plugin for Mineflayer that makes it easier to manage PVP and PVE actions.


Getting Started

This plugin is built using Node and can be installed using:

npm install --save mineflayer-pvp

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

Simple Bot

The brief description goes here.

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

Examples

Video Tutorial:

License

This project uses the MIT 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.