Use EnumTrait->equals() instead of direct comparison

It's not guaranteed that objects provided are the same as those in the enum registry, so they can't be directly compared.

Implementing comparison with === would require some kind of __equals() implementation or an extension to hook into such functionality.
This commit is contained in:
Dylan K. Taylor
2019-05-24 17:21:44 +01:00
parent 9ce1e29a17
commit 3ea8da2dd3
10 changed files with 32 additions and 32 deletions

View File

@ -852,7 +852,7 @@ class NetworkSession{
* @return int
*/
public static function getClientFriendlyGamemode(GameMode $gamemode) : int{
if($gamemode === GameMode::SPECTATOR()){
if($gamemode->equals(GameMode::SPECTATOR())){
return GameMode::CREATIVE()->getMagicNumber();
}