Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
189cf10
Create AI effect and mark AI expression as deprecated
Phill310 May 2, 2026
c6c2fda
Create glowing effect and condition. Mark glow expression as deprecated
Phill310 May 2, 2026
954e54f
Create gravity effect. Mark gravity expression as deprecated
Phill310 May 2, 2026
bb3502f
Create projectile critical state effect and condition. Mark projectil…
Phill310 May 2, 2026
6a360c1
Register new syntax
Phill310 May 2, 2026
d9b262c
Add runtime warning when effect is used on a non-compatible projectile
Phill310 May 2, 2026
1436588
Use entity instead of living entity everywhere
Phill310 May 2, 2026
d8aa095
Allow deprecation warning to be suppressed
Phill310 May 5, 2026
7febfff
Improve syntax
Phill310 May 5, 2026
1fbf996
Merge branch 'dev/feature' into deprecate-boolean-expressions
Phill310 May 5, 2026
9246dbc
Use the infoBuilder and allow for multiple projectiles
Phill310 May 8, 2026
6c94d5c
Allow all entities to glow instead of just living entities
Phill310 May 8, 2026
b6343a0
Add condition for gravity
Phill310 May 8, 2026
6952919
Add tests
Phill310 May 8, 2026
baf6468
Merge remote-tracking branch 'upstream/dev/feature' into deprecate-bo…
Phill310 May 8, 2026
c4725a1
Merge remote-tracking branch 'origin/deprecate-boolean-expressions' i…
Phill310 May 8, 2026
e7cc66b
Update src/main/java/org/skriptlang/skript/bukkit/entity/elements/eff…
Phill310 May 9, 2026
d7380d2
Improve description
Phill310 May 9, 2026
63f0610
Merge remote-tracking branch 'origin/deprecate-boolean-expressions' i…
Phill310 May 9, 2026
15dd43d
Deprecate Flight Mode expression
Phill310 May 9, 2026
42c84c6
Apply suggestions from code review
Phill310 May 9, 2026
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
11 changes: 11 additions & 0 deletions src/main/java/ch/njol/skript/expressions/ExprAI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package ch.njol.skript.expressions;

import ch.njol.skript.Skript;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
Expand All @@ -16,11 +20,18 @@
@Description("Returns whether an entity has AI.")
@Example("set artificial intelligence of target entity to false")
@Since("2.5")
@Deprecated(since = "INSERT VERSION", forRemoval = true)
public class ExprAI extends SimplePropertyExpression<LivingEntity, Boolean> {

static {
register(ExprAI.class, Boolean.class, "(ai|artificial intelligence)", "livingentities");
}

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
Skript.warning("This expression is deprecated. Consider using the AI effect instead.");
Comment thread
Phill310 marked this conversation as resolved.
Outdated
return super.init(expressions, matchedPattern, isDelayed, parseResult);
}

@Override
@Nullable
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/ch/njol/skript/expressions/ExprGlowing.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package ch.njol.skript.expressions;

import ch.njol.skript.Skript;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
Expand All @@ -15,11 +19,18 @@
@Description("Indicates if targeted entity is glowing (new 1.9 effect) or not. Glowing entities can be seen through walls.")
@Example("set glowing of player to true")
@Since("2.2-dev18")
@Deprecated(since = "INSERT VERSION", forRemoval = true)
public class ExprGlowing extends SimplePropertyExpression<Entity, Boolean> {

static {
register(ExprGlowing.class, Boolean.class, "glowing", "entities");
}

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
Skript.warning("This expression is deprecated. Consider using the glowing effect instead.");
return super.init(expressions, matchedPattern, isDelayed, parseResult);
}

@Override
public Boolean convert(final Entity e) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/ch/njol/skript/expressions/ExprGravity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package ch.njol.skript.expressions;

import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
Expand All @@ -16,11 +19,18 @@
@Description("If entity is affected by gravity or not, i.e. if it has Minecraft 1.10+ NoGravity flag.")
@Example("set gravity of player off")
@Since("2.2-dev21")
@Deprecated(since = "INSERT VERSION", forRemoval = true)
public class ExprGravity extends SimplePropertyExpression<Entity, Boolean> {

static {
register(ExprGravity.class, Boolean.class, "gravity", "entities");
}

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
Skript.warning("This expression is deprecated. Consider using the gravity effect instead.");
return super.init(expressions, matchedPattern, isDelayed, parseResult);
}

