Skip to content

Commit

Permalink
Simply remove unneeded code :)
Browse files Browse the repository at this point in the history
  • Loading branch information
PEMapModder committed Aug 9, 2014
1 parent 757e5fd commit 683c9ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea/*
config.yml
config.yml
5 changes: 1 addition & 4 deletions src/HealthBar/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
use pocketmine\plugin\Plugin;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat;
use EssentialsPE\Loader as EssentialsPE;

class Loader extends PluginBase{
public $essentialspe;
private $canRemove;

public function onEnable(){
Expand All @@ -19,8 +17,7 @@ public function onEnable(){
$this->checkConfiguration();

$ess = $this->getServer()->getPluginManager()->getPlugin("EssentialsPE");
if($ess instanceof Plugin && $ess->isEnabled()){
$this->essentialspe = new \WeakRef($ess); // this plugin is not disabled when EssentialsPE is disabled, so keep a *weak* reference so that EssentialsPE can be properly garbaged on unload.
if($ess instanceof Plugin and $ess->isEnabled()){
$this->getServer()->getPluginManager()->registerEvents(new EssentialsPEEvents($this), $this);
}
}
Expand Down

9 comments on commit 683c9ad

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test it later, if fail I will revert :P hahaha Just kidding xD

@PEMapModder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStorm showed no usages of that field.

@PEMapModder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you ever wanna store a plugin in a field:

  • Prevent it
  • Use WeakRef if it isn't dependency

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well yes, at "OtherEvents" xD

@PEMapModder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStorm didn't detect it. You sure? I don't think you at all used that field.

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyways, I will try to use your way, thanks :D

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PEMapModder any ideas for MagicClock? also use something like this xD

@iksaku
Copy link
Contributor

@iksaku iksaku commented on 683c9ad Aug 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appears to work... I will release it ;)

Please sign in to comment.