Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jurasciix/advancedevents
A PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes.
https://github.com/jurasciix/advancedevents
events php php-attibutes php8 plugin pmmp pmmp-plugin pmmp-plugins pmmp-virion pocketmine-mp poggit
Last synced: 3 months ago
JSON representation
A PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes.
- Host: GitHub
- URL: https://github.com/jurasciix/advancedevents
- Owner: JuraSciix
- License: apache-2.0
- Created: 2022-05-24T05:34:22.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-27T06:26:56.000Z (over 2 years ago)
- Last Synced: 2024-09-26T10:21:50.438Z (3 months ago)
- Topics: events, php, php-attibutes, php8, plugin, pmmp, pmmp-plugin, pmmp-plugins, pmmp-virion, pocketmine-mp, poggit
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AdvancedEvents
This is a [PocketMine-MP](https://github.com/pmmp/PocketMine-MP) plugin that allows you to comfortably working with the events using a new piece of PHP 8 power — [attributes](https://www.php.net/manual/language.attributes.overview.php).
*Inspired by [qPexLegendary's CoolEventListener](https://github.com/qPexLegendary/CoolEventListener).*
## Examples
Below is a simple example of a plugin with an event listener using the [AdvancedEvents](https://github.com/JuraSciix/AdvancedEvents).
```php
getPlayer()->sendMessage("Welcome!");
}
// You can combine the handling of several events at once
#[EventHandler]
private function onBlockPlaceOrBreak(BlockPlaceEvent|BlockBreakEvent $event): void {
// Cancel the event and send a message to the player who initiated the event.
$event->cancel();
$event->getPlayer()->sendPopup("Pls don't do that.");
}
}
```