Skip to content

tuanzisama/mineflayer-death-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mineflayer-death-event

Emit player death event in Mineflayer.

GitHub stars GitHub license Rate on Openbase

NPM

简体中文 文档

Install

npm install mineflayer-death-event --save

or

yarn add mineflayer-death-event

Example

const mineflayer = require("mineflayer")
const deathEvent = require("mineflayer-death-event")

const bot = mineflayer.createBot({
  host: "mc.example.com",
  username: "testbot"
})

// Load the plugin
bot.loadPlugin(deathEvent)

bot.on("playerDeath", (data) => {
    console.log(data);
});

Example Code

Event

mineflayer-death-event will emit a event when player die. The event name is playerDeath.

victim

Attacker. Interface see Entity.

offender

The player being attacked. Interface see Entity.

module will export two constants. You can Determine the type of variable "type"

const { DEATH_ENTITY_TYPE_MOB, DEATH_ENTITY_TYPE_PLAYER } = require("mineflayer-death-event");

weapon

The weapon used to kill the attacked player. Interface see Weapon.

method

offender death method.

Interface

Entity

property type description
type String Is player or mob/entity
id String Player UUID
detail Function If type not is "mob", then will return Mineflayer player interface (source)
raw Function Original value, from message event

Weapon

property type description
assetId String Weapon's Minecraft asset ID
tag String Weapon's tag
mame String Weapon's mame, This is usually named after the anvil
raw Function Original value, from message event
tagToJSON Function Parse and simplify weapon tag

About

Emit player death event in Mineflayer.

Resources

License

Stars

Watchers

Forks