Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Potion Effect Event #6532

Merged
Merged
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e04ce26
Entity Potion Effect Event and event-values
Asleeepp Apr 3, 2024
8189838
Updated syntax for EvtEntityPotion, and readded the imports to EventV…
Asleeepp Apr 7, 2024
569617a
Forgot to change e to event.
Asleeepp Apr 7, 2024
819253d
Added suggested changes :)
Asleeepp Apr 19, 2024
3a86677
silly me
Asleeepp Apr 19, 2024
d62816f
even sillier me (how did I manage to do that)
Asleeepp Apr 19, 2024
3e72634
even sillier me (how did I manage to do that)
Asleeepp Apr 19, 2024
dfe02ab
I don't get why the build is failing
Asleeepp Apr 19, 2024
8ab5484
BRO
Asleeepp Apr 19, 2024
ac1151d
Merge branch 'dev/feature' into addition-entity-potion-effect-event
sovdeeth Apr 19, 2024
8a9b8ee
Merge branch 'dev/feature' into addition-entity-potion-effect-event
sovdeeth Apr 19, 2024
20e990b
Added type stuff, and made check a lot better
Asleeepp Apr 20, 2024
6cdbfef
Merge remote-tracking branch 'origin/addition-entity-potion-effect-ev…
Asleeepp Apr 20, 2024
180f9b3
Changes
Asleeepp Apr 20, 2024
1dcbf6a
change
Asleeepp Apr 20, 2024
2d8e5f7
Merge branch 'dev/feature' into addition-entity-potion-effect-event
sovdeeth Jun 29, 2024
723e288
done
Asleeepp Jul 1, 2024
dcdd8d4
resolve conflict
Asleeepp Jul 1, 2024
ea0518f
Update src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
Asleeepp Aug 16, 2024
99467ae
Merge branch 'dev/feature' into addition-entity-potion-effect-event
Asleeepp Aug 16, 2024
68cd6a1
Merge branch 'dev/feature' into addition-entity-potion-effect-event
sovdeeth Sep 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/java/ch/njol/skript/events/EvtEntityPotion.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ public class EvtEntityPotion extends SkriptEvent {

@SuppressWarnings("unchecked")
private Expression<PotionEffectType> potionEffects;
private Expression<EntityPotionEffectEvent.Cause> cause;

@Override
public boolean init(Literal<?>[] args, int matchedPattern, ParseResult parseResult) {
if (args.length > 0) {
Asleeepp marked this conversation as resolved.
Show resolved Hide resolved
potionEffects = (Expression<PotionEffectType>) args[0];
cause = (Expression<EntityPotionEffectEvent.Cause>) args[1];
}
return true;
}


@Override
public boolean check(Event event) {
if (!(event instanceof EntityPotionEffectEvent)) {
Expand All @@ -69,14 +70,15 @@ public boolean check(Event event) {
PotionEffectType effectType = potionEvent.getNewEffect().getType();
for (PotionEffectType potionEffectType : potionEffects.getArray(event)) {
if (potionEffectType.equals(effectType)) {
return true;
if (cause == null || cause.getSingle(event).equals(potionEvent.getCause())) {
return true;
}
}
}
Asleeepp marked this conversation as resolved.
Show resolved Hide resolved

return false;
}


@Override
public String toString(@Nullable Event event, boolean debug) {
return "on entity potion effect modification";
Expand Down
Loading