Skip to content

Commit

Permalink
Adding null check for Tameable owner
Browse files Browse the repository at this point in the history
The (Tameable).getOwner() is @nullable and would cause an issue when trying to match a null owner with the event's @NotNull player.
  • Loading branch information
CoolLord22 committed Dec 5, 2021
1 parent d9e09df commit 2ce5300
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void onTeleport(PlayerTeleportEvent event) {
toSendError = true;
}
if(ent instanceof Tameable && event.getPlayer().hasPermission("otheranimalteleport.player.teleportpets")) {
if(((Tameable) ent).isTamed() && ((Tameable) ent).getOwner().equals(event.getPlayer())) {
if(((Tameable) ent).isTamed() && ((Tameable) ent).getOwner() != null && ((Tameable) ent).getOwner().equals(event.getPlayer())) {
if(ent instanceof Sittable && !((Sittable) ent).isSitting()) {
try {
plugin.log.logInfo("Attempting to send pet entity: " + ent.getType() + ".", Verbosity.HIGHEST);
Expand Down

0 comments on commit 2ce5300

Please sign in to comment.