Make getBaritoneForPlayer null-safe

This commit is contained in:
Brady 2019-10-04 09:20:26 -05:00
parent 3a3d880d81
commit bfd8773efa
No known key found for this signature in database
GPG Key ID: 73A788379A197567

View File

@ -21,6 +21,7 @@ import baritone.api.cache.IWorldScanner;
import net.minecraft.client.entity.EntityPlayerSP;
import java.util.List;
import java.util.Objects;
/**
* Provides the present {@link IBaritone} instances
@ -57,7 +58,7 @@ public interface IBaritoneProvider {
*/
default IBaritone getBaritoneForPlayer(EntityPlayerSP player) {
for (IBaritone baritone : getAllBaritones()) {
if (player.equals(baritone.getPlayerContext().player())) {
if (Objects.equals(player, baritone.getPlayerContext().player())) {
return baritone;
}
}