Skip to content

Commit

Permalink
Remove non-ascii-complaint characters from filename
Browse files Browse the repository at this point in the history
iceBear67 committed Jan 7, 2025
1 parent 547b58f commit 4b2d57a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/io/ib67/sfcraft/util/Helper.java
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@

public class Helper {
private static final Pattern ILLEGAL_CHARACTERS = Pattern.compile("[./\\\\#%!@&*]");
private static final Pattern NON_ASCII = Pattern.compile("[^a-zA-Z0-9_+()]");
public static final char COLOR = '§';

public static boolean canBack(ServerPlayerEntity player) {
@@ -54,7 +55,7 @@ public static String cleanFileName(String filename) {
if(name.length() > 32){
name = name.substring(0,32);
}
return name;
return NON_ASCII.matcher(name).replaceAll("");
}

public static boolean teleportSafely(ServerPlayerEntity player, ServerWorld world, int x, int y, int z, float yaw, float pitch) {

0 comments on commit 4b2d57a

Please sign in to comment.