allow for more characters in file names.
This commit is contained in:
1 parent
9b59b000a4
commit
639283fce3
2 files changed
+4
-3
No files matched your search
@@ -200,7 +200,7 @@ With the specified `resource` in the scripts folder, of a specific `type`, write
|
|||||||
content, or deletes the resource.
|
content, or deletes the resource.
|
||||||
|
|
||||||
Resource is identified by a path to the file.
|
Resource is identified by a path to the file.
|
||||||
A path can contain letters, numbers and folder separator: `'/'`. Any other characters are stripped
|
A path can contain letters, numbers, characters `-`, `+`, or `_`, and a folder separator: `'/'`. Any other characters are stripped
|
||||||
from the name. Empty descriptors are invalid. Do not add file extensions to the descriptor - extensions are inferred
|
from the name. Empty descriptors are invalid. Do not add file extensions to the descriptor - extensions are inferred
|
||||||
based on the `type` of the file.
|
based on the `type` of the file.
|
||||||
|
|
||||||
|
|||||||
@@ -1396,13 +1396,14 @@ public class CarpetExpression
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.expr.addLazyFunction("scoreboard_remove", -1, (c, t, lv)-> {
|
this.expr.addLazyFunction("scoreboard_remove", -1, (c, t, lv)-> {
|
||||||
|
if (lv.size()==0) throw new InternalExpressionException("'scoreboard_remove' requires at least one parameter");
|
||||||
CarpetContext cc = (CarpetContext)c;
|
CarpetContext cc = (CarpetContext)c;
|
||||||
Scoreboard scoreboard = cc.s.getMinecraftServer().getScoreboard();
|
Scoreboard scoreboard = cc.s.getMinecraftServer().getScoreboard();
|
||||||
String objectiveName = lv.get(0).evalValue(c).getString();
|
String objectiveName = lv.get(0).evalValue(c).getString();
|
||||||
ScoreboardObjective objective = scoreboard.getObjective(objectiveName);
|
ScoreboardObjective objective = scoreboard.getObjective(objectiveName);
|
||||||
if (objective == null)
|
if (objective == null)
|
||||||
return LazyValue.FALSE;
|
return LazyValue.FALSE;
|
||||||
if (lv.size() == 0)
|
if (lv.size() == 1)
|
||||||
{
|
{
|
||||||
scoreboard.removeObjective(objective);
|
scoreboard.removeObjective(objective);
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
@@ -2621,7 +2622,7 @@ public class CarpetExpression
|
|||||||
public static String recognizeResource(Value value)
|
public static String recognizeResource(Value value)
|
||||||
{
|
{
|
||||||
String origfile = value.getString();
|
String origfile = value.getString();
|
||||||
String file = origfile.toLowerCase(Locale.ROOT).replaceAll("[^A-Za-z0-9/]", "");
|
String file = origfile.toLowerCase(Locale.ROOT).replaceAll("[^A-Za-z0-9\\-+_/]", "");
|
||||||
file = Arrays.stream(file.split("/+")).filter(s -> !s.isEmpty()).collect(Collectors.joining("/"));
|
file = Arrays.stream(file.split("/+")).filter(s -> !s.isEmpty()).collect(Collectors.joining("/"));
|
||||||
if (file.isEmpty())
|
if (file.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user