From 45003238884eb5b308c86c0897258c68cf18825a Mon Sep 17 00:00:00 2001 From: dueris Date: Sat, 20 Jul 2024 13:17:49 -0700 Subject: [PATCH] Fix apoli:attacker damage condition null --- .../factory/conditions/types/DamageConditions.java | 1 + .../src/main/java/me/dueris/originspaper/util/LangFile.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/origins/src/main/java/me/dueris/originspaper/factory/conditions/types/DamageConditions.java b/origins/src/main/java/me/dueris/originspaper/factory/conditions/types/DamageConditions.java index 5300a9b37..c9945b766 100644 --- a/origins/src/main/java/me/dueris/originspaper/factory/conditions/types/DamageConditions.java +++ b/origins/src/main/java/me/dueris/originspaper/factory/conditions/types/DamageConditions.java @@ -48,6 +48,7 @@ public void registerConditions() { return false; })); register(new ConditionFactory(OriginsPaper.apoliIdentifier("attacker"), (data, damageEvent) -> { + if (damageEvent.getDamageSource() == null || damageEvent.getDamageSource().getDirectEntity() == null) return false; Entity attacker = new DamageSource(nmsDamageSource(damageEvent).typeHolder(), ((CraftEntity) damageEvent.getDamageSource().getDirectEntity()).getHandle()).getEntity(); if (attacker instanceof LivingEntity) { return !data.isPresent("entity_condition") || ConditionExecutor.testEntity(data.getJsonObject("entity_condition"), attacker.getBukkitEntity()); diff --git a/origins/src/main/java/me/dueris/originspaper/util/LangFile.java b/origins/src/main/java/me/dueris/originspaper/util/LangFile.java index 02693295b..aeb9ec09c 100644 --- a/origins/src/main/java/me/dueris/originspaper/util/LangFile.java +++ b/origins/src/main/java/me/dueris/originspaper/util/LangFile.java @@ -28,4 +28,7 @@ public ResourceLocation key() { return this.key; } + public Map getLangMap() { + return langMap; + } }