A PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes.

Overview

AdvancedEvents

This is a PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes.

Inspired by qPexLegendary's CoolEventListener.

Examples

Below is a simple example of a plugin with a listener using the AdvancedEvents.

<?php

use JuraSciix\AdvancedEvents\Attribute\EventHandler;
use JuraSciix\AdvancedEvents\AdvancedEvents;
use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\event\EventPriority;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\plugin\PluginBase;

// There is no need to implement the \pocketmine\event\Listener interface.
// Implementation makes sense only if you need to inform the code reader that class handles events.
class Example extends PluginBase /*implements Listener*/ {

    protected function onEnable(): void {
        // Register this class as a listener on behalf of this plugin.
        AdvancedEvents::registerEvents($this, $this);
    }

    // The method that handles certain events is detected by the EventHandler attribute, unlike PM-MP.
    // In other words, this attribute is required for each method that handles events.
    #[EventHandler(priority: EventPriority::LOWEST)]
    private function onPlayerJoin(PlayerJoinEvent $event): void {
        // Due to the LOWEST priority, we are not required to perform various checks here.
        $event->getPlayer()->sendMessage("Welcome!");
    }
    
    // You can combine the handling of several events at once
    #[EventHandler]
    private function onBlockPlaceOrBreak(BlockPlaceEvent|BlockBreakEvent $event): void {
        $event->cancel();
        $event->getPlayer()->sendMessage("Pls don't do this.");
    }
}
You might also like...
This is a simple PHP Student Portal. You can login, logout, register, and view your details.
This is a simple PHP Student Portal. You can login, logout, register, and view your details.

Student-Portal This is a simple PHP Student Portal with a MySQL Database. I made this as part of a university assignment, so you can login, logout, re

PocketMine-MP plugin that adds new blocks to the server!

CustomBlockLoader PocketMine-MP plugin that adds new blocks to the server! Reference This plugin is experimental. We are not responsible for any probl

A bundle to handle encoding and decoding of parameters using OpenSSL and Doctrine lifecycle events.

SpecShaper Encrypt Bundle A bundle to handle encoding and decoding of parameters using OpenSSL and Doctrine lifecycle events. Features include: Master

An advanced plugin to manage events when the player enters the server!

⭐ • Better Join Version Status Date 1.0.0 stable-dev 12/10/2022 📫 • General: Plugin Introduction: This is an advanced player input management plugin

Talkino allows you to integrate multi social messengers and contact into your website and enable your users to contact you using multi social messengers' accounts.

Talkino Welcome to our GitHub Repository Talkino is a click to chat plugin to show your agents’ multiple social messengers, phone and emails on the ch

Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server
Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server

Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server. How to use You just have to setup an id in the config.yml. Plac

Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily.

Fly50W is a new language which helps you build simple apps using more than 500k lines of code easily. Installation

actionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers.

FactionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers. It includes all the basic functionality of a faction plugin and data storage in MySQL or SQLITE. This is done by adding an extension system and a translation system. FactionMaster has a will of accessibility to the players and especially not to have to remember a lot of commands to play, all is done via interface.

A MCPE server software that backporting new Minecraft: Bedrock Edition to older PocketMine versions with better stability and performance.
A MCPE server software that backporting new Minecraft: Bedrock Edition to older PocketMine versions with better stability and performance.

CoarseMC is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

Owner
JuraSciix
JuraSciix
Creating data transfer objects with the power of php objects. No php attributes, no reflection api, and no other under the hook work.

Super Simple DTO Creating data transfer objects with the power of php objects. No php attributes, no reflection api, and no other under the hook work.

Mohammed Manssour 8 Jun 8, 2023
A Pocketmine-MP plugin to add King Of The Hill events to your server.

KOTH KOTH is an event popular on HCF and Faction servers. This plugin lets you add this minigame to you server. Support For questions, please join the

ItsMax123 9 Sep 17, 2022
HLedger is cross-platform accounting software for both power users and folks new to accounting

HLedger Plain Text Accounting on Nextcloud HLedger is cross-platform accounting software for both power users and folks new to accounting. It's good f

Ryan Boder 11 Jan 20, 2022
A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP

General A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP Contacts You can cont

NhanAZ's PocketMine-MP Plugins 10 Sep 27, 2022
A plugin manager for PocketMine-MP downloads plugin from PocketMine-MP official plugin repository

oh-my-pmmp A plugin manager for PocketMine-MP Getting Started Prerequisites Your server MUST RUN the latest version of PocketMine. Installation From P

thebigcrafter 6 Jan 4, 2023
Allows reflection of object attributes, including inherited and non-public ones

sebastian/object-reflector Allows reflection of object attributes, including inherited and non-public ones. Installation You can add this library as a

Sebastian Bergmann 6k Jan 4, 2023
Yab copy to new - A Textpattern plugin. Copies the current article content to a new one.

yab_copy_to_new Displays a new button in article write tab to copy the current article to a new one. Version: 0.2 Table of contents Plugin requirement

Tommy Schmucker 2 Dec 15, 2017
A useful PocketMine-MP plugin that allows you to create crates in-game!

ComplexCrates A useful PocketMine-MP plugin that allows you to create crates in-game! Commands Main command: /crate Sub commands: create

Oğuzhan 8 Aug 26, 2021
A PocketMine-MP plugin that allows you to mute players permanently and for a specific time.

BetterMute - v1.1.1 A PocketMine-MP plugin that allows you to mute players permanently and for a specific time. Features easy mute players permanent o

supercrafter333 7 Dec 21, 2022