mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Fix commands not matching unicode-formatted homes, prevent dot in home names
This commit is contained in:
1 parent
bd4d173bdc
commit
7b1930e554
2 files changed
+5
-3
No files matched your search
@@ -9,7 +9,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cross-platform manager for validating homes and warps and updating them as neccessary
|
* Cross-platform manager for validating homes and warps and updating them as neccessary
|
||||||
@@ -353,11 +352,14 @@ public class SavedPositionManager {
|
|||||||
if (positionMeta.name.length() > 16) {
|
if (positionMeta.name.length() > 16) {
|
||||||
return Optional.of(SaveResult.ResultType.FAILED_NAME_LENGTH);
|
return Optional.of(SaveResult.ResultType.FAILED_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
if (!allowUnicodeNames || positionMeta.name.contains(Pattern.quote("."))) {
|
if (!allowUnicodeNames) {
|
||||||
if (!RegexUtil.NAME_PATTERN.matcher(positionMeta.name).matches()) {
|
if (!RegexUtil.NAME_PATTERN.matcher(positionMeta.name).matches()) {
|
||||||
return Optional.of(SaveResult.ResultType.FAILED_NAME_CHARACTERS);
|
return Optional.of(SaveResult.ResultType.FAILED_NAME_CHARACTERS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (positionMeta.name.contains(".")) {
|
||||||
|
return Optional.of(SaveResult.ResultType.FAILED_NAME_CHARACTERS);
|
||||||
|
}
|
||||||
if (positionMeta.description.length() > 255) {
|
if (positionMeta.description.length() > 255) {
|
||||||
return Optional.of(SaveResult.ResultType.FAILED_DESCRIPTION_LENGTH);
|
return Optional.of(SaveResult.ResultType.FAILED_DESCRIPTION_LENGTH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public final class RegexUtil {
|
|||||||
* <p>
|
* <p>
|
||||||
* e.g. {@code ownerName.homeName}
|
* e.g. {@code ownerName.homeName}
|
||||||
*/
|
*/
|
||||||
private static final Pattern OWNER_DISAMBIGUATED_HOME_IDENTIFIER_PATTERN = Pattern.compile("\\w+\\.[A-Za-z\\d_\\-]+");
|
private static final Pattern OWNER_DISAMBIGUATED_HOME_IDENTIFIER_PATTERN = Pattern.compile("\\w+\\.[^.]{1,16}$");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match pattern for checking home input fields disambiguated by the owner's name
|
* Match pattern for checking home input fields disambiguated by the owner's name
|
||||||
|
|||||||
Reference in new issue
Block a user