Skip to content

Commit

Permalink
fix(reach): ensure hitEntity is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
tutinoko2048 authored Aug 31, 2024
1 parent 2b442e0 commit d8dff76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/modules/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MAX_REACH_THRESHOLD = 30;
export function reachA(ev) { // attacking
if (!config.reachA.state) return;
const { damagingEntity: attacker, hitEntity } = ev;
if (!hitEntity || !(attacker instanceof Player) || Util.isCreative(attacker) || Util.isOP(attacker)) return;
if (!hitEntity?.isValid() || !(attacker instanceof Player) || Util.isCreative(attacker) || Util.isOP(attacker)) return;
if (
(config.reachA.excludeCustomEntities && !hitEntity.typeId.startsWith('minecraft:')) ||
config.reachA.excludeEntities.includes(hitEntity.typeId)
Expand Down

0 comments on commit d8dff76

Please sign in to comment.