GC-spigot / AdvancedEnchantments

Superior Custom Enchantments Creator for Minecraft And Spigot platform
153 stars 61 forks source link

AOE Targeting BYPASSING PVP PROTECTIONS in several cases. #4625

Closed slyleight closed 1 month ago

slyleight commented 1 month ago

Describe the bug

I changed the Deranged enchantment to make it strike real lightning with - LIGHTNING:true, but when I uploaded it to our main server, I realized that the - LIGHTNING:true **@Aoe{radius=5,target=damageable}** target does not check the damageable property at all.

I noticed this issue after adding damage effects to AOE targets. This caused players in claims or WorldGuard regions with PvP disabled to still take damage.

Deranged

'5':
      chance: 15
      cooldown: 5
      effects:
      - LIGHTNING:true @Aoe{radius=5,target=damageable}

Shockwave Plus

'10':
      chance: 50
      cooldown: 15
      conditions:
      - '%victim health percentage% > 30 : %stop%'
      - '%souls on item% < 50 : %stop%'
      effects:
      - REMOVE_SOULS:50 @Self
      - PULL_AWAY:3.5 @Attacker
      - PULL_AWAY:3.5 @Aoe{r=3,target=damageable}
      - PLAY_SOUND_OUTLOUD:ENTITY_ENDERMAN_TELEPORT:0:16:0
      - PARTICLE:SONIC_BOOM:10:0.5

Cleave

'7':
      chance: 10
      cooldown: 10
      effects:
      - DO_HARM:<math>%raw damage% * 0.2</math> @Aoe{radius=5,target=damageable}

PS: Is it possible to add a target that only targets players, similar to mobs but with separate damageable settings?

How to reproduce

Screenshots / Videos

https://streamable.com/yjy8f5

"/ae plinfo" link

https://paste.md-5.net/qahefuyeni

Server Log

No response

ThomasWega commented 1 month ago

We just check if the damage event is cancelled for these entities. If some plugin doesn't cancel the event or does that too late, there is not much we can do there. I will however try to investigate. Are you able to provide some effects which work okay with damageable/undamageable

slyleight commented 1 month ago

I don't think it is event specific, I checked every effect with aoe. Only if we set the target to mobs, it actually works on mobs (but mobs inside the protected area can get affected when the conditions are right. More on that below..

So all of it is bugged...

(I checked every enchantment we have and yeah, it fails to check for some reason.)

(Target=damageable)

(Target=mobs) (This one is a problematic one if you set the conditions right, ex. placing a villager 1 block next to where your claim ends and if another player attacks an entity outside your claim, your villager in claim can get damaged too if it is in aoe radius.)

Electrocution (Big problem if Boss mob deals 300 raw damage with special attack and it might kill players in a PVP disabled area)

    '4':
      chance: 6
      cooldown: 10
      conditions:
      - '%souls on item% < 20 : %stop%'
      effects:
      - REMOVE_SOULS:20 @Self
      - DECREASE_DAMAGE:20
      - PARTICLE:ELECTRIC_SPARK:70:2  @Aoe{radius=3,target=DAMAGEABLE,limit=4}
      - DO_HARM:<math>%raw damage% * 0.05</math> @Aoe{radius=3,target=DAMAGEABLE,limit=4}

Here is horrify

'5':
      chance: 5
      cooldown: 120
      effects:
      - POTION:CONFUSION:23:40 @Aoe{r=32,t=damageable}
      - POTION:SLOW:23:40 @Aoe{r=32,t=damageable}
      - POTION:SLOW_DIGGING:23:40 @Aoe{r=32,t=damageable}
      - MESSAGE:§4§l** HORRIFY ** @Aoe{r=32,t=damageable}

I would like to point out while I was in godmode or gamemode creative, I also got the effect from Horrify too. In theory it shouldn't effect me right? I'm in godmode or gamemode creative. But some reason I also got the effect.

This was not a big deal until I used @Aoe in both for mobs and players at the same time. As I said before, while in dungeon, PVP is disabled in Worldguard Flags, but when I attack the dungeon mobs, players are also got targeted.

I believe there is nothing I can do other than remove these enchants since they cause unintended effects on players who are not in PVP.

ThomasWega commented 1 month ago

Will be fixed in the next update