From 5feb83d5555060fd90b2bf46de870b084a50f298 Mon Sep 17 00:00:00 2001 From: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:07:28 -0500 Subject: [PATCH] Remove EffDashing --- .../njol/skript/conditions/CondIsDashing.java | 6 +- .../ch/njol/skript/effects/EffDashing.java | 59 ------------------- .../ch/njol/skript/effects/EffSprinting.java | 8 ++- .../tests/syntaxes/effects/EffDashing.sk | 9 --- 4 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 src/main/java/ch/njol/skript/effects/EffDashing.java delete mode 100644 src/test/skript/tests/syntaxes/effects/EffDashing.sk diff --git a/src/main/java/ch/njol/skript/conditions/CondIsDashing.java b/src/main/java/ch/njol/skript/conditions/CondIsDashing.java index a190e03e250..089c2d7e458 100644 --- a/src/main/java/ch/njol/skript/conditions/CondIsDashing.java +++ b/src/main/java/ch/njol/skript/conditions/CondIsDashing.java @@ -9,10 +9,10 @@ import org.bukkit.entity.LivingEntity; @Name("Camel Is Dashing") -@Description("Checks whether a camel is sprinting.") +@Description("Checks whether a camel is dashing.") @Examples({ - "if last spawned camel is not dashing:", - "\tmake last spawned camel start dashing" + "if last spawned camel is dashing:", + "\tkill last spawned camel" }) @Since("INSERT VERSION") public class CondIsDashing extends PropertyCondition { diff --git a/src/main/java/ch/njol/skript/effects/EffDashing.java b/src/main/java/ch/njol/skript/effects/EffDashing.java deleted file mode 100644 index 4aa721105bf..00000000000 --- a/src/main/java/ch/njol/skript/effects/EffDashing.java +++ /dev/null @@ -1,59 +0,0 @@ -package ch.njol.skript.effects; - -import ch.njol.skript.Skript; -import ch.njol.skript.doc.Description; -import ch.njol.skript.doc.Examples; -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.ParseResult; -import ch.njol.util.Kleenean; -import org.bukkit.entity.Camel; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Event; -import org.jetbrains.annotations.Nullable; - -@Name("Camel Dashing") -@Description({ - "Make a camel start or stop dashing.", - "Dashing is a temporary speed burst, a dash lasts for 0.35 seconds." -}) -@Examples({ - "make last spawned camel start dashing", - "make last spawned camel stop dashing", -}) -@Since("INSERT VERSION") -public class EffDashing extends Effect { - - static { - Skript.registerEffect(EffDashing.class, - "make %livingentities% (start dashing|dash)", - "make %livingentities% stop dashing"); - } - - private Expression entities; - private boolean dash; - - @Override - public boolean init(Expression[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) { - //noinspection unchecked - entities = (Expression) exprs[0]; - dash = matchedPattern == 0; - return true; - } - - @Override - protected void execute(Event event) { - for (LivingEntity entity : entities.getArray(event)) { - if (entity instanceof Camel camel) - camel.setDashing(dash); - } - } - - @Override - public String toString(@Nullable Event event, boolean debug) { - return "make " + entities.toString(event, debug) + (dash ? " start" : " stop") + " dashing"; - } - -} diff --git a/src/main/java/ch/njol/skript/effects/EffSprinting.java b/src/main/java/ch/njol/skript/effects/EffSprinting.java index 3e3f2154928..e8e7f8741c0 100644 --- a/src/main/java/ch/njol/skript/effects/EffSprinting.java +++ b/src/main/java/ch/njol/skript/effects/EffSprinting.java @@ -17,7 +17,7 @@ @Description("Make a player start or stop sprinting.") @Examples({ "make player start sprinting", - "make last spawned camel sprint" + "force player to start sprinting" }) @Since("INSERT VERSION") public class EffSprinting extends Effect { @@ -25,7 +25,9 @@ public class EffSprinting extends Effect { static { Skript.registerEffect(EffSprinting.class, "make %players% (start sprinting|sprint)", - "make %players% (stop sprinting|not sprint)"); + "force %players% to (start sprinting|sprint)", + "make %players% (stop sprinting|not sprint)", + "force %players% to (stop sprinting|not sprint)"); } private Expression players; @@ -35,7 +37,7 @@ public class EffSprinting extends Effect { public boolean init(Expression[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) { //noinspection unchecked players = (Expression) exprs[0]; - sprint = matchedPattern == 0; + sprint = matchedPattern <= 1; return true; } diff --git a/src/test/skript/tests/syntaxes/effects/EffDashing.sk b/src/test/skript/tests/syntaxes/effects/EffDashing.sk deleted file mode 100644 index d8a405fcb54..00000000000 --- a/src/test/skript/tests/syntaxes/effects/EffDashing.sk +++ /dev/null @@ -1,9 +0,0 @@ -test "camel dashing" when running minecraft "1.20": - # Test fails on 1.19.4, effect does work. - spawn a camel at test-location: - set {_entity} to entity - make {_entity} start dashing - assert {_entity} is dashing with "Camel should be dashing" - make {_entity} stop dashing - assert {_entity} is not dashing with "Camel should not be dashing" - clear entity within {_entity}