mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
NOTE! THIS SHOULD BE REVERTED LATER! Removed WeakRef dependency
This commit is contained in:
parent
d7d05c20a9
commit
34dc6ea0d6
@ -55,13 +55,6 @@ class MemoryManager{
|
||||
private $chunkCache;
|
||||
private $cacheTrigger;
|
||||
|
||||
/** @var \WeakRef[] */
|
||||
private $leakWatch = [];
|
||||
|
||||
private $leakInfo = [];
|
||||
|
||||
private $leakSeed = 0;
|
||||
|
||||
public function __construct(Server $server){
|
||||
$this->server = $server;
|
||||
|
||||
|
@ -410,11 +410,6 @@ namespace pocketmine {
|
||||
}
|
||||
}
|
||||
|
||||
if(!extension_loaded("Weakref") and !extension_loaded("weakref")){
|
||||
$logger->critical("Unable to find the Weakref extension.");
|
||||
++$errors;
|
||||
}
|
||||
|
||||
if(!extension_loaded("curl")){
|
||||
$logger->critical("Unable to find the cURL extension.");
|
||||
++$errors;
|
||||
|
@ -29,7 +29,7 @@ use pocketmine\utils\PluginException;
|
||||
|
||||
abstract class MetadataStore{
|
||||
/** @var \WeakMap[] */
|
||||
private $metadataMap = [];
|
||||
private $metadataMap;
|
||||
|
||||
/**
|
||||
* Adds a metadata value to an object.
|
||||
@ -48,8 +48,8 @@ abstract class MetadataStore{
|
||||
|
||||
$key = $this->disambiguate($subject, $metadataKey);
|
||||
if(!isset($this->metadataMap[$key])){
|
||||
$entry = new \WeakMap();
|
||||
$this->metadataMap[$key] = $entry;
|
||||
//$entry = new \WeakMap();
|
||||
$this->metadataMap[$key] = new \SplObjectStorage();//$entry;
|
||||
}else{
|
||||
$entry = $this->metadataMap[$key];
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ abstract class MetadataValue{
|
||||
private $owningPlugin;
|
||||
|
||||
protected function __construct(Plugin $owningPlugin){
|
||||
$this->owningPlugin = new \WeakRef($owningPlugin);
|
||||
$this->owningPlugin = $owningPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Plugin
|
||||
*/
|
||||
public function getOwningPlugin(){
|
||||
return $this->owningPlugin->get();
|
||||
return $this->owningPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -433,7 +433,7 @@ class PluginManager{
|
||||
if(!isset($this->permSubs[$permission])){
|
||||
$this->permSubs[$permission] = [];
|
||||
}
|
||||
$this->permSubs[$permission][spl_object_hash($permissible)] = new \WeakRef($permissible);
|
||||
$this->permSubs[$permission][spl_object_hash($permissible)] = $permissible;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -456,6 +456,7 @@ class PluginManager{
|
||||
*/
|
||||
public function getPermissionSubscriptions($permission){
|
||||
if(isset($this->permSubs[$permission])){
|
||||
return $this->permSubs[$permission];
|
||||
$subs = [];
|
||||
foreach($this->permSubs[$permission] as $k => $perm){
|
||||
/** @var \WeakRef $perm */
|
||||
@ -479,9 +480,9 @@ class PluginManager{
|
||||
*/
|
||||
public function subscribeToDefaultPerms($op, Permissible $permissible){
|
||||
if($op === true){
|
||||
$this->defSubsOp[spl_object_hash($permissible)] = new \WeakRef($permissible);
|
||||
$this->defSubsOp[spl_object_hash($permissible)] = $permissible;
|
||||
}else{
|
||||
$this->defSubs[spl_object_hash($permissible)] = new \WeakRef($permissible);
|
||||
$this->defSubs[spl_object_hash($permissible)] = $permissible;
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,6 +507,7 @@ class PluginManager{
|
||||
$subs = [];
|
||||
|
||||
if($op === true){
|
||||
return $this->defSubsOp;
|
||||
foreach($this->defSubsOp as $k => $perm){
|
||||
/** @var \WeakRef $perm */
|
||||
if($perm->acquire()){
|
||||
@ -516,6 +518,7 @@ class PluginManager{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return $this->defSubs;
|
||||
foreach($this->defSubs as $k => $perm){
|
||||
/** @var \WeakRef $perm */
|
||||
if($perm->acquire()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user