Download Player Events — Minecraft Mods — MetaMods

Player Events

Active

Downloads

20

Last update

2 years ago

Versions

1.16 — 1.20.1
Server
Fabric
Quilt
Utils

Player Events

Player Events is a server-side Fabric mod that allows configuring automatic command execution and message sending for various player actions. The mod works exclusively on the server side and does not require installation on clients.

Main Features

The mod responds to various player-related events:

  • Player death - action execution upon death
  • First join - special greetings for newcomers
  • Regular join - standard greetings
  • Entity kill - reactions to mob elimination
  • Player kill - messages about PvP encounters
  • Server disconnect - farewell messages
  • Custom commands - creating custom triggers

Configuration Setup

All settings are stored in the config/player_events.json file. Here's a configuration example:

{
  "death": {
    "actions": [
      "${player} just died!"
    ],
    "broadcast_to_everyone": true,
    "pick_message_randomly": false
  },
  "first_join": {
    "actions": [
      "Welcome to the server ${player}! Remember to read the rules"
    ],
    "broadcast_to_everyone": false,
    "pick_message_randomly": false
  },
  "join": {
    "actions": [
      "Welcome ${player}",
      "/say Hello ${player}"
    ],
    "broadcast_to_everyone": true,
    "pick_message_randomly": false
  }
}

Variables and Tokens

You can use special tokens in messages that are automatically replaced with corresponding values:

  • ${player} - name of the player who triggered the event
  • ${killedEntity} - killed entity
  • ${killedPlayer} - killed player

Additional properties are available via dot notation:

  • display - displayed name (as in player list)
  • uuid - unique identifier
  • x, y, z - player coordinates

Additional Features

Since version 2.2.0, new capabilities are available:

  • Datapack support through function tags #player_events:<event>
  • Random message selection from lists
  • Color code formatting support

Management Commands

  • /pe reload or /player_events reload - configuration reload
  • /pe test <event> - testing specific event
  • /pe test * - testing all events

Version 2.2.0 Events

  • death - player death
  • first_join - first connection
  • join - regular connection
  • kill_entity - entity kill
  • kill_player - player kill
  • leave - server disconnect
  • custom_commands - custom commands

Troubleshooting

"Invalid JSON syntax" - check double quotes in commands and escape them using \".

"Invalid escape sequence" - add an additional backslash before special characters.

For Developers

The mod provides API for integration with other mods. To add dependency, use:

repositories {
    maven {
        url 'https://maven.bymartrixx.me'
} } dependencies { modImplementation "me.bymartrixx.player-events:api:2.1.3" }

Example of using events:

public class FooMod implements DedicatedServerModInitializer {
    public void onInitializeServer() {
        PlayerDeathCallback.EVENT.register((player, source) -> {
            // Your code here
        });

        PlayerKillEntityCallback.EVENT.register((player, killedEntity) -> {
            // Your code here
        });
    }
}
Project members
IotaBread

IotaBread

Developer

ByMartrixX22

ByMartrixX22

Created: 27 Oct 2020

ID: 2411