From 77919b70b2c6fb56f56912324a35d29f8c91c7d8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 5 Jul 2019 16:20:56 +0100 Subject: [PATCH] Stop cloning Color objects since these are now immutable, there's no need to clone them. --- src/pocketmine/entity/effect/Effect.php | 6 +----- src/pocketmine/entity/effect/EffectInstance.php | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/entity/effect/Effect.php b/src/pocketmine/entity/effect/Effect.php index 28832b175..5774c338a 100644 --- a/src/pocketmine/entity/effect/Effect.php +++ b/src/pocketmine/entity/effect/Effect.php @@ -279,7 +279,7 @@ class Effect{ * @return Color */ public function getColor() : Color{ - return clone $this->color; + return $this->color; } /** @@ -350,8 +350,4 @@ class Effect{ public function remove(Living $entity, EffectInstance $instance) : void{ } - - public function __clone(){ - $this->color = clone $this->color; - } } diff --git a/src/pocketmine/entity/effect/EffectInstance.php b/src/pocketmine/entity/effect/EffectInstance.php index 2619a73d1..4da94f602 100644 --- a/src/pocketmine/entity/effect/EffectInstance.php +++ b/src/pocketmine/entity/effect/EffectInstance.php @@ -198,7 +198,7 @@ class EffectInstance{ * @return Color */ public function getColor() : Color{ - return clone $this->color; + return $this->color; } /** @@ -209,7 +209,7 @@ class EffectInstance{ * @return EffectInstance */ public function setColor(Color $color) : EffectInstance{ - $this->color = clone $color; + $this->color = $color; return $this; }