Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
5fe45ff161
Commit
6fd08c3b9d
@ -228,10 +228,14 @@ public class SchematicSelector {
|
|||||||
SWAnvilInv inv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_CREATE_DIR_TITLE", player));
|
SWAnvilInv inv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_CREATE_DIR_TITLE", player));
|
||||||
inv.setItem(Material.CHEST);
|
inv.setItem(Material.CHEST);
|
||||||
inv.setCallback(s -> {
|
inv.setCallback(s -> {
|
||||||
|
if(!SchematicNode.invalidSchemName(new String[] {s})) {
|
||||||
if(injectable.onFolderCreate(this, s)) {
|
if(injectable.onFolderCreate(this, s)) {
|
||||||
SchematicNode.createSchematicDirectory(user.getId(), s, parent==null?0:parent.getId());
|
SchematicNode.createSchematicDirectory(user.getId(), s, parent==null?0:parent.getId());
|
||||||
openList(parent);
|
openList(parent);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
@ -604,4 +604,28 @@ public class SchematicNode {
|
|||||||
list.remove("//copy");
|
list.remove("//copy");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final List<String> FORBIDDEN_NAMES = Collections.unmodifiableList(Arrays.asList("public"));
|
||||||
|
public static boolean invalidSchemName(String[] layers) {
|
||||||
|
for (String layer : layers) {
|
||||||
|
if (layer.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (layer.contains("/") ||
|
||||||
|
layer.contains("\\") ||
|
||||||
|
layer.contains("<") ||
|
||||||
|
layer.contains(">") ||
|
||||||
|
layer.contains("^") ||
|
||||||
|
layer.contains("°") ||
|
||||||
|
layer.contains("'") ||
|
||||||
|
layer.contains("\"") ||
|
||||||
|
layer.contains(" ")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(FORBIDDEN_NAMES.contains(layer.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren