Skip to content

Commit

Permalink
Fix null entity in onUseEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueZeeKing committed Jun 20, 2024
1 parent bdd67b0 commit fbe5bcf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/io/icker/factions/core/InteractionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,14 @@ private static ActionResult onAttackEntity(PlayerEntity player, World world, Han
}

private static ActionResult onUseEntity(PlayerEntity player, Entity entity, World world) {
if (checkPermissions(player, entity.getBlockPos(), world,
Permissions.USE_ENTITIES) == ActionResult.FAIL) {
BlockPos pos;
if (entity == null) {
pos = player.getBlockPos();
} else {
pos = entity.getBlockPos();
}

if (checkPermissions(player, pos, world, Permissions.USE_ENTITIES) == ActionResult.FAIL) {
InteractionsUtil.warn(player, "use entities");
return ActionResult.FAIL;
}
Expand Down

0 comments on commit fbe5bcf

Please sign in to comment.