2121use pocketmine \network \mcpe \protocol \types \entity \EntityMetadataCollection ;
2222use pocketmine \network \mcpe \protocol \types \entity \EntityMetadataProperties ;
2323use pocketmine \network \mcpe \protocol \types \entity \PropertySyncData ;
24+ use Throwable ;
2425
2526/**
2627* Class BossBar
@@ -95,7 +96,7 @@ public function addPlayer(Player $player): static {
9596 $ this ->sendBossPacket ([$ player ]);
9697 $ this ->players [$ player ->getId ()] = $ player ;
9798 }
98- } catch (\ Throwable $ e ) {
99+ } catch (Throwable $ e ) {
99100 GlobalLogger::get ()->logException ($ e );
100101 }
101102 return $ this ;
@@ -111,7 +112,7 @@ public function addPlayers(array $players): static {
111112 foreach ($ players as $ player ) {
112113 $ this ->addPlayer ($ player );
113114 }
114- } catch (\ Throwable $ e ) {
115+ } catch (Throwable $ e ) {
115116 GlobalLogger::get ()->logException ($ e );
116117 }
117118 return $ this ;
@@ -131,7 +132,7 @@ public function removePlayer(Player $player): static {
131132 } else {
132133 GlobalLogger::get ()->debug ("Removed player that was not added to the boss bar ( " . $ this . ") " );
133134 }
134- } catch (\ Throwable $ e ) {
135+ } catch (Throwable $ e ) {
135136 GlobalLogger::get ()->logException ($ e );
136137 }
137138 return $ this ;
@@ -147,7 +148,7 @@ public function removePlayers(array $players): static {
147148 foreach ($ players as $ player ) {
148149 $ this ->removePlayer ($ player );
149150 }
150- } catch (\ Throwable $ e ) {
151+ } catch (Throwable $ e ) {
151152 GlobalLogger::get ()->logException ($ e );
152153 }
153154 return $ this ;
@@ -162,7 +163,7 @@ public function removeAllPlayers(): static {
162163 foreach ($ this ->getPlayers () as $ player ) {
163164 $ this ->removePlayer ($ player );
164165 }
165- } catch (\ Throwable $ e ) {
166+ } catch (Throwable $ e ) {
166167 GlobalLogger::get ()->logException ($ e );
167168 }
168169 return $ this ;
@@ -185,7 +186,7 @@ public function setTitle(string $title = ""): static {
185186 try {
186187 $ this ->title = $ title ;
187188 $ this ->sendBossTextPacket ($ this ->getPlayers ());
188- } catch (\ Throwable $ e ) {
189+ } catch (Throwable $ e ) {
189190 GlobalLogger::get ()->logException ($ e );
190191 }
191192 return $ this ;
@@ -208,7 +209,7 @@ public function setSubTitle(string $subTitle = ""): static {
208209 try {
209210 $ this ->subTitle = $ subTitle ;
210211 $ this ->sendBossTextPacket ($ this ->getPlayers ());
211- } catch (\ Throwable $ e ) {
212+ } catch (Throwable $ e ) {
212213 GlobalLogger::get ()->logException ($ e );
213214 }
214215 return $ this ;
@@ -236,7 +237,7 @@ public function setPercentage(float $percentage): static {
236237 $ percentage = min (1.0 , max (0.0 , $ percentage ));
237238 $ this ->getAttributeMap ()->get (Attribute::HEALTH )->setValue ($ percentage * $ this ->getAttributeMap ()->get (Attribute::HEALTH )->getMaxValue (), true , true );
238239 $ this ->sendBossHealthPacket ($ this ->getPlayers ());
239- } catch (\ Throwable $ e ) {
240+ } catch (Throwable $ e ) {
240241 GlobalLogger::get ()->logException ($ e );
241242 }
242243 return $ this ;
@@ -267,7 +268,7 @@ public function setColor(int $color): static {
267268 try {
268269 $ this ->color = $ color ;
269270 $ this ->sendBossPacket ($ this ->getPlayers ());
270- } catch (\ Throwable $ e ) {
271+ } catch (Throwable $ e ) {
271272 GlobalLogger::get ()->logException ($ e );
272273 }
273274 return $ this ;
@@ -284,7 +285,7 @@ public function hideFrom(array $players): void {
284285 $ player ->getNetworkSession ()->sendDataPacket (BossEventPacket::hide ($ this ->actorId ?? $ player ->getId ()));
285286 }
286287 }
287- } catch (\ Throwable $ e ) {
288+ } catch (Throwable $ e ) {
288289 GlobalLogger::get ()->logException ($ e );
289290 }
290291 }
@@ -351,7 +352,7 @@ public function setEntity(?Entity $entity = null): static {
351352 }
352353
353354 $ this ->sendBossPacket ($ this ->getPlayers ());
354- } catch (\ Throwable $ e ) {
355+ } catch (Throwable $ e ) {
355356 GlobalLogger::get ()->logException ($ e );
356357 }
357358 return $ this ;
@@ -368,7 +369,7 @@ public function resetEntity(bool $removeEntity = false): static {
368369 $ this ->getEntity ()->close ();
369370 }
370371 $ this ->setEntity ();
371- } catch (\ Throwable $ e ) {
372+ } catch (Throwable $ e ) {
372373 GlobalLogger::get ()->logException ($ e );
373374 }
374375 return $ this ;
@@ -424,7 +425,7 @@ protected function sendBossPacket(array $players): void {
424425 ));
425426 }
426427 }
427- } catch (\ Throwable $ e ) {
428+ } catch (Throwable $ e ) {
428429 GlobalLogger::get ()->logException ($ e );
429430 }
430431 }
@@ -440,7 +441,7 @@ protected function sendRemoveBossPacket(array $players): void {
440441 $ player ->getNetworkSession ()->sendDataPacket (BossEventPacket::hide ($ this ->actorId ?? $ player ->getId ()));
441442 }
442443 }
443- } catch (\ Throwable $ e ) {
444+ } catch (Throwable $ e ) {
444445 GlobalLogger::get ()->logException ($ e );
445446 }
446447 }
@@ -459,7 +460,7 @@ protected function sendBossTextPacket(array $players): void {
459460 ));
460461 }
461462 }
462- } catch (\ Throwable $ e ) {
463+ } catch (Throwable $ e ) {
463464 GlobalLogger::get ()->logException ($ e );
464465 }
465466 }
@@ -478,7 +479,7 @@ protected function sendBossHealthPacket(array $players): void {
478479 ));
479480 }
480481 }
481- } catch (\ Throwable $ e ) {
482+ } catch (Throwable $ e ) {
482483 GlobalLogger::get ()->logException ($ e );
483484 }
484485 }
0 commit comments