Skip to content

Commit

Permalink
Remove 'Numeric ids are not supported anymore' error (#4371)
Browse files Browse the repository at this point in the history
  • Loading branch information
TPGamesNL authored Nov 3, 2021
1 parent cc7b792 commit 2da61de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 4 additions & 7 deletions src/main/java/ch/njol/skript/aliases/Aliases.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,14 @@ public static ItemType parseItemType(String s) {
@Nullable
private static ItemType parseType(final String s, final ItemType t, final boolean isAlias) {
ItemType i;
final String type = s;
if (type.isEmpty()) {
if (s.isEmpty()) {
t.add(new ItemData(Material.AIR));
return t;
} else if (type.matches("\\d+")) {
Skript.error("Numeric ids are not supported anymore.");
} else if (s.matches("\\d+")) {
return null;
} else if ((i = getAlias(type)) != null) {
} else if ((i = getAlias(s)) != null) {
for (ItemData d : i) {
d = d.clone();
t.add(d);
t.add(d.clone());
}
return t;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.util.Arrays;
import java.util.List;

import ch.njol.skript.lang.UnparsedLiteral;
import ch.njol.skript.util.LiteralUtils;
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;

Expand Down Expand Up @@ -209,9 +211,13 @@ public boolean validateFunction(boolean first) {
Expression<?> e = parameters[i].getConvertedExpression(p.type.getC());
if (e == null) {
if (first) {
Skript.error("The " + StringUtils.fancyOrderNumber(i + 1) + " argument given to the function '" + functionName + "' is not of the required type " + p.type + "."
+ " Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player, (iron ore and gold ore))')."
+ " Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work.");
if (LiteralUtils.hasUnparsedLiteral(parameters[i])) {
Skript.error("Can't understand this expression: " + parameters[i].toString());
} else {
Skript.error("The " + StringUtils.fancyOrderNumber(i + 1) + " argument given to the function '" + functionName + "' is not of the required type " + p.type + "."
+ " Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player, (iron ore and gold ore))')."
+ " Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work.");
}
} else {
Skript.error("The function '" + functionName + "' was redefined with different, incompatible arguments, but is still used in other script(s)."
+ " These will continue to use the old version of the function until Skript restarts.");
Expand Down

0 comments on commit 2da61de

Please sign in to comment.