mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies. The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
This commit is contained in:
@ -87,7 +87,7 @@ class Bow extends Tool{
|
||||
$ev->setCancelled();
|
||||
}
|
||||
|
||||
$player->getServer()->getPluginManager()->callEvent($ev);
|
||||
$ev->call();
|
||||
|
||||
$entity = $ev->getProjectile(); //This might have been changed by plugins
|
||||
|
||||
@ -104,7 +104,8 @@ class Bow extends Tool{
|
||||
}
|
||||
|
||||
if($entity instanceof Projectile){
|
||||
$player->getServer()->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($entity));
|
||||
$projectileEv = new ProjectileLaunchEvent($entity);
|
||||
$projectileEv->call();
|
||||
if($projectileEv->isCancelled()){
|
||||
$ev->getProjectile()->flagForDespawn();
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user