Skip to content

Commit ab8194e

Browse files
authored
Merge branch 'dev/feature' into feature/enchant-with-levels
2 parents 04ff9ba + 4b1a30c commit ab8194e

5 files changed

Lines changed: 34 additions & 20 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ allprojects {
2727
dependencies {
2828
shadow group: 'io.papermc', name: 'paperlib', version: '1.0.8'
2929
shadow group: 'org.bstats', name: 'bstats-bukkit', version: '3.1.0'
30-
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.4.0'
30+
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.4.1'
3131

3232
implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.21.8-R0.1-SNAPSHOT'
3333
implementation group: 'com.google.code.findbugs', name: 'findbugs', version: '3.0.1'

src/main/java/ch/njol/skript/effects/EffVisualEffect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class EffVisualEffect extends Effect {
3030
static {
3131
Skript.registerEffect(EffVisualEffect.class,
3232
"(play|show) %visualeffects% (on|%directions%) %entities/locations% [(to %-players%|in (radius|range) of %-number%)]",
33-
"(play|show) %number% %visualeffects% (on|%directions%) %locations% [(to %-players%|in (radius|range) of %-number%)]");
33+
"(play|show) %number% %visualeffects% (on|%directions%) %entities/locations% [(to %-players%|in (radius|range) of %-number%)]");
3434
}
3535

3636
@SuppressWarnings("NotNullFieldNotInitialized")

src/main/java/ch/njol/skript/expressions/ExprLoopValue.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
package ch.njol.skript.expressions;
22

33
import ch.njol.skript.Skript;
4-
import ch.njol.skript.lang.KeyProviderExpression;
5-
import ch.njol.skript.lang.KeyedValue;
6-
import org.skriptlang.skript.lang.converter.ConverterInfo;
74
import ch.njol.skript.doc.Description;
85
import ch.njol.skript.doc.Examples;
96
import ch.njol.skript.doc.Name;
107
import ch.njol.skript.doc.Since;
118
import ch.njol.skript.lang.Expression;
129
import ch.njol.skript.lang.ExpressionType;
10+
import ch.njol.skript.lang.KeyProviderExpression;
11+
import ch.njol.skript.lang.KeyedValue;
1312
import ch.njol.skript.lang.SkriptParser.ParseResult;
14-
import ch.njol.skript.lang.util.ConvertedExpression;
1513
import ch.njol.skript.lang.util.SimpleExpression;
1614
import ch.njol.skript.registrations.Classes;
17-
import org.skriptlang.skript.lang.converter.Converters;
1815
import ch.njol.skript.sections.SecLoop;
1916
import ch.njol.skript.util.Utils;
2017
import ch.njol.util.Kleenean;
@@ -150,19 +147,6 @@ public boolean isSingle() {
150147
return true;
151148
}
152149

153-
@Override
154-
@Nullable
155-
@SuppressWarnings("unchecked")
156-
protected <R> ConvertedExpression<Object, ? extends R> getConvertedExpr(Class<R>... to) {
157-
if (isKeyedLoop && !isIndex) {
158-
Class<R> superType = (Class<R>) Utils.getSuperType(to);
159-
return new ConvertedExpression<>(this, superType,
160-
new ConverterInfo<>(Object.class, superType, o -> Converters.convert(o, to), 0));
161-
} else {
162-
return super.getConvertedExpr(to);
163-
}
164-
}
165-
166150
@Override
167151
public Class<?> getReturnType() {
168152
if (isIndex)

src/main/java/ch/njol/skript/util/Color.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,11 @@ public interface Color extends YggdrasilExtendedSerializable {
4444
*/
4545
String getName();
4646

47+
/**
48+
* @return the color as an ARGB integer.
49+
*/
50+
default int asARGB() {
51+
return asBukkitColor().asARGB();
52+
}
53+
4754
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
###
2+
this test converts an itemtype to itemstack, which is not AnyNamed.
3+
If the loop value loses its converter info, it will not be
4+
able to use the name of loop-value expression.
5+
This is due to the returned value being ItemStack, and failing
6+
the instanceof AnyNamed check.
7+
8+
If the loop value retains its converter info, it will be able to
9+
convert to AnyNamed and use the name of loop-value expression.
10+
###
11+
12+
13+
test "expr loop value loses converter info":
14+
set {_item::*} to asItemStack(phantom membrane named "Test")
15+
loop {_item::*}:
16+
# these should always pass
17+
assert loop-value is a phantom membrane with "loop-value is not a phantom membrane"
18+
assert loop-value is a phantom membrane named "Test" with "loop-value is not a phantom membrane named 'Test'"
19+
# the critical assert
20+
assert name of loop-value is "Test" with "name of loop-value is not 'Test'. ExprLoopValue may have lost converter info"
21+
22+
local function asItemStack(i: item) :: item:
23+
return {_i}

0 commit comments

Comments
 (0)