@Override
public Boolean convert(final Entity e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package ch.njol.skript.expressions;

import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Projectile;
Expand All @@ -23,13 +26,20 @@
set projectile critical mode of event-projectile to true
""")
@Since("2.5.1")
@Deprecated(since = "INSERT VERSION", forRemoval = true)
public class ExprProjectileCriticalState extends SimplePropertyExpression<Projectile, Boolean> {

private static final boolean abstractArrowExists = Skript.classExists("org.bukkit.entity.AbstractArrow");

static {
register(ExprProjectileCriticalState.class, Boolean.class, "(projectile|arrow) critical (state|ability|mode)", "projectiles");
}

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
Skript.warning("This expression is deprecated. Consider using the projectile critical state effect instead.");
return super.init(expressions, matchedPattern, isDelayed, parseResult);
}

@Nullable
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import org.skriptlang.skript.addon.HierarchicalAddonModule;
import org.skriptlang.skript.addon.SkriptAddon;
import org.skriptlang.skript.bukkit.entity.displays.DisplayModule;
import org.skriptlang.skript.bukkit.entity.elements.conditions.CondIsGlowing;
import org.skriptlang.skript.bukkit.entity.elements.conditions.CondProjectileIsCritical;
import org.skriptlang.skript.bukkit.entity.elements.effects.EffAI;
import org.skriptlang.skript.bukkit.entity.elements.effects.EffGlowing;
import org.skriptlang.skript.bukkit.entity.elements.effects.EffGravity;
import org.skriptlang.skript.bukkit.entity.elements.effects.EffProjectileCriticalState;
import org.skriptlang.skript.bukkit.entity.interactions.InteractionModule;
import org.skriptlang.skript.bukkit.entity.elements.expressions.ExprDeathMessage;
import org.skriptlang.skript.bukkit.entity.entitydata.NautilusData;
Expand Down Expand Up @@ -38,6 +44,14 @@ protected void loadSelf(SkriptAddon addon) {
}

register(addon,
CondIsGlowing::register,
CondProjectileIsCritical::register,

EffAI::register,
EffGlowing::register,
EffGravity::register,
EffProjectileCriticalState::register,

ExprDeathMessage::register
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.skriptlang.skript.bukkit.entity.elements.conditions;

import ch.njol.skript.conditions.base.PropertyCondition;
import ch.njol.skript.doc.*;
import org.bukkit.entity.Entity;
import org.skriptlang.skript.registration.SyntaxRegistry;

@Name("Is Glowing")
@Description("Checks whether or not a living entity is glowing.")
@Example("""
command /glow:
trigger:
if player is glowing:
make player stop glowing
else:
make player glow
""")
@Since("INSERT VERSION")
public class CondIsGlowing extends PropertyCondition<Entity> {

public static void register(SyntaxRegistry registry) {
registry.register(
SyntaxRegistry.CONDITION,
infoBuilder(
CondIsGlowing.class,
PropertyType.BE,
"glowing",
"entities"
)
.supplier(CondIsGlowing::new)
.build()
);
}

@Override
public boolean check(Entity entity) {
return entity.isGlowing();
}

@Override
protected String getPropertyName() {
return "glowing";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.skriptlang.skript.bukkit.entity.elements.conditions;

import ch.njol.skript.conditions.base.PropertyCondition;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Example;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Projectile;
import org.skriptlang.skript.log.runtime.RuntimeErrorProducer;
import org.skriptlang.skript.registration.SyntaxInfo;
import org.skriptlang.skript.registration.SyntaxRegistry;

@Name("Projectile Is Critical")
@Description("Checks whether or not a projectile is in critical state. As of now this only applies to arrows and tridents.")
@Example("""
on shoot:
if event-projectile is not in projectile critical state:
enable projectile critical state of event-projectile
""")
@Since("INSERT VERSION")
public class CondProjectileIsCritical extends PropertyCondition<Projectile> implements RuntimeErrorProducer {

public static void register(SyntaxRegistry registry) {
registry.register(
SyntaxRegistry.CONDITION,
SyntaxInfo.builder(CondProjectileIsCritical.class)
.addPatterns(
"%projectile% is in (projectile|arrow) critical (state|mode)",
"%projectile% (is not|isn't) in (projectile|arrow) critical (state|mode)")
Comment thread
Phill310 marked this conversation as resolved.
Outdated
.supplier(CondProjectileIsCritical::new)
.build()
);
}

@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
setNegated(matchedPattern == 1);
return super.init(exprs, matchedPattern, isDelayed, parseResult);
}

@Override
public boolean check(Projectile projectile) {
if (projectile instanceof AbstractArrow abstractArrow) {
return abstractArrow.isCritical();
}
warning("This projectile is not supported. This only applies to arrows and tridents.");
return false;
}

protected String getPropertyName() {
return "projectile critical state";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.skriptlang.skript.bukkit.entity.elements.effects;

import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Example;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.SyntaxStringBuilder;
import ch.njol.util.Kleenean;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
import org.skriptlang.skript.registration.SyntaxInfo;
import org.skriptlang.skript.registration.SyntaxRegistry;

@Name("Entity AI")
@Description("Change whether an entity has AI.")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more description. what does it mean to have or not have ai?

@Example("enable artificial intelligence of target entity")
@Example("disable ai of last spawned entity")
@Since("INSERT VERSION")
public class EffAI extends Effect {

public static void register(SyntaxRegistry registry) {
registry.register(
SyntaxRegistry.EFFECT,
SyntaxInfo.builder(EffAI.class)
.addPatterns(
"(enable|:disable) (ai|artificial intelligence) of %livingentities%",
Comment thread
Phill310 marked this conversation as resolved.
Outdated
"(enable|:disable) %livingentities%'s (ai|artificial intelligence)"
)
.supplier(EffAI::new)
.build()
);
}

private Expression<LivingEntity> entities;
private boolean negated;

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
//noinspection unchecked
entities = (Expression<LivingEntity>) expressions[0];
negated = parseResult.hasTag("disable");
return true;
}

@Override
protected void execute(Event event) {
for (LivingEntity entity : entities.getArray(event)) {
entity.setAI(!negated);
}
}

@Override
public String toString(@Nullable Event event, boolean debug) {
return new SyntaxStringBuilder(event, debug)
.appendIf(!negated, "enable")
.appendIf(negated, "disable")
Comment thread
Phill310 marked this conversation as resolved.
Outdated
.append("ai of", entities)
.toString();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.skriptlang.skript.bukkit.entity.elements.effects;

import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Example;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.SyntaxStringBuilder;
import ch.njol.util.Kleenean;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event;
import org.jetbrains.annotations.Nullable;
import org.skriptlang.skript.registration.SyntaxInfo;
import org.skriptlang.skript.registration.SyntaxRegistry;

@Name("Entity Glow")
@Description("Change whether an entity is glowing.")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more description

@Example("make target entity glow")
@Example("make player stop glowing")
@Since("INSERT VERSION")
public class EffGlowing extends Effect {

public static void register(SyntaxRegistry registry) {
registry.register(
SyntaxRegistry.EFFECT,
SyntaxInfo.builder(EffGlowing.class)
.addPatterns(
"make %entities% [negate:not] glow",
"make %entities% (negate:stop|start) glowing"
Comment thread
Phill310 marked this conversation as resolved.
Outdated
)
.supplier(EffGlowing::new)
.build()
);
}

private Expression<LivingEntity> entities;
private boolean negated;

@Override
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
//noinspection unchecked
entities = (Expression<LivingEntity>) expressions[0];
negated = parseResult.hasTag("negate");
return true;
}

@Override
protected void execute(Event event) {
for (LivingEntity entity : entities.getArray(event)) {
entity.setGlowing(!negated);
}
}

@Override
public String toString(@Nullable Event event, boolean debug) {
return new SyntaxStringBuilder(event, debug)
.append("make", entities)
.appendIf(negated, "not")
.append("glow")
.toString();
}

}
Loading