mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Multiple permissions checked in Server::getInstance()
This is done like the one in `Command::testPermissionSilent()`, where permissions are connected via semicolons (`;`) and they are checked with `OR`, where the player must have at least one permission to read.
This commit is contained in:
parent
3bd33a129f
commit
f202c9902a
@ -1476,20 +1476,23 @@ class Server{
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param string $permission
|
||||
* @param string $permissions
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function broadcast($message, $permission){
|
||||
$count = 0;
|
||||
public function broadcast($message, $permissions){
|
||||
$recipients = [];
|
||||
foreach(explode(";", $permissions) as $permission){
|
||||
foreach($this->pluginManager->getPermissionSubscriptions($permission) as $permissible){
|
||||
if($permissible instanceof CommandSender and $permissible->hasPermission($permission)){
|
||||
$permissible->sendMessage($message);
|
||||
++$count;
|
||||
$recipients[spl_object_hash($permissible)] = $permissible; // do not send messages directly, or some might be repeated
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
foreach($recipients as $recipient){
|
||||
$recipient->sendMessage($message);
|
||||
}
|
||||
return count($recipients);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user